|q⟩ Bad Qubits

beginner · Programming · The Bloch Sphere

Reading the Bloch Display

After learning what the Bloch sphere represents mathematically, the next step is reading it as a live display while you run circuits. The simulator renders the Bloch sphere in real time and reports three numbers: the x, y, z components of the Bloch vector. Knowing how to decode those numbers back into the qubit state is the skill this lesson develops.

The Bloch vector and what it shows

Every single-qubit pure state ψ=cos ⁣θ20+eiϕsin ⁣θ21|\psi\rangle = \cos\!\tfrac{\theta}{2}|0\rangle + e^{i\phi}\sin\!\tfrac{\theta}{2}|1\rangle maps to a point on the unit sphere with Cartesian coordinates

x=sinθcosϕ,y=sinθsinϕ,z=cosθ.x = \sin\theta\cos\phi, \qquad y = \sin\theta\sin\phi, \qquad z = \cos\theta.

These three numbers are what the Bloch display shows. You can read the state back from them:

Reading specific states

Checking your Bloch display after a circuit is a quick sanity test:

| State | x | y | z | |---|---|---|---| | 0|0\rangle | 00 | 00 | +1+1 | | 1|1\rangle | 00 | 00 | 1-1 | | +=H0|{+}\rangle = H|0\rangle | +1+1 | 00 | 00 | | =H1|{-}\rangle = H|1\rangle | 1-1 | 00 | 00 | | +i=SH0|{+i}\rangle = SH|0\rangle | 00 | +1+1 | 00 | | TH0=12(0+eiπ/41)TH|0\rangle = \tfrac{1}{\sqrt{2}}\bigl(|0\rangle+e^{i\pi/4}|1\rangle\bigr) | 12\tfrac{1}{\sqrt{2}} | 12\tfrac{1}{\sqrt{2}} | 00 |

The last row shows a state halfway between the +x+x and +y+y axes. Its Bloch vector is exactly n^=(12,12,0)\hat{n} = (\frac{1}{\sqrt{2}}, \frac{1}{\sqrt{2}}, 0), with x=y0.707x = y \approx 0.707 and z=0z = 0. You can derive this from θ=π/2\theta = \pi/2, ϕ=π/4\phi = \pi/4:

x=sin ⁣π2cos ⁣π4=112=12,y=sin ⁣π2sin ⁣π4=112=12.x = \sin\!\tfrac{\pi}{2}\cos\!\tfrac{\pi}{4} = 1 \cdot \tfrac{1}{\sqrt{2}} = \tfrac{1}{\sqrt{2}}, \qquad y = \sin\!\tfrac{\pi}{2}\sin\!\tfrac{\pi}{4} = 1 \cdot \tfrac{1}{\sqrt{2}} = \tfrac{1}{\sqrt{2}}.

Try it

Prepare the state 12(0+eiπ/41)\tfrac{1}{\sqrt{2}}\bigl(|0\rangle + e^{i\pi/4}|1\rangle\bigr) — the equator point midway between the +x+x and +y+y axes. After running, your Bloch display should show x0.707x \approx 0.707, y0.707y \approx 0.707, z=0z = 0.

Run your code to see the quantum state.

Inspect all three Bloch components. If the display shows x=y0.707x = y \approx 0.707 and z=0z = 0, you have correctly placed the Bloch vector at azimuthal angle ϕ=π/4\phi = \pi/4 on the equator — and you know how to read the display.

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