Stage 2 · Lesson 6 of 17

Quantum gates and circuits

40 minutesNo coding required10-question quiz

1 · Big question

How do X, H, Z and CX change one- and two-qubit circuits?

  • Describe the introductory actions of X, H and Z.
  • Identify control and target in CX.
  • Step through one- and two-qubit state probabilities.
  • Explain why H is not merely a randomness button.

2 · Before we begin

Ideas to bring with you

  • A circuit is read from left to right.
  • X exchanges the reference states.

3 · New words

Meet the words before we use them

Hadamard gate (H)
A gate that can create or analyse equal-probability states.
phase and Z gate
Phase is a state feature that affects later combinations; Z is a gate that changes relative phase.
controlled-X (CX)
A two-qubit gate that applies X to a target when its control is in the relevant basis state.

4 · Simple explanation

Build one idea at a time

X exchanges |0⟩ and |1⟩. H can prepare an equal-probability state from either reference state, but it does not create a classical random value until measurement.

The Z gate changes relative phase. It can leave immediate 0/1 probabilities unchanged while changing a later gate’s result.

CX has a control qubit and a target qubit. In basis-state examples, the target flips when the control is 1; for other valid quantum states, the same operation can help create entanglement.

Watch it happen

One- and two-qubit gate laboratory

Calculated teaching model

Choose X, H, Z, CX or measurement, then inspect state and probability checkpoints.

Ready. Use Step or Play to begin.
Text description of the animation

A keyboard circuit builder shows one or two labelled wires, gate definitions, calculated state checkpoints, exact probabilities and a sampled histogram.

  1. Open each gate definition before adding it.
  2. Build H then measurement and predict the probability bars.
  3. Insert Z after H, compare immediate bars, then add a final H and compare again.

Evidence to calculate or record: Z leaves the immediate H-state 0/1 probabilities equal but changes the final H analysis result.

Predict

Commit to an idea before the reveal

Starting in |0⟩, what probabilities do you predict after H, and what changes if Z is added before an immediate measurement?

Choose a prediction to enable the experiment.

Try it

Define, build, predict

Teaching model

Open each gate definition before adding it.

Make and lock a prediction first.

Detailed activity results will appear here.

Built-in circuit lab

Build from left to right

Ideal simulator

Choose the number of qubits, add instructions with the buttons, then predict before you run. Every drag action has a keyboard button alternative.

  1. No instructions yet.
Initial state: every qubit is prepared as |0⟩.

Circuit results

Simulator
Exact probabilities and sampled results
ResultExact chanceCountSample percent
0100%

Run the simulator to create a text summary of the chart.

Bit-order legend

Pi Leo labels wires q0, q1 and q2 from top to bottom. In displayed result strings, the highest-numbered bit is written on the left, so a two-qubit result is shown as q1q0. This matches the convention used in the Pi Leo simulator and common Qiskit count strings.

Gate definitions
X
Exchanges the |0⟩ and |1⟩ reference states in these examples.
H
Changes the state direction and can create equal 0/1 measurement probabilities from |0⟩.
Z
Changes relative phase. Its effect may appear only after a later analysing gate.
CX
Applies X to a target when its control is in the |1⟩ reference state.
Measurement
Produces a classical bit result.

8 · Observe

What did the result actually show?

Look at the displayed values before reading the explanation. Record a pattern, an exception or something that changed.

H produces equal immediate probabilities from |0⟩. Z changes phase without changing those bars; a following H converts the phase change into a different final probability.

9 · Explain the result

Connect the evidence to the idea

Gates transform the whole quantum state. Measurement samples the resulting probabilities, so randomness belongs to the preparation-plus-measurement experiment, not to H alone.

10 · Model and limitation

Useful model, honest boundary

What this model shows

The calculated checkpoint view connects each gate to exact state probabilities.

What this model does not show

State labels and arrows are mathematical representations; the display does not show the physical pulses used by a particular processor.

11 · Common mix-ups

Careful wording prevents big mistakes

H is a classical randomness button.

H prepares a quantum state; random classical output appears only when that state is measured.

Z does nothing when probability bars stay the same.

Z can change relative phase and therefore later interference.

CX always copies a qubit.

CX is a reversible two-qubit operation and cannot generally copy an unknown state.

12 · Real quantum-computing connection

Where this appears in circuit work

X, H, Z and CX are standard circuit-level instructions, though hardware may implement or translate them using different native operations.

13 · Show me moreOptional deeper explanation

Show me more

For |+⟩=(|0⟩+|1⟩)/√2, Z produces |−⟩=(|0⟩−|1⟩)/√2. A later H maps these phase-distinct states to different reference states.

Try this

Explain the deeper idea in your own words, including one limitation.

14 · Quick summary

Keep these ideas

  • X exchanges reference states.
  • H prepares or analyses equal-amplitude states.
  • Z changes relative phase.
  • CX has a control and target.

Ten-question quiz

Check the ideas—not decorative details

Feedback appears after submission. Retry whenever you like; 8/10 or above means “Topic understood”.

1Why is H not simply a randomness button?

Concept · Easy

2What can Z change even when immediate P(0) and P(1) stay the same?

Concept · Medium

3What are the two roles in a CX gate?

Concept · Easy

4Which symbol names the Hadamard gate in this course?

Vocabulary · Easy

5What does the word ‘controlled’ indicate in CX?

Vocabulary · Easy

6Starting from |0⟩, what are the ideal probabilities after H?

Prediction · Easy

7From |0⟩, what happens to immediate 0/1 probabilities in H → Z?

Prediction · Medium

8At which step does an H experiment first produce a recorded classical bit?

Misconception · Medium

9Which comparison demonstrates that Z had an effect after H?

Evidence · Medium

10For control=1 and target=0, what basis output does CX produce when written control first?

Application · Medium

Sources and accuracy notes3 checked references · reviewed 2026-08-15

These records identify the claim each source supports. External documentation can change; dated platform claims were checked on the shown access date.

  1. CircuitsIBM Quantum Learning · Quantum circuits — Circuits · accessed 2026-08-15

    Supports quiz questions ql-06-q-01, ql-06-q-03, ql-06-q-04, ql-06-q-05, ql-06-q-08, ql-06-q-10 and their related lesson explanations about classical and quantum circuit models; gates and wires; standard-basis measurement.

  2. Quantum informationIBM Quantum Learning · Single systems · accessed 2026-08-15

    Supports quiz questions ql-06-q-02, ql-06-q-06, ql-06-q-07 and their related lesson explanations about state vectors; normalisation; single-system measurement probabilities.

  3. Quantum Computation and Quantum InformationCambridge University Press · 2010 · Sections 1.2–1.3 and Chapters 4, 6 and 8 · accessed 2026-08-02

    Supports quiz questions ql-06-q-09 and their related lesson explanations about quantum states and circuits; quantum algorithms; teleportation, noise and error correction.

Lesson accuracy notes
  • This model is deliberately limited: State labels and arrows are mathematical representations; the display does not show the physical pulses used by a particular processor.
  • Predictions, simulations and physical-hardware evidence are labelled separately.