Single-qubit gates
Single-qubit gates are fixed, reversible operations on one qubit's amplitudes: X swaps the 0 and 1 amplitudes, Z flips the sign of the 1-amplitude, H opens and closes superpositions, and S, T, RX, RY and RZ set phases and angles more finely. Z is a fixed half-turn of phase; RZ is the same rotation with the angle as a free parameter.
What are the gates, one by one?
A single-qubit gate is a reversible operation on one qubit's two amplitudes. Nothing is measured and nothing is random: each gate is a fixed 2×2 matrix, and applying it multiplies the state vector. Run the same gate on the same state and you get the same state, every time.
The working vocabulary:
- X — swaps the amplitudes of |0⟩ and |1⟩. The quantum NOT.
- Z — flips the sign of the |1⟩ amplitude. Probabilities depend on amplitude magnitudes, so Z is invisible if you measure straight away — it only matters once interference is involved.
- H — sends |0⟩ to (|0⟩+|1⟩)/√2 and |1⟩ to (|0⟩−|1⟩)/√2. The gate that opens and closes superpositions.
- S and T — finer phase steps. S multiplies the |1⟩ amplitude by i (a quarter turn of phase); T is half of that (an eighth turn). So T·T = S and S·S = Z.
- RX, RY, RZ — continuous rotations by any angle you choose, in radians.
Why do gate sequences cancel or combine?
Gates compose by matrix multiplication, and many combinations collapse into something simpler. Two H's in a row cancel exactly: H·H = I, so the sequence H, H on |0⟩ reads 0 on every shot — the superposition is opened and then closed, and the two paths to |1⟩ interfere away.
More useful: H·Z·H = X. On its own, Z does nothing you can measure on |0⟩. Sandwiched between two H's, it becomes a bit flip. This is the pattern worth internalising: H converts phase differences into measurable bit differences. It is the mechanism behind every interference-based algorithm.
These identities are checkable, not just claimable: swap the Z in the next circuit for S, S — or for T, T, T, T — and the result is identical, because S·S = Z and four T's make a Z.
What does RZ do that Z doesn't?
Z rotates the phase by a fixed half-turn (π). RZ(θ) rotates by any angle. RZ(π) and Z differ only by a global phase — a factor applied to the whole state — and no measurement can ever detect a global phase, so as circuit instructions they are interchangeable. What RZ adds is everything in between: continuous, fine-grained phase control.
You can see the angle directly with the same H sandwich. The circuit H, RZ(θ), H sends |0⟩ to a state where the probability of reading 1 is sin²(θ/2). The phase angle becomes an output probability — a dial, not a switch. That dial is what algorithms with tunable parameters actually turn.
What do these gates look like on a real QPU?
Real devices don't implement this whole list natively. A typical superconducting QPU exposes a tiny native set — often just SX, X, RZ and one two-qubit gate — and the compiler rewrites everything you write into it. Your H becomes an RZ–SX–RZ sequence; your T becomes an RZ.
RZ has a further trick: on most superconducting hardware it is virtual — implemented as a bookkeeping change to the phase of later control pulses, taking zero time and adding essentially zero error. The physical pulses (SX, X and the two-qubit gates) are where duration and error live. That's why circuit cost on real hardware is counted in native gates, not in the gates you typed. See what each device actually runs natively on the QPU index.