Quantum Gates
Rotations
State Preparation
Noise
State Vector
Purity
Maximally mixed: Tr(ρ²) = 0.5
Build quantum circuits with up to 3 qubits—apply gates and watch states evolve on Bloch spheres
The Bloch sphere is the most important visualization in quantum computing. Every possible state of a single qubit can be represented as a point on or inside this sphere. Pure states live on the surface; mixed states (statistical mixtures or subsystems of entangled pairs) live in the interior. Understanding this geometry is the key to understanding quantum gates, measurements, and decoherence.
The blue arrow (Bloch vector) points from the origin to the current quantum state. The north pole is |0⟩, the south pole is |1⟩. The equator contains all equal superpositions like |+⟩ = (|0⟩+|1⟩)/√2 and |−⟩ = (|0⟩−|1⟩)/√2, differing only in relative phase. Any pure qubit state can be written as |ψ⟩ = cos(θ/2)|0⟩ + eiφsin(θ/2)|1⟩, where θ is the polar angle and φ is the azimuthal angle on the Bloch sphere.
Every unitary quantum gate rotates the Bloch vector. The X gate flips the qubit (rotation by π around the x-axis). The Z gate adds a phase (rotation around z-axis). The Hadamard gate H is a 180° rotation around the axis halfway between x and z—it takes |0⟩ to |+⟩ and |1⟩ to |−⟩. General rotations Rx(θ), Ry(θ), Rz(θ) rotate by angle θ around the respective axes. Any single-qubit gate is a rotation!
When you enable depolarizing noise, the Bloch vector shrinks toward the origin. This represents decoherence: the qubit becomes a statistical mixture rather than a pure superposition. The purity Tr(ρ²) drops below 1. At the center (Tr(ρ²)=0.5), the state is maximally mixed—complete classical ignorance. Noise doesn't rotate the state; it contracts it. Real quantum computers fight this battle constantly.
The Pauli matrices are the fundamental building blocks. X flips |0⟩↔|1⟩ (like a classical NOT). Z flips the phase: |+⟩↔|−⟩. Y is a bit flip plus a phase flip (Y = iXZ). They're Hermitian, so they square to the identity: X² = Y² = Z² = I. On the Bloch sphere, each is a 180° rotation around its axis.
The Hadamard is the superposition gate. It creates equal amplitude for |0⟩ and |1⟩: H|0⟩ = |+⟩ = (|0⟩+|1⟩)/√2. It's the gateway to quantum parallelism and interference. On the Bloch sphere, H is a 180° rotation around the diagonal x+z axis. Apply it twice and you return to the starting state: H² = I.
S and T add relative phases without changing amplitudes. S is a 90° z-rotation; T is 45°. They commute with Z but not with X or Y. Combined with Hadamards and Paulis, they form the Clifford+T gate set, which is universal for quantum computing (can approximate any unitary to arbitrary precision). T is especially important—it's the non-Clifford gate that gives quantum computers their power beyond classical simulation.
X and Z Don't Commute: Start at |0⟩. Apply X, then Z. You get −|1⟩. Now reset and apply Z, then X. You get |1⟩. The sign flipped! XZ ≠ ZX. Non-commutativity is a hallmark of quantum mechanics. On the Bloch sphere, rotations around different axes don't commute—order matters.
Build |+⟩ from |0⟩: Start at |0⟩ (north pole). Apply H. You're now at |+⟩ (on the equator at x-axis). This is the superposition state. Measure it in the computational basis and you get 0 or 1 with equal probability. Measure it in the ± basis and you always get +.
Y is Weird: Apply Y to |0⟩. You get i|1⟩—notice the imaginary unit. This global phase is invisible in measurements, but relative phases matter. The Bloch vector rotates by 180° around the y-axis. Y is like X but with an extra quarter turn of phase.
Rotation Composition: Apply Rx(π/4), then Ry(π/4). Watch the Bloch vector trace a path. The final state is not the same as Ry(π/4) then Rx(π/4)— matrix multiplication isn't commutative. This is how you sculpt arbitrary quantum states from rotations.
Decoherence Destroys Superposition: Prepare |+⟩. Enable depolarizing noise and apply a gate repeatedly (like H repeatedly, which does nothing for a pure state). Watch the Bloch vector shrink. The state becomes mixed—a probabilistic combination of |0⟩ and |1⟩, not a coherent superposition. Purity drops toward 0.5.
The Equator States: Use Rz rotations starting from |+⟩ to tour the equator. Each point has |⟨0|ψ⟩|² = |⟨1|ψ⟩|² = 0.5 but different relative phases. These states are all equivalent under computational-basis measurement but distinguish themselves in interference experiments.
Return to Start: Apply a sequence: X, Y, Z, X, Y, Z. You don't return to the start! But try X, X (or Y, Y, or Z, Z). You do return. Pauli gates are their own inverses. Design a sequence that returns to |0⟩ after several gates—this is the essence of quantum algorithms.
Build T from S: Apply S twice. You've applied Z (a full 180°). Apply T eight times. You've also completed a full rotation. S² = Z and T⁴ = Z. These phase relations are crucial for implementing fault-tolerant quantum gates.
The Bloch sphere is not just a pretty picture—it's the geometry of quantum information. Here's why it's profound:
Every quantum algorithm—Grover's search, Shor's factoring, quantum teleportation—boils down to choreographing rotations on many Bloch spheres (qubits) with entanglement linking them. Understanding this single-qubit picture is the first step to understanding the quantum world.