Pauli gates and the Hadamard gate
Bit flips, phase flips and a change of basis.
- Calculate the effect of X, Y, Z and H on basis states.
- Verify HZH = X using a worked input.
The Pauli matrices
Section titled “The Pauli matrices”X exchanges and . Y sends to and to . Z leaves alone and negates .
Each Pauli squares to I. On a basis state, Z’s minus may be only a global phase; on a superposition it can change a relative phase.
Hadamard changes the basis
Section titled “Hadamard changes the basis”Because , it also maps back to 0 and back to 1. This is why H before Z readout implements an X-basis measurement.
A worked identity
Section titled “A worked identity”Trace : the first H gives plus, Z gives minus, and the second H gives 1. On , the sequence gives 0. Thus on a basis, hence on all states by linearity.
Practise
Section titled “Practise”Use the qubit explorer to compare X and Y on . Their outcome probabilities agree, but their statevectors differ by a global phase. Then test them on a superposition: agreement on one input is not agreement as operators.
Separate bit flips from phase flips
Section titled “Separate bit flips from phase flips”X changes the computational label of a basis state. Z changes the relative sign of a superposition’s one component. The diagram compares these actions on inputs that make their effects easy to see. On zero, Z has no visible effect. On plus, it produces minus. A gate must be described by its action on a full basis or by its matrix, rather than by one convenient input example.
The three Pauli gates correspond to half turns around the three Bloch axes, up to global phase. The global phase qualification matters when comparing printed statevectors, but it does not change the sphere coordinates. Applying a Pauli twice gives the identity exactly with the matrix conventions used here. A physical implementation may accumulate control errors even when the ideal matrix product cancels.
Worked example: calculate Y carefully
Section titled “Worked example: calculate Y carefully”Let a and b be the input amplitudes. Multiplying by Y gives negative i times b in the zero component and i times a in the one component. For a plus input, the output is negative i times zero plus i times one, with the common square-root-of-two denominator. Factoring out negative i leaves the minus state.
The output’s Z probabilities therefore remain equal, but the physical state has changed from positive x to negative x. A comparison that checks only probabilities would miss the change. A comparison that demands exact equality with the standard written minus vector would also fail unnecessarily because of the common phase. Check physical equivalence through relative amplitudes or the overlap magnitude.
For zero input, Y produces i times one. That is physically equivalent to one because the phase is common to the only nonzero component. For a general superposition, the two components transform differently and the result cannot be summarised as a classical bit flip. The imaginary entries are part of the gate’s coherent action.
H changes which Pauli looks like a bit flip
Section titled “H changes which Pauli looks like a bit flip”The identity HZH equals X follows by applying the three gates to an arbitrary column. The first H forms the sum and difference. Z negates the difference. The last H exchanges the original components. Checking zero is a useful example; checking both basis states or multiplying the matrices establishes the full linear identity.
Similarly, HXH equals Z. The Hadamard gate changes between the Z and X bases, so it converts a phase flip in one basis into a label flip in the other. This relation is used in readout circuits, error-correction constructions and compiler transformations. It also shows why an error’s description depends on the basis: a harmless-looking phase in one measurement setting can be a directly observable change in another.
Order and anticommutation
Section titled “Order and anticommutation”X followed by Z and Z followed by X differ by a global minus sign when applied as isolated one-qubit operations. Their measurement statistics agree for every input, although the matrices are not identical. This is called anticommutation. It is stronger and more precise than saying “order does not matter,” because a conditional version can make the phase difference relevant between branches.
For beginning circuit work, keep exact matrix products until you know which common phases may be ignored in the task. Do not simplify controlled subroutines using a global-phase equivalence without checking the control. Conversely, do not report two isolated output states as physically different solely because every amplitude has been negated. The context determines which comparison is appropriate.
Test reference states, then a complex state
Section titled “Test reference states, then a complex state”The explorer starts at zero. Predict X on that input and reveal. Reset, predict Y on zero and compare its imaginary amplitude with X’s real amplitude. Explain why their Z outcomes agree. Then prepare plus by applying H to a reset zero state and compare X, Y and Z on separate fresh trials.
Qubit explorer
Prepare a pure qubit, apply gates, then compare amplitudes, phases and Z-basis probabilities. Reset restores the initial preparation shown by the lesson’s controls.
Prepare your experiment using the controls. Record a prediction, then reveal the statevector or run the experiment.
Changing the preparation or circuit starts a new prediction.
Take it further
Prepare θ = 120°, φ = 90°. Predict both complex amplitudes. Then change φ without changing θ.
Initial setup · reference state
| Basis | Amplitude a + bi | Magnitude | Phase (rad) | Probability |
|---|---|---|---|---|
| |0⟩ | 1 + 0i | 1.000000 | 0.000000 | 100.0% |
| |1⟩ | 0 + 0i | 0.000000 | undefined | 0.0% |
Signs and complex phases are part of the state. Phase is undefined for a zero amplitude. A shared global phase changes no probabilities; relative phases can affect a later operation. Values are rounded to six decimal places.
Prediction to try: Predict the amplitudes and Z-basis probabilities for the preparation and gates you have chosen. If starting from |0⟩, what will H do?
Challenge: Prepare θ = 120°, φ = 90°. Predict both complex amplitudes. Then change φ without changing θ.
Open the live experiment studioFinally set polar angle 120 degrees and relative phase 90 degrees, then calculate one Pauli output by matrix multiplication before revealing. This less symmetric input is a better test of a general rule than the poles alone. Compare the full complex vector and its norm, then use the histogram as a final check.
Practice: prove a gate identity
Section titled “Practice: prove a gate identity”Verify HXH equals Z by applying it to zero and one separately. Explain why checking these two inputs is enough for the ideal linear transformation, while checking only their final Z probabilities would be insufficient.
Check your reasoning
Zero becomes plus, remains plus under X, and returns to zero under H. One becomes minus, gains a global minus under X, and returns to negative one under H. These are Z’s two matrix columns. Linearity determines the action on every superposition. Probabilities alone would hide the negative sign on the second column and could not distinguish Z from the identity.
Check your understanding
Section titled “Check your understanding”What does HXH do on an arbitrary qubit?
Answer: The same transformation as Z. H changes between X and Z bases, giving HXH = Z. Both basis columns, including signs, establish the identity.
Reference: IBM Quantum — Quantum information.
Ready for the next step?
Your progress stays in this browser.