🏠 Home 📘 Track 1: Quantum Basics L18 — What Is a Quantum Circuit? L19 — What Is a Gate? L20 — The Hadamard Gate
L19 §4 · Build Something Real ~18 min

What Is a Gate? Operations on Qubits

In L18 you learned that boxes on circuit wires are called gates. Now you find out what a gate actually is. Not just "an operation" — something far more precise and beautiful: a rotation. Every single quantum gate, no matter how complex, is a rotation on the Bloch sphere. Press X and watch it happen.

✦ One Idea A quantum gate is a rotation on the Bloch sphere — a reversible transformation that moves the qubit's state vector from one point on the sphere to another. The X gate rotates 180° around the X-axis, flipping |0⟩ to |1⟩ and back. Every gate, without exception, follows this geometry.
quantum gate rotation Bloch sphere X gate (NOT) Y gate Z gate Hadamard reversibility unitary
Section 01
① Hook

The Box in the Circuit

🔲
Think carefully — this is not obvious
Classical computers also have logic gates. But quantum gates are fundamentally different.

A classical NOT gate takes a 0 and outputs a 1, or takes a 1 and outputs a 0. A quantum X gate acts on a qubit. What is the key difference between them?

In L18 you met the circuit diagram — the universal language of quantum computing. You learned that horizontal wires carry qubits and that labelled boxes drawn on those wires are operations called gates.

But we left the most important question unanswered: what is a gate, actually? What is physically happening inside that box when a qubit passes through it?

The answer is elegant and surprising. A quantum gate is not computation in the classical sense — a lookup table that maps inputs to outputs. It is something the classical world has no equivalent for: a rotation in a geometric space. The qubit's state is a point on a sphere. The gate is a rotation of that sphere. The output is where the arrow ends up.

📐
Why this matters for everything that follows
Every quantum gate you will encounter in Section 4 and beyond — Hadamard, CNOT, T gate, S gate, Toffoli — is a rotation on the Bloch sphere. Once you understand the geometry, you understand all of them. The names and symbols are just labels for specific rotations. This is the most unifying insight in elementary quantum computing.
Section 02
② Intuition

A Gate Is a Rotation

You met the Bloch sphere in L08. Let's use it precisely now, because it is the key to understanding every gate.

🌐 The Globe Analogy
Imagine the Earth as a Bloch sphere. The North Pole is the qubit state $|0\rangle$. The South Pole is $|1\rangle$. Every other point on the surface is a superposition — the closer to the north pole, the more $|0\rangle$-like; closer to the south, the more $|1\rangle$-like. Points on the equator are exactly half-half.

A quantum gate is a rotation of this globe. The X gate rotates the globe 180° around the equatorial X-axis — the north pole ends up at the south pole and vice versa. That is the X gate: it takes $|0\rangle$ to $|1\rangle$ and $|1\rangle$ to $|0\rangle$, exactly like a classical NOT — but it does it geometrically, which means it also works on any point on the sphere, including superpositions.

Apply X to the equator? The equator rotates onto itself — superpositions pick up a phase shift but stay equatorial. Apply X twice? Two 180° rotations = 360° = back where you started. That is why X is its own inverse: $X^2 = I$.

This geometric picture is not just an analogy — it is the exact mathematical truth. Quantum states are unit vectors in a two-dimensional complex Hilbert space, and quantum gates are unitary matrices — the mathematical objects that correspond to rotations in that space. The Bloch sphere is a faithful geometric picture of this algebra.

Key Insight
Every quantum gate is reversible because every rotation has an inverse rotation. Rotate 180° clockwise → rotate 180° anticlockwise to undo it. Rotate 90° → rotate 90° in the opposite direction. This is why quantum gates must be reversible: they are rotations, and rotations are always invertible. Measurement is not a rotation — it is a collapse — which is why it alone is irreversible.

This also explains something subtle: quantum gates do not "read" the qubit's state. They do not need to know whether the qubit is $|0\rangle$, $|1\rangle$, or a superposition. They just apply a rotation to whatever state is there. The qubit's internal superposition is preserved — it just gets rotated to a new position on the Bloch sphere.

Section 03
③ Framework

The X Gate — A Complete Deep Dive

The X gate is the simplest and most intuitive quantum gate. Start here and every other gate becomes easier to understand. It is the quantum NOT — but "quantum NOT" does not capture the full picture.

