JOVANA
Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
All guides

Quantum Gates: Reversible Moves on a Qubit

A classical NOT gate flips a bit; a quantum gate rotates a qubit. Meet single-qubit gates — H, X, Y, Z — and see why every one of them is reversible.

Reversible operations

Classical computers throw information away all the time. An AND gate takes two bits in and gives one bit out — once you see the output 0, you cannot tell which of three inputs produced it. That lost information leaves as heat. Quantum gates are different: every quantum gate is reversible. Whatever it does, there is always another gate that undoes it exactly, putting the qubit back the way it started.

Reversibility is not a design choice — it is forced by physics. Between measurements, a qubit evolves by rules that never lose track of where it has been, so a gate can only rearrange the quantum state, never erase part of it. The one moment information genuinely collapses is measurement, which is a separate, non-reversible step that we do only at the very end.

Single-qubit gates

The simplest gates act on one qubit at a time. A single qubit's state is fully described by two numbers — how much of |0> it contains and how much of |1>, including a relative phase between them. A single-qubit gate is just a fixed recipe that takes those two numbers in and gives two new ones out. Because the gate is reversible, the recipe can always be run backwards.

We write the input and output states with the bracket notation |0> and |1>. A gate applied to |0> might leave it alone, flip it to |1>, or mix the two into a superposition. The notation below is read left to right: the gate name, the input on the right, and the result after the arrow.

X|0> = |1>          # X flips 0 to 1
X|1> = |0>          # ...and 1 back to 0
Z|0> = |0>          # Z leaves 0 alone
Z|1> = -|1>         # ...but flips the sign of 1
Two single-qubit gates at work: X swaps |0> and |1> (the quantum NOT), while Z leaves |0> but flips the sign attached to |1>. The minus sign carries no measurable effect on its own — it matters only through later interference.

The Hadamard gate

The Hadamard gate, written H, is the workhorse that creates superposition. Hand it a |0> and it produces an equal mix of |0> and |1>; hand it a |1> and it produces a similar mix, but with a different internal sign. After one H, the qubit is genuinely poised between 0 and 1 in a precise, fully describable way.

H|0> = (|0> + |1>)/sqrt(2)    # equal superposition
H|1> = (|0> - |1>)/sqrt(2)    # equal mix, opposite sign
H(H|0>) = |0>                 # H is its own inverse
H sends each basis state to an equal superposition; note the minus sign in the |1> case. Applying H twice returns the original state exactly — the two superpositions interfere to undo each other.

Pauli gates (X, Y, Z)

The Pauli gates are the three most basic single-qubit operations. X is the quantum NOT: it swaps |0> and |1>. Z is the phase flip: it leaves |0> alone but flips the sign on |1>. Y does both at once — a bit flip and a phase flip together. With identity (do nothing), these three are the alphabet from which a great deal of single-qubit logic is spelled out.

  1. X (bit flip): swaps |0> and |1>. This is the closest thing to a classical NOT gate.
  2. Z (phase flip): leaves |0> unchanged and flips the sign of |1>. Invisible on its own, decisive under interference.
  3. Y (bit and phase flip): the combined effect of an X and a Z, applied together.
  4. Each Pauli gate is its own inverse: apply any one of them twice and the qubit returns to its starting state.

Gates as rotations

There is a beautiful geometric picture that ties all of this together. Any single qubit's state can be drawn as an arrow pointing somewhere on the surface of a sphere — the Bloch sphere. With this picture, every single-qubit gate is simply a rotation of that arrow. X is a half-turn around one axis, Z is a half-turn around another, and H is a rotation that swaps two of the axes. Reversibility becomes obvious: you can always rotate back.

This is also why gates compose so cleanly: doing one gate after another is just doing one rotation after another, and the combined move is again a rotation. To build a full algorithm you arrange a sequence of these rotations — plus at least one two-qubit gate to create entanglement — into a quantum circuit. A small, fixed toolkit of such gates is already enough to express any quantum computation.