Single Qubit Gates
Learn how single qubit gates function as reversible unitary transformations on quantum states represented on the Bloch Sphere. Understand key gates such as Pauli X, Y, Z, and Hadamard, and see how they manipulate superposition and phase in qubits to enable quantum algorithms.
We'll cover the following...
Quantum gates
So far, we’ve only talked about quantum gates in an abstract sense, that they are operations that manipulate the quantum state of a qubit. Let’s take a look at how this works formally.
A vector represents a quantum state. The only way we can manipulate this vector is by rotating it in the state space. We cannot change its length because of the normalization constraint.
Matrices play a key role in transformations. We can think of a vector rotation as a transformation in the state space. A matrix transformation can represent each rotation. We can apply this transformation to a vector by performing a matrix multiplication with the matrix.
We want our quantum gates to be reversible. We can achieve this by representing quantum gates as unitary matrices.
A complex-valued square matrix is unitary if its conjugate transpose is also its inverse.
In other words, applying such a transformation twice will revert the state vector to its original position. Think of it as a clockwise rotation followed by an equal anti-clockwise rotation. We would land at the same place in the state space. The Bloch Sphere will play a vital role here to visualize these rotations.
The Pauli gates
These quantum gates are based on the Pauli spin matrices. We need not go into the details of why they’re called Pauli spin. Let’s just look at the effect of these gates on a qubit.
The X gate
This is the quantum equivalent of the NOT gate. It is defined as follows:
We know that it will convert the state to and vice versa. Let’s have a look at this operation mathematically:
This was straightforward. However, we must also look at the effect of these gates on superposition states. Let’s take an arbitrary superposition state and apply the gate on it:
We can think of this as swapping the amplitudes of components in the superposition state.
Visually, we can think of an -gate operation as a rotation of radians around the X-axis of the Bloch sphere.
The Y gate
The Pauli- gate is defined as follows:
The easiest way to understand this gate is by thinking of it as a rotation of radians across the Y-axis of the Bloch Sphere.
If you visualize this rotation in the 3-D space you’ll notice this gate also converts the state to and vice versa but there’s a slight difference. It applies a global phase to these states as well. Let’s have a look:
Remember when we said we don’t really care about the global phase because it doesn’t matter during the measurement. The square of such a value like or just turns out to be 1, which doesn’t affect the measurement properties at all. So, we can ignore the global phase. This gate can come in handy while dealing with superposition states, though.
The Z gate
It is also known as the phase-flip gate. It is defined as follows:
Similar to the other two, this gate can be thought of as a rotation of radians across the -axis of the Bloch Sphere. It changes the phase of the state from to and vice versa. Let’s see how:
Again, you might notice that the is the global phase for the resultant state, so we don’t really care about it. In terms of the Bloch sphere rotations, these states already lie on the -axis, so they remain unchanged as we saw above mathematically.
The key concept here lies when this gate is applied to a superposition state. Let’s take the example of the state.
The phase flip on the component resulted in a relative phase of -1. This converted the into the . We can verify this by looking at the rotation on the Bloch Sphere as well.
The Hadamard gate
You’ve been waiting a long time for this. We’ve been looking at superposition states since the start. Now the time has come when we finally see how to create a superposition state in the first place.
The Hadamard gate creates an equal superposition state when applied to the or state. Let’s see it in action. It is defined as follows:
Applying it to the states and gives us the following:
This was straightforward, now let’s look at something even more interesting. We’ll have our first look at destructive interference in play. We know that these gates are reversible, so if we apply the Hadamard again to the results above, we should get back to and .
This really becomes clear when we look at this in bra-ket notation. The matrix multiplication method was pretty simple to follow. Let’s start by applying the first Hadamard in bra-ket notation.
Now let’s apply the second Hadamard to the resultant state. It’ll simply act on individual components of the superposition state.
What you just witnessed here was the maths behind interference in quantum mechanics. The components had an opposite relative phase, and , so they canceled each other out, and only the component was left. It’s beautiful how this simple mathematical expression can explain the complex nature of the interference phenomenon.
We can also visualize the Hadamard operation on the Bloch Sphere. It is equivalent to a rotation of radian about the -axis followed by a rotation of about the -axis.