
# The Bloch Sphere

> Two real numbers describe a qubit's state — and two real numbers are the latitude and longitude of a
> point on a sphere. The **Bloch sphere** turns the algebra of $\mathbb{C}^2$ into geometry you can
> see: states are points, gates are rotations, orthogonal states are antipodes. It is the single most
> useful picture in all of single-qubit quantum computing, and we'll lean on it constantly.

## Learning Objectives

After this lesson you will be able to:

1. Derive the **Bloch-sphere parametrization** $\lvert\psi\rangle = \cos\tfrac\theta2\lvert0\rangle + e^{i\varphi}\sin\tfrac\theta2\lvert1\rangle$.
2. Compute the **Bloch vector** $\vec r = (\langle X\rangle, \langle Y\rangle, \langle Z\rangle)$ of a pure state.
3. Locate the standard states ($\lvert0\rangle,\lvert1\rangle,\lvert\pm\rangle,\lvert\pm i\rangle$) on the sphere.
4. Explain why **antipodal points are orthogonal** and why gates act as **rotations**.
5. Map states to Bloch vectors in NumPy.

---

## Intuition

In [1.1.1 E5](../c01-postulates/01-state-postulate.md) we counted a qubit's degrees of freedom: four real
numbers in $\mathbb{C}^2$, minus one for normalization, minus one for the unobservable global phase,
leaving **two**. Two angles parametrize a sphere. So the set of pure qubit states is (geometrically) the
surface of a unit ball — the Bloch sphere. The north and south poles are $\lvert0\rangle$ and
$\lvert1\rangle$; the equator holds the "equal-superposition" states whose only difference is a relative
phase. Once you internalize this, single-qubit gates stop being matrices and become *rotations of a
sphere*, which is far easier to reason about.

---

## Theory

### The parametrization

Start from a general $\lvert\psi\rangle = \alpha\lvert0\rangle + \beta\lvert1\rangle$. Write $\alpha,\beta$
in polar form and factor out the global phase of $\alpha$ (which is unobservable,
[1.1.1](../c01-postulates/01-state-postulate.md)). Normalization $|\alpha|^2+|\beta|^2 = 1$ lets us set
$|\alpha| = \cos\tfrac\theta2$, $|\beta| = \sin\tfrac\theta2$ for a unique $\theta\in[0,\pi]$. The only
surviving phase is the **relative** phase $\varphi\in[0,2\pi)$ between $\beta$ and $\alpha$. Hence

$$
\boxed{\ \lvert\psi(\theta,\varphi)\rangle = \cos\tfrac{\theta}{2}\,\lvert0\rangle + e^{i\varphi}\sin\tfrac{\theta}{2}\,\lvert1\rangle\ }
$$

The half-angle $\theta/2$ is not a typo — it's what makes the map to the sphere exact (and why a $2\pi$
rotation in $\theta$ takes you only halfway, the famous spin-$\tfrac12$ sign; see Exercises).

### The Bloch vector

Map $\lvert\psi(\theta,\varphi)\rangle$ to the point

$$
\vec r = (\sin\theta\cos\varphi,\ \sin\theta\sin\varphi,\ \cos\theta) \in S^2 .
$$

The components are exactly the **expectation values of the Pauli operators**:

$$
\vec r = \big(\langle X\rangle,\ \langle Y\rangle,\ \langle Z\rangle\big), \qquad \langle\sigma_k\rangle = \langle\psi|\sigma_k|\psi\rangle .
$$

**Derivation of the $z$-component.** $\langle Z\rangle = \langle\psi|Z|\psi\rangle = |\alpha|^2 - |\beta|^2
= \cos^2\tfrac\theta2 - \sin^2\tfrac\theta2 = \cos\theta = r_z$. ✓ Similarly (Exercise E1)
$\langle X\rangle = \sin\theta\cos\varphi$ and $\langle Y\rangle = \sin\theta\sin\varphi$. For a **pure**
state $|\vec r| = 1$ (on the surface); **mixed** states ([1.5.3](../c05-density-matrices/03-bloch-ball-purity.md))
live *inside* the ball with $|\vec r| < 1$, and $\rho = \tfrac12(I + \vec r\cdot\vec\sigma)$
([Appendix E](../../appendix/E-math-identities.md)).

