# Visualising qubits on the Bloch sphere

This post brings together visualisations and sums that I found really helpful for getting to grips with the Bloch sphere representation of qubit states.

### Recap

The state of a qubit is represented by the linear combination

$$\displaystyle \alpha |0\rangle + \beta |1\rangle$$

for complex amplitudes $$\alpha, \beta \in \mathbb{C}$$. The amplitudes satisfy $$|\alpha|^2 + |\beta|^2 = 1$$, where

$$\displaystyle |x + yi| = \sqrt{x^2 + y^2}$$,

the modulus of a complex number.

The probability of measuring (using the classical basis) a 0 is $$|\alpha|^2$$ and of measuring a 1 is $$|\beta|^2$$, by the Born rule.

Distinct states can imply the same measurement probabilities:

Example 1. The amplitudes in the following state are defined without any imaginary component:

$$\displaystyle \sqrt{\frac{1}{2}} |0\rangle + \sqrt{\frac{1}{2}} |1\rangle$$.

Apply the Born rule and the probability of both measurement outcomes is $$\frac{1}{2}$$.

Example 2. The following example has an imaginary component in both amplitudes:

$$\displaystyle \frac{1}{2}(1 + i) |0\rangle + \frac{1}{2}(1 + i) |1\rangle$$.

The modulus of both amplitudes is $$\sqrt{(\frac{1}{2})^2 + (\frac{1}{2})^2} = \sqrt{\frac{1}{2}}$$. So the probability of obtaining either a 0 or a 1 is again $$\frac{1}{2}$$.

### Bloch sphere

The state of a qubit can be represented as a point on the surface of sphere, known as the Bloch sphere. To make sense of this representation, let’s look at a couple of animations, GIFed from the QuVis visualisation project at the University of St Andrews.

Firstly, consider the following circle sliding down and up the sphere (you could think of this as travelling along the sphere’s latitudes):

The first thing to note is that the north (top) and south (bottom) pole of the sphere are where the pure $$|0\rangle$$ and $$|1\rangle$$ states live, respectively.

The location of the circle determines the probability of a particular measurement outcome. If the circle is at the north pole, then the probability of measuring a 0 is 1. If it’s at the south pole, then the probability of measuring a 1 is 1. At the equator, there’s a 50-50 chance of a 0 or a 1. All points on the circle at any given latitude represent states with the same measurement probabilities. Each latitude circle denotes what is called a magnitude.

Now let’s stop in the middle latitude. We can also rotate around the sphere (think of this as travelling along different longitudes):

These circles represent different relative phases of the state. Phases cannot be directly detected by measurement using the classical computational basis; however, there are methods to see what the phase is and phases are important in quantum algorithms.

Here’s a still of the sphere:

The angle $$\theta$$ indexes the longitudes (moving north or south) and $$\phi$$ indexes the longitudes (sweeping east or west).

The state of a qubit can be written in terms of these two parameters as follows:

$$\displaystyle \cos\frac{\theta}{2} |0\rangle + e^{i \phi} \sin\frac{\theta}{2} |1\rangle$$.

Let’s fix $$\phi = 0$$, so $$e^{i \phi} = 1$$ and the equation above simplifies to:

$$\displaystyle \cos\frac{\theta}{2} |0\rangle + \sin\frac{\theta}{2} |1\rangle$$.

The full sweep from north pole to south pole is $$180^{\circ}$$ or $$\pi$$ radians. Let’s try north pole ($$\theta = 0$$), equator ($$\theta = \frac{\pi}{2}$$), and south pole ($$\theta = \pi$$).

$$\theta$$ $$\displaystyle \alpha = \cos\frac{\theta}{2}$$ $$\displaystyle \beta = \sin\frac{\theta}{2}$$ State
$$\displaystyle 0$$ $$1$$ $$0$$ $$\displaystyle |0\rangle$$
$$\displaystyle \frac{\pi}{2}$$ $$\displaystyle \sqrt{\frac{1}{2}}$$ $$\displaystyle \sqrt{\frac{1}{2}}$$ $$\displaystyle \frac{|0\rangle + |1\rangle}{\sqrt{2}}$$
$$\displaystyle \pi$$ $$0$$ $$1$$ $$\displaystyle |1\rangle$$

Now what effect does the phase have? Fix $$\theta = \frac{\pi}{2}$$, so the measurement probabilities are constant. A $$360^{\circ}$$ turn is equal to $$2\pi$$ radians. We shall try $$\phi = 0, \frac{\pi}{2}, \pi, \frac{3\pi}{2}$$. This time I’m using Grokking the Bloch Sphere to visualise.

Bloch sphere $$\phi$$ $$\displaystyle \alpha = \cos\frac{\theta}{2}$$ $$\displaystyle \beta = e^{i \phi} \sin\frac{\theta}{2}$$
$$\displaystyle 0$$ $$\displaystyle \frac{1}{\sqrt{2}}$$ $$\displaystyle \frac{1}{\sqrt{2}}$$
$$\displaystyle \frac{\pi}{2}$$ $$\displaystyle \frac{1}{\sqrt{2}}$$ $$\displaystyle \frac{i}{\sqrt{2}}$$
$$\displaystyle \pi$$ $$\displaystyle \frac{1}{\sqrt{2}}$$ $$\displaystyle -\frac{1}{\sqrt{2}}$$
$$\displaystyle \frac{3\pi}{2}$$ $$\displaystyle \frac{1}{\sqrt{2}}$$ $$\displaystyle –\frac{i}{\sqrt{2}}$$

Note how the $$\beta$$ amplitudes come in pairs, one positive, one negative. The sign flips when spinning half a circle.