beginner · Programming · Single-Qubit Gates I: X, Y, Z
Checkpoint: Build a Target State with Paulis
You have now seen all three Pauli gates: X flips the qubit, Z reflects the phase of
∣1⟩, and Y does both at once. This checkpoint asks you to chain several of them in
sequence and reason about the result before you run the simulator.
Because quantum gates are linear, knowing these four values is enough to predict the action of any
Pauli on any state.
Composing gates
When you apply gates one after the other, the final state is determined by their product acting on
the initial state. For the three-gate sequence Y→X→Y starting from ∣0⟩:
Step 1.Y∣0⟩=i∣1⟩.
Step 2.X(i∣1⟩)=i⋅X∣1⟩=i∣0⟩.
Step 3.Y(i∣0⟩)=i⋅Y∣0⟩=i⋅i∣1⟩=−∣1⟩.
The overall result is −∣1⟩. Because −1=eiπ is a global phase factor, −∣1⟩
is physically identical to ∣1⟩: no measurement can tell them apart. The statevector grader
treats these as equal.
You can also verify the composition algebraically. The matrix product is
YXY=(0i−i0)(0110)(0i−i0)=−(0110)=−X,
so the three-gate sequence implements −X — the flip gate up to global phase.
Try it
Implement the gate sequence Y,X,Y on qubit 0, verify that the resulting state is ∣1⟩
(up to global phase), then press Check.
Run your code to see the quantum state.
After running, the amplitude on ∣1⟩ should have magnitude 1 and the Bloch vector should
point at the south pole — the signature of ∣1⟩.
Sign in on the full site to ask questions and join the discussion.