### Landmarks on the sphere

```
            +z = |0>            (north pole, θ=0)
             |
   |-i> ----- + ----- |+i>      (±y on the equator)
            / | \
   |-> ---/   |   \--- |+>       (±x on the equator, φ=0 and φ=π)
             |
            -z = |1>            (south pole, θ=π)
```

| State | $(\theta,\varphi)$ | Bloch vector $\vec r$ | Axis |
|---|---|---|---|
| $\lvert0\rangle$ | $(0,\,-)$ | $(0,0,+1)$ | $+z$ |
| $\lvert1\rangle$ | $(\pi,\,-)$ | $(0,0,-1)$ | $-z$ |
| $\lvert+\rangle$ | $(\tfrac\pi2, 0)$ | $(+1,0,0)$ | $+x$ |
| $\lvert-\rangle$ | $(\tfrac\pi2, \pi)$ | $(-1,0,0)$ | $-x$ |
| $\lvert{+}i\rangle$ | $(\tfrac\pi2, \tfrac\pi2)$ | $(0,+1,0)$ | $+y$ |
| $\lvert{-}i\rangle$ | $(\tfrac\pi2, \tfrac{3\pi}2)$ | $(0,-1,0)$ | $-y$ |

### Antipodes are orthogonal; gates are rotations

Two key geometric facts:

- **Orthogonal ⟺ antipodal.** A state and its orthogonal partner sit at *opposite* points of the
  sphere ($\theta\to\pi-\theta$, $\varphi\to\varphi+\pi$). E.g. $\lvert0\rangle\perp\lvert1\rangle$ are
  the two poles; $\lvert+\rangle\perp\lvert-\rangle$ are $\pm x$. (Note: a $90°$ *physical* angle between
  measurement axes corresponds to a $180°$ angle on the Bloch sphere — the half-angle again.)
- **Unitaries are rotations.** Every single-qubit unitary acts on $\vec r$ as a rotation in $SO(3)$;
  in particular $R_n(\theta) = e^{-i\theta\,\hat n\cdot\vec\sigma/2}$ rotates the Bloch vector by angle
  $\theta$ about axis $\hat n$ ([Appendix E](../../appendix/E-math-identities.md)). So $X$ is a $180°$
  flip about $\hat x$, $Z$ about $\hat z$, the Hadamard about $(\hat x+\hat z)/\sqrt2$. This is the
  geometric heart of Term 2's gate algebra, and the picture behind Rabi precession
  ([1.6.2](../c06-dynamics/02-two-level-rabi.md)).

All of this section, live. Jump between the landmarks and check that each orthogonal pair sits at
opposite ends of a diameter; then apply gates and watch each one turn the whole sphere about a fixed
axis, drawn dashed while it turns:

```qm-demo bloch-sphere

```

---

## Worked Examples

### Example 1 — Bloch vector of $\lvert+\rangle$

$\lvert+\rangle$ has $\alpha=\beta=\tfrac1{\sqrt2}$, so $\cos\tfrac\theta2 = \tfrac1{\sqrt2}\Rightarrow\theta = \tfrac\pi2$
and relative phase $\varphi = 0$. Then $\vec r = (\sin\tfrac\pi2\cos0,\ \sin\tfrac\pi2\sin0,\ \cos\tfrac\pi2)
= (1,0,0)$ — the $+x$ axis. Directly: $\langle X\rangle = \langle+|X|+\rangle = 1$, $\langle Y\rangle = \langle Z\rangle = 0$. ✓

### Example 2 — From Bloch angles to a state vector

The point $(\theta,\varphi) = (\tfrac\pi3, \tfrac\pi2)$ corresponds to

$$
\lvert\psi\rangle = \cos\tfrac\pi6\lvert0\rangle + e^{i\pi/2}\sin\tfrac\pi6\lvert1\rangle = \tfrac{\sqrt3}{2}\lvert0\rangle + \tfrac{i}{2}\lvert1\rangle .
$$

Check $|\alpha|^2+|\beta|^2 = \tfrac34 + \tfrac14 = 1$ ✓, and $\langle Z\rangle = \tfrac34-\tfrac14 = \tfrac12 = \cos\tfrac\pi3$ ✓.