What X does to every possible state
$|0\rangle$
$|1\rangle$
North pole → South pole
$|1\rangle$
$|0\rangle$
South pole → North pole
$|{+}\rangle$
$|{+}\rangle$
Equator fixed point — $|{+}\rangle$ is an eigenstate of X
$|{-}\rangle$
$-|{-}\rangle$
Gets a phase of −1 (invisible to measurement)
$\alpha|0\rangle + \beta|1\rangle$
$\beta|0\rangle + \alpha|1\rangle$
Amplitudes swap — superposition preserved

The last row is the crucial one. A classical NOT gate takes 0 to 1 and 1 to 0 — that is all it can do, because classical bits have only two states. The quantum X gate takes any superposition $\alpha|0\rangle + \beta|1\rangle$ and swaps the amplitudes to $\beta|0\rangle + \alpha|1\rangle$. The superposition is preserved — only the amplitudes exchange. This is the amplitude-swapping property that makes it a genuine quantum operation.

The matrix representation — where the numbers live

In the Track 1 spirit we will not derive this from scratch (that is Track 2 content), but you should know that the X gate has a precise mathematical representation as a $2 \times 2$ matrix:

$$X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}$$

This matrix acts on the qubit's state vector $\begin{pmatrix}\alpha \\ \beta\end{pmatrix}$ by matrix multiplication, producing $\begin{pmatrix}\beta \\ \alpha\end{pmatrix}$ — exactly the amplitude swap we described above. The matrix is its own inverse ($X^2 = I$, the identity matrix), which proves that applying X twice returns the original state.

Why X² = I proves reversibility
$X^2 = I$ means: apply X, then apply X again, and you are back where you started — for any qubit state. This is the mathematical statement of reversibility. Every quantum gate $U$ satisfies $U U^\dagger = I$ (where $U^\dagger$ is the conjugate transpose). For X, $X = X^\dagger = X^{-1}$, so X is its own inverse. For Hadamard: $H^2 = I$ too. This self-inverse property means these gates "undo themselves" — a property with no classical counterpart for anything other than NOT.
Section 04
④ Theory

The Four Essential Single-Qubit Gates

These four gates are the vocabulary of quantum computing. Every quantum algorithm uses them — often in combination. Each is a rotation on the Bloch sphere around a specific axis by a specific angle.

X
Pauli-X — The NOT Gate
180° rotation around the X-axis
Flips $|0\rangle \leftrightarrow |1\rangle$. Swaps amplitudes of any superposition. The quantum equivalent of a classical NOT. Applied to $|{+}\rangle$, it is a fixed point (eigenvector). Applied to $|{-}\rangle$, adds a phase of −1. Used to initialise qubits to $|1\rangle$ from $|0\rangle$, and in error correction as a bit-flip correction.
$X = \begin{pmatrix}0&1\\1&0\end{pmatrix}$ · $X^2=I$
Y
Pauli-Y
180° rotation around the Y-axis
Flips $|0\rangle \leftrightarrow |1\rangle$ AND adds an imaginary phase: $|0\rangle \to i|1\rangle$, $|1\rangle \to -i|0\rangle$. Less intuitive than X, but equally important. Combines a bit flip and a phase flip simultaneously. The Y rotation on the Bloch sphere takes north to south through the Y-axis of the equatorial plane, not the X-axis.
$Y = \begin{pmatrix}0&-i\\i&0\end{pmatrix}$ · $Y^2=I$
Z
Pauli-Z — The Phase Flip
180° rotation around the Z-axis
Leaves $|0\rangle$ unchanged. Flips the sign of $|1\rangle$: $|0\rangle \to |0\rangle$, $|1\rangle \to -|1\rangle$. The probabilities are unchanged — only the phase changes. This phase change is invisible to measurement, but it affects interference. Z is how algorithms mark states without disturbing them observably — the basis of phase kickback.
$Z = \begin{pmatrix}1&0\\0&-1\end{pmatrix}$ · $Z^2=I$
H
Hadamard — The Superposition Gate
180° rotation around the X+Z diagonal axis
Puts a qubit into perfect superposition: $|0\rangle \to \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle)$, $|1\rangle \to \frac{1}{\sqrt{2}}(|0\rangle-|1\rangle)$. Moves the north pole to the equator (+X point). It is its own inverse ($H^2=I$) — a second H undoes the first. The most used gate in quantum computing — every algorithm opens with it. Deep study in L20.
$H = \frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\1&-1\end{pmatrix}$ · $H^2=I$

