Lesson 3 of 15
Bloch Sphere Coordinates
The Bloch Sphere
Every pure single-qubit state can be represented as a point on the surface of the Bloch sphere — a unit sphere in 3D space.
Parametrization
Any normalized qubit state can be written as:
where:
- is the polar angle (latitude from the north pole)
- is the azimuthal angle (longitude)
Key Points on the Bloch Sphere
| State | Location | ||
|---|---|---|---|
| $ | 0\rangle$ | any | |
| $ | 1\rangle$ | any | |
| $ | +\rangle = \frac{ | 0\rangle+ | 1\rangle}{\sqrt{2}}$ |
| $ | -\rangle = \frac{ | 0\rangle- | 1\rangle}{\sqrt{2}}$ |
| $ | L\rangle = \frac{ | 0\rangle+i | 1\rangle}{\sqrt{2}}$ |
| $ | R\rangle = \frac{ | 0\rangle-i | 1\rangle}{\sqrt{2}}$ |
Extracting Angles from a State
Given a normalized state :
When (i.e., the state is near ), has no well-defined argument, so we set by convention.
Implementation
import cmath, math
def bloch_angles(state):
alpha = complex(state[0])
beta = complex(state[1])
theta = 2 * math.acos(min(abs(alpha), 1.0))
if abs(alpha) < 1e-10:
phi = 0.0
else:
phi = (cmath.phase(beta) - cmath.phase(alpha)) % (2 * math.pi)
return (theta, phi)
Why the Bloch Sphere Matters
- Gate actions become geometric rotations: X is a -rotation around the X axis, H is a -rotation around the axis.
- Decoherence contracts the Bloch sphere inward — mixed states live inside the sphere.
- Visualization makes it easy to reason about the effect of gate sequences.
Your Task
Implement bloch_angles(state) that returns (theta, phi) for a normalized qubit state.
Python runtime loading...
Loading...
Click "Run" to execute your code.