Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Level 5 · Quantum information · Prerequisite lessons: L5-01 (States and the Born rule), L5-02 (Gates and circuit order), L5-05 (Density operators and reduced states).

What you’ll learn:

  • How two angles (θ,φ)(\theta,\varphi) describe every pure qubit state, and how that state becomes a point on a sphere.

  • How the Born rule turns the Bloch vector into measurement probabilities.

  • Why a finite number of shots only estimates a probability, and how the error shrinks with more shots.

  • Why mixed states live inside the sphere, and how purity measures the distance from the surface.

Everything here is a classical simulation of textbook equations Basics of quantum information, n.d.Preskill, n.d.. No quantum hardware is used.

Open in Colab

1 · From two angles to a point

You can always write a pure qubit state (up to an unobservable global phase) as

∣ψ(θ,φ)⟩=cos⁡θ2 ∣0⟩+eiφsin⁡θ2 ∣1⟩,0≤θ≤π,  0≤φ<2π.|\psi(\theta,\varphi)\rangle = \cos\tfrac{\theta}{2}\,|0\rangle + e^{i\varphi}\sin\tfrac{\theta}{2}\,|1\rangle , \qquad 0\le\theta\le\pi,\; 0\le\varphi<2\pi .

Its Bloch vector is r⃗=(⟨X⟩,⟨Y⟩,⟨Z⟩)=(sin⁡θcos⁡φ, sin⁡θsin⁡φ, cos⁡θ)\vec r = (\langle X\rangle,\langle Y\rangle,\langle Z\rangle) = (\sin\theta\cos\varphi,\ \sin\theta\sin\varphi,\ \cos\theta).

theta = pi/2: p0 = 0.5000, Bloch vector = (0.765, 0.644, 0.000)

Explain. At θ=π/2\theta=\pi/2 the state lies on the equator (z=0z=0), so p0=cos⁡2(π/4)=1/2p_0=\cos^2(\pi/4)=1/2 whatever φ\varphi is. A ZZ measurement cannot see the phase φ\varphi. It shows up only in XX or YY measurements. The three routes agree to machine precision, and every pure state has ∣r⃗∣=1|\vec r|=1.

2 · An interactive Bloch sphere

Drag the θ slider to tilt the state away from ∣0⟩|0\rangle (north pole) towards ∣1⟩|1\rangle (south pole). Drag the φ slider to rotate it around the zz axis. Rotate the sphere with the mouse. The label at the tip shows p0p_0.

The figure is precomputed, so both controls work without a running Python kernel. The θ slider rewrites the arrow for every φ value, and the φ slider chooses which arrow is visible.

Loading...

3 · Measurement statistics and finite shots

The Born rule gives p0(θ)=cos⁡2(θ/2)=12(1+z)p_0(\theta)=\cos^2(\theta/2)=\tfrac{1}{2}(1+z). A real experiment never sees p0p_0 directly. It sees NN outcomes and reports the frequency p^0=n0/N\hat p_0 = n_0/N. Because n0n_0 is binomial, the standard error is p0(1−p0)/N\sqrt{p_0(1-p_0)/N}.

Use the slider to change NN. The band is the exact ±2\pm 2 standard-error band. The dots are simulated frequencies. They are seeded, so they are the same on every run.

N =    10: RMS error = 0.1304,  RMS * sqrt(N) = 0.412
N =   100: RMS error = 0.0415,  RMS * sqrt(N) = 0.415
N =  1000: RMS error = 0.0100,  RMS * sqrt(N) = 0.318
N = 10000: RMS error = 0.0032,  RMS * sqrt(N) = 0.322
RMS(N=100) / RMS(N=10000) = 12.89   (1/sqrt(N) scaling predicts 10)
exact sqrt(mean p0(1-p0)) = 0.349
Loading...

Explain. The typical error scales as 1/N1/\sqrt N. So 100 times more shots shrinks it by about a factor of 10. The code asserts two things. The measured ratio lies between 5 and 20. And RMS⋅N\text{RMS}\cdot\sqrt N matches the exact value p0(1−p0)‾\sqrt{\overline{p_0(1-p_0)}} within sampling noise. The band is narrowest at the poles, where p0(1−p0)=0p_0(1-p_0)=0. A state that is certain to give 0 never fluctuates.

4 · Mixed states live inside the ball

