bloch-sphere-0

Single Qubit Gates

The 11s and 00s in classical computers are fairly useless by themselves. In order to represent meaningful computation we need to be able to manipulate them.

We achieve this using logic gates. The most simple logic gate is the NOT\textmd{NOT} gate which inverts the input sending 00 11 and 11 00.

We can better represent the operation of this gate with something called a truth table. This is a table that shows all possible inputs and their corresponding outputs. For the NOT\textmd{NOT} gate this would look like:

ANOT A
01
10

For the NOT gate this is fairly simple, but we will find this representation more useful as we introduce more gates later.

In order to represent more complicated circuits without needing crazy mathematical formula to solve, we have special symbols assigned to each gate that can be used in a circuit diagram. The NOT\textmd{NOT} gate is represented as:

From this one gate we can build a very simple circuit such as:

In circuit diagrams like this we can think of the bits as "flowing" from left to right. So in the above circuit we would read it as "apply the NOT\textmd{NOT} gate to the input, then apply another NOT\textmd{NOT} gate to the output of the first NOT\textmd{NOT} gate". Clearly this circuit implements the identity operation. That is, the operation that takes 1111 and 0000.

A little thinking shows us there are only 4 possible single bit gates. The NOT\textmd{NOT} gate that we have already seen, the identity gate that we described above, a gate that maps all inputs to 11 and a gate that maps all inputs to 00.

Quantum Gates

Just like in classical computation, we will have gates that allow us to manipulate qubits. Quantum gates are the quantum equivalent of classical logic gates. They take qubits as input and produce qubits as output. We can use these gates to perform complex algorithms and computations just like we can with their classical counterpart.

Now remember how we said our qubits will be represented as vectors? Well we know we can act on vectors with operators. We will use these operators to represent our gates!

Since qubits are more than just classical bits, we have a slightly more interesting set of single qubit gates to study. We've already seen some of these linear operator gates in a previous article, let's restate them here:

I=00+11X=01+10Y=i01+i10Z=0011I = \ket{0}\bra{0} + \ket{1}\bra{1} \\[3ex] X = \ket{0}\bra{1} + \ket{1}\bra{0} \\[3ex] Y = -i\ket{0}\bra{1} + i\ket{1}\bra{0} \\[3ex] Z = \ket{0}\bra{0} - \ket{1}\bra{1}

We will represent these gates in circuit diagrams very similar to the way we represent classical gates. For example a circuit where we apply the X gate followed by a Z gate would look like:

Note that quantum circuits can be a bit confusing since the mathematical definition of this circuit is ZXψZX\ket{\psi} and not XZψXZ\ket{\psi}. This is because we read circuits from left to right but apply operators from right to left.

Let's introduce a new single qubit gate we haven't seen before: the Hadamard gate (named after the mathematician Jacques Hadamard). This gate is useful for creating superpositions. It takes 0\ket{0}+\ket{+} and 1\ket{1}\ket{-}.

We can define the Hadamard gates in terms of an outer product:

H=12(00+10+0111)H = \frac{1}{\sqrt{2}}(\ket{0}\bra{0} + \ket{1}\bra{0} + \ket{0}\bra{1} - \ket{1}\bra{1})

Sometimes it can be helpful to factor the bras out from the kets for operators like this:

H=12(0+1)0+12(01)1=+0+1H = \frac{1}{\sqrt{2}}(\ket{0} + \ket{1})\bra{0} + \frac{1}{\sqrt{2}}(\ket{0} - \ket{1})\bra{1} \\[3ex] = \ket{+}\bra{0} + \ket{-}\bra{1}

This is a useful representation as it more clearly shows us what happens to the basis states.

Exercises

Exercise 1

Prove that the hadamard gate is its own inverse.

In other words show that HH=IHH = I.

Show solution

Exercise 2

Show that HXH=ZHXH = Z

Show solution

Exercise 3

Prove that the vectors +\ket{+} and \ket{-} form an orthonormal basis for the single qubit state.

To recap that requires us to prove the following:

  • Linear independence: Show that +\ket{+} can't be written as a linear multiple of \ket{-} and vice-versa.
  • Spanning: Show that any qubit state can be written as a linear combination of +\ket{+} and \ket{-}
  • Normality: Show that ++==1\braket{+|+} = \braket{-|-} = 1
  • Orthogonality: Show that +=+=0\braket{+|-} = \braket{-|+} = 0
Show solution
> Next Article (Multiple Qubits)