Notice the pattern: all four gates are 180° rotations (around different axes), and all four are their own inverse ($G^2 = I$). This is not a coincidence — it is the mathematical signature of a half-turn rotation. More general gates rotate by other angles (90°, 45°, arbitrary angles for universal quantum computing), but these four are the clearest introduction to the rotational nature of quantum gates.

⚠️
The Z gate's effect is invisible to measurement — but real
The Z gate adds a phase of −1 to $|1\rangle$. Since $P(1) = |{-\beta}|^2 = |{\beta}|^2$, this is undetectable by any direct measurement. Students often ask: "if Z changes nothing measurable, why does it matter?" The answer: phase changes affect interference. After a Z gate, the qubit will interfere differently with other qubits in subsequent operations. Phase is the currency of quantum algorithms — invisible to measurement but decisive for computation.
Section 05
⑤ Interactive

Live Bloch Sphere — Watch Gates Rotate

Press any gate button and watch the state arrow animate along a traced rotation path on the 3D Bloch sphere. The coloured arc shows the exact geodesic (shortest great-circle path) the gate takes. Start from $|0\rangle$ (north pole) and press X — the arrow sweeps south to $|1\rangle$ along a glowing rose arc. Press X again to return. Try H, Z, Y. Drag the sphere to orbit the camera and see the rotation paths from any angle. Chain gates to explore the geometry.

🌐 Live Bloch Sphere Simulator
Press a gate · watch the rotation path trace · drag sphere to orbit
INTERACTIVE
Current State
|0⟩
θ = 0°, φ = 0°
Start: |0⟩ — north pole. Press a gate to apply it.
Quick Check
Lesson Summary

What You Now Know About Quantum Gates

  • 🌐
    A quantum gate is a rotation on the Bloch sphere
    The qubit's state is a point on a unit sphere. A gate rotates that point to a new position. The X gate rotates 180° around the X-axis (north ↔ south). Every quantum gate, without exception, is a rotation in this sense — a unitary transformation that moves the state vector while preserving the total probability.
  • 🔄
    Every gate is reversible — because every rotation has an inverse
    Rotations are always invertible. Rotate 180° clockwise, then 180° anticlockwise — you're back to the start. This is why quantum gates satisfy $U U^\dagger = I$. The four Pauli gates and Hadamard are all self-inverse ($G^2 = I$). Measurement is irreversible because it is not a rotation — it is a collapse, a thermodynamic event.
  • 🔀
    The X gate swaps amplitudes — not just 0 and 1
    On classical bits: $0 \to 1$, $1 \to 0$. On quantum states: $\alpha|0\rangle + \beta|1\rangle \to \beta|0\rangle + \alpha|1\rangle$. The amplitudes swap, the superposition is preserved. On the Bloch sphere, every point moves to its antipodal point (the mirror-opposite position). $X^2 = I$: two X gates cancel exactly.
  • 🌀
    The Z gate changes phase invisibly — but decisively
    Z leaves $|0\rangle$ alone and negates $|1\rangle$. Probabilities are unchanged ($|-\beta|^2 = |\beta|^2$). But the phase change affects how the qubit interferes with others. Phase is the currency of quantum algorithms — invisible to any single measurement, but the engine that drives constructive and destructive interference in every quantum speedup.
  • 〰️
    The Hadamard gate creates superposition — and undoes it
    H rotates the north pole to the equator: $|0\rangle \to \frac{1}{\sqrt{2}}(|0\rangle+|1\rangle) = |{+}\rangle$. Applied again: $|{+}\rangle \to |0\rangle$. $H^2 = I$. H is the gate that opens every quantum algorithm's search space — the most used gate in quantum computing. Full treatment in L20.
Quick Check
How clearly does the "gate = rotation" picture click?

You understand what a gate is.
Now meet the gate that starts every quantum algorithm —
the one that puts a qubit into superposition
and opens the door to all $2^n$ possibilities at once.

→ The Hadamard Gate — L20
Sources & Further Reading
← Previous
What Is a Quantum Circuit?
L18 — Wires, gates, and the circuit diagram