---

## Hands-on (Python)

```python
import numpy as np

X = np.array([[0, 1], [1, 0]], dtype=complex)
Y = np.array([[0, -1j], [1j, 0]], dtype=complex)
Z = np.array([[1, 0], [0, -1]], dtype=complex)

def state(theta, phi):
    return np.array([np.cos(theta/2), np.exp(1j*phi)*np.sin(theta/2)], dtype=complex)

def bloch_vector(psi):
    """(<X>,<Y>,<Z>) for a single-qubit pure state."""
    return np.array([np.real(psi.conj() @ M @ psi) for M in (X, Y, Z)])

# Landmarks:
print(np.round(bloch_vector(state(0, 0)), 3))          # |0> -> [0 0 1]  (north pole)
print(np.round(bloch_vector(state(np.pi, 0)), 3))      # |1> -> [0 0 -1] (south pole)
print(np.round(bloch_vector(state(np.pi/2, 0)), 3))    # |+> -> [1 0 0]
print(np.round(bloch_vector(state(np.pi/2, np.pi/2)),3))# |+i>-> [0 1 0]

# Pure states have |r| = 1:
r = bloch_vector(state(1.1, 2.0))
print(round(np.linalg.norm(r), 6))                     # 1.0
```

```python
# Antipodal = orthogonal. |+> at +x, |-> at -x:
plus  = state(np.pi/2, 0)
minus = state(np.pi/2, np.pi)
print(np.round(bloch_vector(plus), 3), np.round(bloch_vector(minus), 3))  # [1 0 0] [-1 0 0]
print(abs(np.vdot(plus, minus)))                       # 0.0  -> orthogonal

# A gate is a rotation: X flips the Bloch vector 180° about x (z -> -z).
psi0 = state(0, 0)                                     # |0>, r=(0,0,1)
print(np.round(bloch_vector(X @ psi0), 3))             # |1>, r=(0,0,-1)
```

> For a rendered 3-D Bloch sphere, `qutip`'s `Bloch` class is excellent (`pip install qutip`); we keep to
> the lightweight `bloch_vector` here to avoid an extra dependency, as in
> [Appendix B §7.2](../../appendix/B-python-numpy-refresher.md).

---

## Exercises

**E1 (easy).** Derive $\langle X\rangle = \sin\theta\cos\varphi$ for $\lvert\psi(\theta,\varphi)\rangle$.

<details><summary>Solution</summary>

$X\lvert\psi\rangle = \cos\tfrac\theta2\lvert1\rangle + e^{i\varphi}\sin\tfrac\theta2\lvert0\rangle$. Then
$\langle\psi|X|\psi\rangle = \cos\tfrac\theta2\,e^{i\varphi}\sin\tfrac\theta2 + e^{-i\varphi}\sin\tfrac\theta2\cos\tfrac\theta2
= 2\sin\tfrac\theta2\cos\tfrac\theta2\cos\varphi = \sin\theta\cos\varphi$, using $\tfrac{e^{i\varphi}+e^{-i\varphi}}2=\cos\varphi$
and the double-angle identity. ∎
</details>

**E2 (easy).** Where on the sphere is $\lvert{-}i\rangle = \tfrac1{\sqrt2}(\lvert0\rangle - i\lvert1\rangle)$?

<details><summary>Solution</summary>

$\theta=\tfrac\pi2$ (equal magnitudes), relative phase $-i = e^{-i\pi/2}$ so $\varphi = \tfrac{3\pi}2$ (or $-\tfrac\pi2$).
$\vec r = (\cos\tfrac{3\pi}2,\ \sin\tfrac{3\pi}2,\ 0) = (0,-1,0)$ — the $-y$ axis.
</details>

**E3 (medium).** Show that orthogonal states map to antipodal Bloch vectors ($\vec r_\perp = -\vec r$).

<details><summary>Solution</summary>

