|q⟩ Bad Qubits

beginner · Programming · The Bloch Sphere

Checkpoint: Navigate the Bloch Sphere

Throughout this module you learned that every single-qubit gate corresponds to a rotation of the Bloch sphere. Preparing a specific target state is therefore a navigation problem: you must choose a sequence of rotations that carries the starting point 0|0\rangle (the north pole) to the intended destination.

The target state

The target for this checkpoint is

ψtarget=12(0+eiπ/41).|\psi_{\text{target}}\rangle = \frac{1}{\sqrt{2}}\bigl(|0\rangle + e^{i\pi/4}|1\rangle\bigr).

In Bloch sphere coordinates this state sits at polar angle θ=π/2\theta = \pi/2 (on the equator) and azimuthal angle ϕ=π/4\phi = \pi/4. That places it exactly 45° east of the +x+x axis state +|+\rangle and 45° west of the +y+y axis state +i|{+i}\rangle.

Planning the route

The north pole 0|0\rangle has θ=0\theta = 0, far from the equator. To reach θ=π/2\theta = \pi/2 you need a gate that moves the Bloch vector off the zz-axis. The Hadamard HH does exactly that: it is a 180° rotation about the (x+z)/2(x{+}z)/\sqrt{2} axis, sending the north pole straight to the +x+x equatorial point +|+\rangle (ϕ=0\phi = 0).

After landing on the equator you still need to advance the azimuthal angle from 00 to π/4\pi/4. The phase gates ZZ, SS, and TT are all z-rotations and act purely on ϕ\phi. The TT gate rotates by π/4\pi/4 (one eighth-turn), which is precisely the remaining distance:

T=(100eiπ/4),T+=12(0+eiπ/41)=ψtarget.T = \begin{pmatrix} 1 & 0 \\ 0 & e^{i\pi/4} \end{pmatrix}, \qquad T|{+}\rangle = \frac{1}{\sqrt{2}}\bigl(|0\rangle + e^{i\pi/4}|1\rangle\bigr) = |\psi_{\text{target}}\rangle.

The two-gate sequence THT \cdot H applied to 0|0\rangle therefore hits the target exactly.

Confirming the route

You can verify the claim step by step. Starting from 0=(10)|0\rangle = \binom{1}{0}:

H0=12(11),H|0\rangle = \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix},

then

T12(11)=12(11eiπ/41)=12(1eiπ/4).T \cdot \frac{1}{\sqrt{2}}\begin{pmatrix}1\\1\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \cdot 1 \\ e^{i\pi/4} \cdot 1\end{pmatrix} = \frac{1}{\sqrt{2}}\begin{pmatrix}1 \\ e^{i\pi/4}\end{pmatrix}.

The resulting amplitude vector has α2=β2=12|\alpha|^2 = |\beta|^2 = \tfrac{1}{2}, confirming that measurement probabilities remain equal. The relative phase eiπ/4e^{i\pi/4} encodes the azimuthal position on the equator.

Try it

Navigate from 0|0\rangle to the target state 12(0+eiπ/41)\frac{1}{\sqrt{2}}\bigl(|0\rangle + e^{i\pi/4}|1\rangle\bigr). The grader checks the full statevector (up to global phase), so leaving the circuit empty will not pass — you must reach the correct point on the sphere.

Run your code to see the quantum state.

After running your circuit, check that the 0|0\rangle amplitude is 0.707\approx 0.707 (real) and the 1|1\rangle amplitude is 0.707eiπ/4=0.5+0.5i\approx 0.707\,e^{i\pi/4} = 0.5 + 0.5i (complex). That is the exact signature of the target Bloch vector.

Sign in on the full site to ask questions and join the discussion.