## 1.5 Qubits, gates, and circuits

Atoms, trapped ions, molecules, nuclear spins, and many other quantum objects with two pre-selected basis states labelled as |0\rangle and |1\rangle can be used to implement simple quantum interference — from now on we will call such objects quantum bits, or qubits. But note that there is no need to learn about the physics behind these diverse technologies (e.g. “what is nuclear spin?”) if all you want is to understand the basics of quantum theory. Indeed, from now on we will conveniently forget about any specific experimental realisation of a qubit and represent a generic single-qubit interference graphically as a circuit diagram:26

This diagram should be read from left to right. The horizontal line represents a qubit that is inertly carried from one quantum operation to another. We often call this line a quantum wire. The wire may describe translation in space (e.g. atoms travelling through cavities) or translation in time (e.g. a sequence of operations performed on a trapped ion).27 The boxes or circles on the wire represent elementary quantum operations, called quantum (logic) gates.

In the example circuit above, we have two types of gates: two Hadamard gates H (think “resonant interaction”) and one phase gate P_\varphi (think “dispersive interaction”), where28 H=\begin{bmatrix} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\\frac{1}{\sqrt{2}} & \frac{-1}{\sqrt{2}} \end{bmatrix} \quad\text{and}\quad P_\varphi = \begin{bmatrix} 1 & 0 \\0 & e^{i\varphi} \end{bmatrix}.

The input qubits appear as state vectors on the left side of circuit diagrams, and the output qubits as state vectors on the right. The product of the three matrices29 HP_\varphi H =\begin{bmatrix}\cos\frac{\varphi}{2} & -i\sin\frac{\varphi}{2}\\\ -i\sin\frac{\varphi}{2}& \cos\frac{\varphi}{2}\end{bmatrix} describes the action of the whole circuit, telling us that it maps input state vectors to output state vectors as follows: \begin{array}{lcr} |0\rangle & \longmapsto & \cos\frac{\varphi}{2}|0\rangle - i\sin\frac{\varphi}{2}|1\rangle, \\|1\rangle & \longmapsto &- i\sin\frac{\varphi}{2}|0\rangle + \cos\frac{\varphi}{2}|1\rangle. \end{array}

1. Do not confuse the interference diagrams of Figure 1.1 and Figure 1.3 with the circuit diagram. In the circuit diagrams, which we will use almost constantly from now on, a single line represents a single qubit.↩︎

2. Yet again we see that we can conveniently forget about the actual physical implementations, treating them all with the same abstract description.↩︎

3. Global phase factors are irrelevant; it is only the relative phase \varphi =\varphi_1-\varphi_0 that matters. For example, in a single-qubit phase gate P_\varphi we usually factor out e^{i\varphi_0}, leaving us with the two diagonal entries: 1 and e^{i\varphi}.↩︎

4. cf. Figure 1.3. Note again that circuits are read left to right, but matrix composition goes right to left. Since the first and last matrices/gates are the same (i.e. both are H), we don’t notice this, but it’s important to note that the first (i.e. leftmost) H in the matrix product HP_\varphi H corresponds to the last (i.e. rightmost) H in the circuit diagram.↩︎