The orthogonal partner of $\lvert\psi(\theta,\varphi)\rangle$ is $\lvert\psi(\pi-\theta,\varphi+\pi)\rangle$
(check $\langle\psi_\perp|\psi\rangle=0$). Its Bloch vector: $\sin(\pi-\theta)=\sin\theta$ but
$\cos(\varphi+\pi)=-\cos\varphi$, $\sin(\varphi+\pi)=-\sin\varphi$, and $\cos(\pi-\theta)=-\cos\theta$. So
$\vec r_\perp = (-\sin\theta\cos\varphi, -\sin\theta\sin\varphi, -\cos\theta) = -\vec r$. ∎
</details>

**E4 (medium).** The gate $S = \operatorname{diag}(1,i)$ acts on $\lvert+\rangle$. Compute the new Bloch
vector and describe the geometric action.

<details><summary>Solution</summary>

$S\lvert+\rangle = \tfrac1{\sqrt2}(\lvert0\rangle + i\lvert1\rangle) = \lvert{+}i\rangle$, with $\vec r = (0,1,0)$.
So $S$ rotated the Bloch vector from $+x$ to $+y$ — a $90°$ rotation about the $z$-axis (indeed
$S = e^{i\pi/4}R_z(\tfrac\pi2)$, [Appendix E](../../appendix/E-math-identities.md)).

Start at $\lvert+\rangle$ and press $S$ once to land on $\lvert{+}i\rangle$. Press it three more times and
the state walks the equator a quarter-turn at a time, back to where it began:

```qm-demo bloch-sphere
{ "initial": "+", "gates": ["S"] }
```

</details>

**E5 (hard).** Show that $R_z(2\pi) = -I$ (not $+I$), and interpret: why does a "full rotation" return the
Bloch vector to itself but multiply the state by $-1$?

<details><summary>Solution</summary>

$R_z(\theta) = e^{-i\theta Z/2} = \operatorname{diag}(e^{-i\theta/2}, e^{i\theta/2})$; at $\theta=2\pi$ this
is $\operatorname{diag}(e^{-i\pi}, e^{i\pi}) = \operatorname{diag}(-1,-1) = -I$. The Bloch vector is built
from expectation values, which are invariant under the global phase $-1$, so it returns to itself after
$2\pi$. But the *state vector* picks up the global $-1$ and only returns to itself after $4\pi$ — the
defining signature of spin-$\tfrac12$ and the reason the parametrization uses the half-angle $\theta/2$.
(This sign is unobservable for an isolated qubit but becomes a real *relative* phase in a controlled
operation — Term 2.4.) ∎
</details>

---

## Checkpoint

1. Write the Bloch parametrization and explain the half-angle $\theta/2$.
2. What are the three components of the Bloch vector in terms of observables?
3. Give the Bloch vectors of $\lvert0\rangle,\lvert1\rangle,\lvert\pm\rangle,\lvert\pm i\rangle$.
4. How are orthogonality and antipodality related on the sphere?
5. How do single-qubit unitaries act geometrically?

<details><summary>Answers</summary>

1. $\lvert\psi\rangle = \cos\tfrac\theta2\lvert0\rangle + e^{i\varphi}\sin\tfrac\theta2\lvert1\rangle$; the
   half-angle makes the map to $S^2$ exact and reflects the $4\pi$ periodicity of spin-$\tfrac12$.
2. $\vec r = (\langle X\rangle, \langle Y\rangle, \langle Z\rangle)$.
3. $\lvert0\rangle\!:(0,0,1)$, $\lvert1\rangle\!:(0,0,-1)$, $\lvert\pm\rangle\!:(\pm1,0,0)$, $\lvert\pm i\rangle\!:(0,\pm1,0)$.
4. Orthogonal states are exactly antipodal ($\vec r_\perp = -\vec r$); a $90°$ axis angle = $180°$ on the sphere.
5. As rotations in $SO(3)$: $R_{\hat n}(\theta)$ rotates $\vec r$ by $\theta$ about axis $\hat n$.

</details>

---

## Further Reading

- **[NC]** Nielsen & Chuang, §1.2, §4.2 — the Bloch sphere and single-qubit rotations.
- **[Pre]** Preskill, *Ph219*, Ch. 2 — qubit geometry.
- **[QuTiP]** QuTiP `Bloch` class docs — for 3-D visualization.

---

← Prev: [The Qubit](01-the-qubit.md) · Up: [Term 1](../README.md) · Next: [Bases & Expectation Values](03-bases-and-expectation.md) →