A mixed state is a probabilistic mixture of pure states, ρ=∑kwk∣ψk⟩⟨ψk∣\rho=\sum_k w_k|\psi_k\rangle\langle\psi_k|. Every single-qubit density matrix can be written

ρ=12(I+rxX+ryY+rzZ),∣r⃗∣≤1,\rho = \tfrac{1}{2}\left(I + r_x X + r_y Y + r_z Z\right),\qquad |\vec r|\le 1,

with eigenvalues (1±∣r⃗∣)/2(1\pm|\vec r|)/2 and purity Tr⁡ρ2=(1+∣r⃗∣2)/2\operatorname{Tr}\rho^2 = (1+|\vec r|^2)/2. The centre r⃗=0\vec r=0 is the maximally mixed state I/2I/2.

equal mixture of |0> and |1>: Bloch vector [0. 0. 0.]  purity 0.5
400 random mixtures checked; min radius 0.159, max radius 1.000

Explain. The equal mixture of ∣0⟩|0\rangle and ∣1⟩|1\rangle sits at the centre, r⃗=0\vec r=0. Its purity is 1/21/2, the minimum for a qubit. Mixing pulls the Bloch vector inside the sphere. Mixing is also linear: the mixture λρ1+(1−λ)ρ2\lambda\rho_1+(1-\lambda)\rho_2 has Bloch vector λr⃗1+(1−λ)r⃗2\lambda\vec r_1+(1-\lambda)\vec r_2, a point on the chord. A static view of these facts:

<Figure size 1000x400 with 2 Axes>

The 3D view below shows the same random mixtures, coloured by purity. Rotate it and hover over the points. No point leaves the unit ball.

Loading...

Going deeper

Take a measurement along a unit vector n^\hat n (observable n^⋅σ⃗\hat n\cdot\vec\sigma). The Born rule in Bloch form is

P(+1∣n^)=Tr⁡ ⁣[ρ 12(I+n^⋅σ⃗)]=12(1+r⃗⋅n^).P(+1\mid\hat n) = \operatorname{Tr}\!\left[\rho\,\tfrac{1}{2}(I+\hat n\cdot\vec\sigma)\right] = \tfrac{1}{2}\left(1+\vec r\cdot\hat n\right).

So the outcome probability depends only on the projection of the Bloch vector on the measurement axis. Orthogonal states, such as ∣0⟩|0\rangle and ∣1⟩|1\rangle, sit at antipodal points on the sphere. They are not perpendicular. The next cell checks the formula for random states and random axes.

Born rule in Bloch form verified for 200 random states and axes.

Exercises

Solution

cos⁡2(θ/2)=3/4\cos^2(\theta/2)=3/4 gives cos⁡(θ/2)=3/2\cos(\theta/2)=\sqrt3/2, so θ=π/3\theta=\pi/3 (60°). Equivalently z=cos⁡θ=2p0−1=1/2z=\cos\theta = 2p_0-1 = 1/2. The check cell below verifies it.

Solution

∣r⃗∣=0.6|\vec r|=0.6. Purity =(1+0.36)/2=0.68=(1+0.36)/2=0.68. Eigenvalues (1±0.6)/2(1\pm0.6)/2, that is 0.8 and 0.2. It is mixed, because ∣r⃗∣<1|\vec r|<1.

Solution

The standard error is p0(1−p0)/N=0.5/N\sqrt{p_0(1-p_0)/N}=0.5/\sqrt N. Setting 0.5/N≤0.010.5/\sqrt N\le 0.01 gives N≥2500N\ge 2500.

Check yourself

All checks passed.

Limits of this model

  • This lab covers one qubit only. The Bloch ball is special to a single qubit. Two qubits need 15 real parameters, and the set of two-qubit states is not a ball.

  • We assumed ideal measurements: perfect projective measurements with no readout error. Real devices also mislabel outcomes.

  • The randomness is simulated. The shots come from a seeded pseudo-random generator. It mimics the statistics of quantum measurement, but it is not quantum randomness.

  • The picture ignores the global phase, which no measurement can detect. The relative phase φ\varphi is physical.

References
  1. Basics of quantum information. (n.d.). https://quantum.cloud.ibm.com/learning/en/courses/basics-of-quantum-information
  2. Preskill, J. (n.d.). Course Information for Physics 219/Computer Science 219 Quantum Computation (Formerly Physics 229). California Institute of Technology course page with lecture notes. https://www.preskill.caltech.edu/ph219/