Years 11–12 · Week 6 of 12

Circuit Composition and Basis Changes

55 minutes 7 possible star points Mathematical Extension for Year 12

Learning goals

By the end, you can…

  • Read circuit operations from left to right in time.
  • Translate a gate sequence into the corresponding ordered matrix product.
  • Use H before a computational-basis measurement to measure in the X basis.
  • Debug a circuit by inspecting the state after each gate.

What you already know

Connect to a familiar idea

Each gate has a matrix action. A circuit composes those actions, and the order matters because matrix multiplication is generally not commutative.

  • Single-qubit gate matrices
  • Matrix-vector multiplication
  • Z- and X-basis states

Opening story

Start with something familiar

Following 'put on socks, then shoes' differs from reversing the two instructions. Quantum circuits also have ordered steps, although their steps are mathematical transformations rather than clothing actions.

Plain-English explanation

Build the idea carefully

Circuit time and algebraic order

Circuit diagrams are read from left to right in time. If U₁ acts first, then U₂ and U₃, the final column state is |ψout⟩ = U₃U₂U₁|ψin⟩; the rightmost matrix acts first in the algebra. Order matters when gates do not commute. For example, H then X is represented XH, while X then H is HX. On |0⟩ these sequences produce |+⟩ and |−⟩ respectively, which are distinct even though their immediate Z-basis probabilities match.

Basis changes as part of measurement

A device that measures only in the computational Z basis can perform an X-basis measurement by applying H immediately before measurement. The H gate maps |+⟩ to |0⟩ and |−⟩ to |1⟩, so the recorded bit labels which X-basis state was found. Worked identity: HZH = X, so H–Z–H maps |0⟩ to |1⟩. A circuit debugger should show the state after each ideal gate, making phase changes visible before the final measurement hides amplitude information.

Try the model

Step-through circuit debugger

Build a one-qubit circuit, then use step, back and reset to inspect the state vector and basis probabilities after every gate.

Interactive teaching model
|0⟩ Choose a gate to begin Measure

Qubit 0 is the least-significant state-vector bit. Displayed basis labels read q(n−1)…q0.

Ready. Adjust a control, then run the model.

What this model shows: Measurement is shown as a separate final operation; the displayed pre-measurement vector belongs to an ideal state-vector simulation.

Text alternative for this interactive

Text alternative: starting [1,0]ᵀ, H gives [1/√2,1/√2]ᵀ, Z gives [1/√2,−1/√2]ᵀ, and the final H gives [0,1]ᵀ.

Expected observation: The H–Z–H circuit takes |0⟩ through |+⟩ and |−⟩ to |1⟩, while reordering those gates produces a different state sequence.

Guided activity

Debug an unexpected output

  1. Predict the final state for H–H and H–Z–H from |0⟩.
  2. Step through both circuits and record every intermediate state.
  3. Compare H–X with X–H and identify the first point of difference.
  4. Add the correct basis-change gate to distinguish |+⟩ from |−⟩.

Evidence to collect: A checkpoint table with correctly ordered states and a repaired circuit whose final measurement distinguishes the supplied X-basis states.

Glossary

Words to know

quantum circuit
An ordered diagram of state preparations, gates and measurements.
composition
Combining transformations so the output of one becomes the input of the next.
gate order
The time sequence in which circuit operations act.
commute
To give the same product when the order of two operations is exchanged.
basis change
A unitary transformation used to express or measure a state in another basis.
computational basis
The Z basis labelled by |0⟩ and |1⟩.
checkpoint
A displayed intermediate state used to analyse or debug a circuit.

Short recap

Keep these ideas

  • Circuit time runs left to right, while the rightmost matrix acts first in the product.
  • Reversible gates need not commute.
  • Applying H before Z measurement implements an X-basis measurement.
  • Intermediate state vectors reveal phase information that a final histogram alone may hide.

Knowledge check

7 clear questions

Choose an answer for immediate feedback. You may retry, and your best submitted score is kept.

1Which statement best answers this lesson's essential question?
2Which idea is supported by the explanation?
3Which result should you look for in the interactive model?
4Which statement correctly fixes the common misconception?
5Where does the helpful analogy stop being exact?
6What evidence should the guided activity collect?
7Which statement belongs in the lesson recap?
Mathematical Extension Optional extension for Year 12

Calculate HZH and verify that it equals X. Then calculate HXZ and ZXH or apply them to |0⟩ to demonstrate explicitly that changing order generally changes the transformation.

Try this

Design the shortest circuit using H and Z that maps each of |0⟩, |1⟩, |+⟩ and |−⟩ to a computational-basis state, noting when a single circuit cannot map all four distinct states to distinct bits.

Adult support Teacher and parent notes

Discuss

  • Why is visual circuit order opposite to the order in the written matrix product?
  • How does a basis change let a fixed detector answer a different question?
  • Which checkpoint best exposes the effect of Z in H–Z–H?

Answer guidance

Check whether students apply the rightmost matrix first and distinguish state vectors from measurement probabilities. Point out that global phase-equivalent vectors represent the same physical pure state.

Offline activity

Give groups gate-matrix cards and state cards. Students physically order the circuit left to right, then stack matrices in algebraic order.

Safety

No practical hazards are present. Ensure that step animations can be paused and that all intermediate states are also available as text.

Open the full Quantum Computing Foundations adult guide

Sources and further reading

Checked references for this lesson

These sources support the lesson’s main scientific claims. Links open on the source organisation’s site.

  1. Circuits IBM Quantum Learning · official learning module · checked 2026-08-02
  2. Quantum information IBM Quantum Learning · official learning module · checked 2026-08-02
  3. Quantum Computation and Quantum Information Cambridge University Press · textbook publisher page · checked 2026-08-02

Content review: Reviewed on 2026-08-02.