#### A Crash Course on Quantum Computers

#### Nathaniel Zehner

^{1}, \( | 0 \rangle\) and \( | 1 \rangle \), which, in vector form, are \( \left[ \begin{smallmatrix} 1 \\ 0 \end{smallmatrix} \right]\) and \( \left[ \begin{smallmatrix} 0 \\ 1 \end{smallmatrix} \right]\)respectively. In fact, every possible qubit can be represented using a vector \( \left[ \begin{smallmatrix} a \\ b \end{smallmatrix} \right]\), as long as the vector is of length one. When we have a vector \( \left[ \begin{smallmatrix} a \\ b \end{smallmatrix} \right]\), we can split it into \( a \left[ \begin{smallmatrix} 1 \\ 0 \end{smallmatrix} \right] + b \left[ \begin{smallmatrix} 0 \\ 1 \end{smallmatrix} \right]\). We say a qubit in such a state is in a

*superposition*– it is both a \( | 0 \rangle \) and a \( | 1 \rangle \) at the same time.

There is, however, nothing special representing a qubit using a superposition of \( | 0 \rangle \) and \( | 1 \rangle \). Instead, we can split a qubit into a superposition of any two perpendicular vectors. A common pair of vectors is the horizontal \( | + \rangle \) and \( | – \rangle \) pair: \( | + \rangle \) is \( \frac{1}{\sqrt2}| 0 \rangle + \frac{1}{\sqrt2}| 1 \rangle \) and \( | – \rangle \) is \( \frac{1}{\sqrt2}| 0 \rangle – \frac{1}{\sqrt2}| 1 \rangle \). These vectors are both perpendicular and of length one.

*A visual depiction of the perpendicular-vector pairs mentioned above.*

^{2}Your intuition might say that since \( | 0 \rangle \) is halfway between \( | + \rangle \) and \( | – \rangle \), the result of our measurement would be \( | + \rangle \) half of the time, and \( | – \rangle \) the other half of the time. Indeed, this is correct. With some more complicated linear algebra, one can show that in general, when we have a qubit \( \left[ \begin{smallmatrix} a \\ b \end{smallmatrix} \right] = a| 0 \rangle +b| 1 \rangle \), the probability to measure \( | 0 \rangle \) is \(a^2\) and the probability to measure \( | 1 \rangle \) is \(b^2\).

*unitary matrix*, depending on how each gate manipulates each qubit. A final point to mention is that a quantum computer can do everything a classical computer can using a series of quantum gates. This might seem trivially obvious, but since a qubit, unlike a bit, cannot be cloned, it is rather tricky to show, so we won’t do that here.

*constant*. Likewise, since \(f_1\) and \(f_2\) outputs are evenly split between \(0\) and \(1\), we call it

*balanced*. We are given one of these four functions and our task is to determine whether our given function is constant or balanced. Naïvely, we can plug in both \(0\) and \(1\) into our function with a classical computer to get an answer. With a quantum computer, however, we can do better. We’ll use a new quantum gate, \(B_f\), that transforms \(| x \rangle \otimes | y \rangle \) into \(| x \rangle \otimes | y \oplus f(x) \rangle \). The \( \oplus \) symbol denotes the XOR operation, which acts like addition except with the property that \(1 \oplus 1 = 0\).

*The boxes with an H represent Hadamard gates, and B _{f} is the new quantum gate we saw above. The circle with a capital M is a measuring apparatus – notice how we only need to measure the first qubit to get our desired results.*

*one*evaluation, rather than two.

^{1}The \(|0\rangle\) notation is known as Dirac or bra-ket notation, and is used ubiquitously for quantum computing.

^{2}If you have a sharp mathematical eye, you might notice that the \(\frac{1}{\sqrt2}\) used for \(|+\rangle\) and \(|-\rangle\) is \(\sin{45}\) and \(\cos{45}\), which seems to only be half of the \(90°\) rotation needed to go from vertical to horizontal. This is because \(|0\rangle\) and \(|1\rangle\) used are only \(90°\) apart, only half of the full 180 degrees between “up” and “down”. Don’t worry, the maths still checks out!

**References:**

Bernhardt, C. (2020) ** Quantum Computing for Everyone**. Cambridge, MA ; London: The MIT Press.

Wikipedia:

*<https://en.wikipedia.org/wiki/Quantum_state>*

*<https://en.wikipedia.org/wiki/David_Deutsch>*

*<https://en.wikipedia.org/wiki/List_of_quantum_logic_gates>*

*<https://en.wikipedia.org/wiki/Bit>*

*<https://en.wikipedia.org/wiki/Quantum_logic_gate>*

*<https://en.wikipedia.org/wiki/Quantum_computing>*

*<https://simple.wikipedia.org/wiki/Quantum_computer>*