X, Y and Z Gates
X swaps the amplitudes of |0⟩ and |1⟩. Z flips the sign of the |1⟩ amplitude. Y does both, with factors of i. Z changes the phase, which the current histogram can't see. But later gates can turn that hidden change into chances you can see.
What do X, Y and Z actually do?
Why care? These three gates are the basic moves for one qubit. Almost every bigger gate is built from ideas you meet here.
They are called the Pauli gates, after the scientist Wolfgang Pauli. Each one acts on the amplitude pair (α, β) of the state α|0⟩ + β|1⟩. Amplitudes are the numbers that set the qubit's chances.
Xswaps the amplitudes: (α, β) becomes (β, α). On plain 0 or 1 states it is the NOT gate from ordinary code.Zflips the sign of the second amplitude: (α, β) becomes (α, −β). It changes phase, not the current histogram.Ydoes both at once, with factors of i. (The number i is special: i × i = −1.) So (α, β) becomes (−iβ, iα).
Think of a card with a number on each side. X flips the card over. Z paints a minus sign on the back side only. (Unlike a card, the qubit shows only one side when you look, picked by chance.)
- Worked example: X swaps the histogram
- Worked example: Z changes something the histogram can't see
- Run it: flip, then phase-flipINTERACTIVE
- Try this: put the phase where it mattersINTERACTIVE
- If the histogram didn't change, did the gate do nothing?
- How are these gates implemented on real devices?
You’ve read the opening of chapter 6. Pro unlocks the other 6 sections — plus every chapter of every course, with circuits you can run right on the page. That’s $11.99 a month, about the price of a coffee, or $99.99 a year (save 30%). The first chapter of every course, and the whole math course, stay free.