First time studying this topic?

Launch the interactive walkthrough to discover each component, including the 3D Q-Sphere Lab & Python in Colab.

Topic 6.10

Measurement in Quantum Circuits: Projection & Classical Registers

Understand how measurements are sequenced in circuits: mid-circuit measurement, deferred measurement principle, and classical conditioning.

Learning Objectives

  • βœ“Sequence measurements into classical register bits
  • βœ“Understand the Principle of Deferred Measurement
  • βœ“Explore mid-circuit measurement and dynamic quantum circuits (feed-forward)

πŸ“–Let's Begin with a Story

For decades, quantum computing followed a rigid textbook rule: "Perform all quantum gate rotations first, and only measure at the very end of the circuit." In 2021, quantum hardware engineers unlocked a dramatic capability: Mid-Circuit Measurement and Reset (MCMR). Now, you can pause in the middle of a quantum calculation, measure a single qubit, read its classical 0 or 1 result, and conditionally fire a microwave pulse to adjust other qubits based on that measurement! This dynamic feed-forward capability is the essential prerequisite for real-time quantum error correction, allowing chips to catch and fix errors while the calculation is actively running.

Why Should You Learn Measurement in Quantum Circuits: Projection & Classical Registers?

🎯 Practical & Engineering Stakes

Dynamic circuits

Mid-circuit measurement reduces required qubit counts and powers fault-tolerant quantum error correction. Understanding how measurement interfaces with classical control logic is modern state of the art.

What Is It?

Simple Explanation

Measurement is the exit door of the quantum world: - The meter icon [ M ] takes a qubit and looks at it. - The delicate quantum state collapses into a regular 0 or 1. - That 0 or 1 is written onto a double wire (classical bit). - You can even use that 0 or 1 to decide what move to make next (Dynamic Circuits)!

Technical Explanation

Projective measurement on qubit jj applies projection operators P0=IβŠ—βˆ£0⟩⟨0βˆ£βŠ—IP_0 = I \otimes |0\rangle\langle 0| \otimes I and P1=IβŠ—βˆ£1⟩⟨1βˆ£βŠ—IP_1 = I \otimes |1\rangle\langle 1| \otimes I. The Principle of Deferred Measurement (Nielsen & Chuang) proves that any mid-circuit measurement followed by classically conditioned gates is computationally equivalent to deferring the measurement to the end of the circuit using coherent quantum controlled gates.

πŸ“š Key Terms

Principle of Deferred Measurement

Simple: A math rule proving that measuring in the middle of a circuit can always be moved to the very end without changing the answer.
Technical: Theorem establishing that measurement operations commute with control lines when replaced by coherent quantum control gates.

Mid-Circuit Measurement (MCMR)

Simple: Measuring a qubit in the middle of a computation to fix errors or reuse the qubit.
Technical: Executing non-terminal projective measurement and active reset within coherence time window t<T2t < T_2.

Q-Sphere Lab: Measurement in Quantum Circuits: Projection & Classical Registers

IBM Q-Sphere Model

Interactive 3D state vector exploration, unitary transformation gates, and Born rule collapse for Topic 6.10

Azimuth: 45Β°Elevation: 25Β°
+Z |0⟩-Z |1⟩+X |+⟩+Y |+i⟩01|ψ⟩
Q-Sphere Phase Color:
0 Ο€/2 Ο€ 3Ο€/2

Quantum Statevector

dim(H) = 2
|ψ⟩ = (1.000 + 0.000i)|0⟩
     + (0.000 + 0.000i)|1⟩
Polar Angle (ΞΈ):0.0Β° (0.000Ο€ rad)
Phase Angle (Ο•):0.0Β° (0.000Ο€ rad)

Born Rule Probabilities: P(x) = |⟨x|ψ⟩|²Σ P = 1.00

P(|0⟩) = |α|²100.0%
P(|1⟩) = |β|²0.0%
Quantum Measurement

Apply Single-Qubit Unitary Gates

Presets:
Continuous Polar Angle θ (0° = |0⟩, 180° = |1⟩):0.0°
Continuous Phase Angle Ο• (0Β° to 360Β°):0.0Β°
Recent Operations Log:
#1Initial state: |0⟩

πŸ“ Mathematical Foundation

LaTeX KaTeX
P(q0=0)=∣α00∣2+∣α01∣2,∣ψcollapsed⟩=α00∣00⟩+α01∣01⟩∣α00∣2+∣α01∣2P(q_0 = 0) = |\alpha_{00}|^2 + |\alpha_{01}|^2, \quad |\psi_{\text{collapsed}}\rangle = \frac{\alpha_{00}|00\rangle + \alpha_{01}|01\rangle}{\sqrt{|\alpha_{00}|^2 + |\alpha_{01}|^2}}

What does it mean?

Partial Measurement & Partial Wavefunction Collapse: When you measure only ONE qubit in an n-qubit register (e.g. measuring qubit 0), you sum the squared amplitudes of all basis states where that qubit is 0. The unmeasured qubits remain in quantum superposition, but the measured qubit snaps into a classical bit!

Understanding the Symbols

Symbol / TermMeaningBeginner Interpretation
P(q0=0)P(q_0 = 0)Probability qubit 0 collapses to 0Sum of probabilities of all states with 0 in the first position
α00,α01\alpha_{00}, \alpha_{01}Amplitudes of compatible statesWeights of states ∣00⟩|00\rangle and ∣01⟩|01\rangle where q0=0q_0 = 0
∣ψcollapsed⟩|\psi_{\text{collapsed}}\ranglePartial collapsed state vectorThe remaining quantum state for the other unmeasured qubits
…\sqrt{\dots}Renormalization denominatorRestores total probability back to 100% (1.0)

πŸ“Š Numerical Example

Measuring qubit 0 on state |ψ⟩ = 0.5|00⟩ + 0.5|01⟩ + 0.707|10⟩:

Step 1: Identify states where Qubit 0 is "0": ∣00⟩|00\rangle has amplitude 0.5 β†’ P = (0.5)^2 = 0.25 ∣01⟩|01\rangle has amplitude 0.5 β†’ P = (0.5)^2 = 0.25 Step 2: Total probability Qubit 0 is "0": P(q0 = 0) = 0.25 + 0.25 = 0.50 (50%) Step 3: Calculate Post-Measurement State if outcome is "0": |ψ_collapsed⟩ = (0.5∣00⟩|00\rangle + 0.5∣01⟩|01\rangle) / √0.50 = (0.5 / 0.7071)∣00⟩|00\rangle + (0.5 / 0.7071)∣01⟩|01\rangle = (1/√2)∣00⟩|00\rangle + (1/√2)∣01⟩|01\rangle = ∣0⟩|0\rangle βŠ— [(∣0⟩|0\rangle + ∣1⟩|1\rangle)/√2]

Result: Qubit 0 is now definitely classical 0, while Qubit 1 remains in an equal 50/50 superposition.

βš™οΈ How Does It Work?

1

Gate Execution

Complete coherent unitary operations.

2

Projective Collapse

Coupled readout resonator collapses selected qubit.

3

Classical Register Storage

Write binary bit string into classical register c[0], c[1]... for host computer analysis.

🌍 Where Is It Used?

Quantum Error Correction (Syndrome Extraction)

Problem: Detecting bit-flips without destroying the stored quantum data.

Solution: Mid-circuit measurements read ancilla qubits to detect error locations while data qubits remain in superpositions.

🎯 Try It Yourself

According to the Principle of Deferred Measurement, can a mid-circuit measurement always be replaced by moving the measurement to the end of the circuit?

Interactive activity component

🐍 Python Hands-On: Simulating Mid-Circuit and Terminal Measurement in Qiskit

Assemble quantum circuits with classical registers and simulate measurement readouts using AerSimulator.

Open Colab

1Install Required Packages

For Google Colab or Jupyter notebooks, run this shell command to install the required dependencies:

Terminal / Notebook Install Commandbash
!pip install qiskit qiskit-aer
Packages:
qiskitqiskit-aer

2Import Libraries

Import Statementspython
1from qiskit import QuantumCircuit
2from qiskit_aer import AerSimulator

from qiskit import QuantumCircuit β†’ Circuit constructor

from qiskit_aer import AerSimulator β†’ Aer simulator

3Demonstration Code & Logic

Python Execution Codepython
1# 1. Build circuit with H, CNOT and Measurement
2qc = QuantumCircuit(2, 2)
3qc.h(0)
4qc.cx(0, 1)
5qc.measure([0, 1], [0, 1]) # Map q0 -> c0, q1 -> c1
6print('Circuit Diagram with Measurement Gauges:')
7print(qc.draw('text'))
8
9# 2. Execute 1,024 measurement shots on AerSimulator
10sim = AerSimulator()
11counts = sim.run(qc, shots=1024).result().get_counts()
12print('\nMeasurement Readout (1,024 shots):')
13for outcome, freq in counts.items():
14 pct = (freq / 1024) * 100
15 print(f' State \'{outcome}\' : {freq} shots ({pct:.1f}%)')
Step-by-Step Code Breakdown:

# 1. Build circuit with H, CNOT and Measurement

Circuit setup

qc = QuantumCircuit(2, 2)

2 qubits, 2 classical bits

qc.h(0)

Superposition on control

qc.cx(0, 1)

CNOT to entangle

qc.measure([0, 1], [0, 1]) # Map q0 -> c0, q1 -> c1

Measurement mapping

print('Circuit Diagram with Measurement Gauges:')

Label

print(qc.draw('text'))

Print diagram

# 2. Execute 1,024 measurement shots on AerSimulator

Run simulation

sim = AerSimulator()

Initialize simulator

counts = sim.run(qc, shots=1024).result().get_counts()

Run shots

print('\nMeasurement Readout (1,024 shots):')

Readout header

for outcome, freq in counts.items():

Print results

pct = (freq / 1024) * 100

Calculate percent

print(f' State \'{outcome}\' : {freq} shots ({pct:.1f}%)')

Print row

πŸ“‹ Complete Script (All-in-One)

Click "Copy for Colab", open Google Colab, paste into a single cell, and run.

Google Colab Notebook Scriptpython
1# =========================================================
2# Simulating Mid-Circuit and Terminal Measurement in Qiskit
3# Prepared for Google Colab (Run with Shift + Enter)
4# =========================================================
5
6# Step 1: Install required packages
7!pip install qiskit qiskit-aer
8
9# Step 2: Import libraries
10from qiskit import QuantumCircuit
11from qiskit_aer import AerSimulator
12
13# Step 3: Run Demonstration
14# 1. Build circuit with H, CNOT and Measurement
15qc = QuantumCircuit(2, 2)
16qc.h(0)
17qc.cx(0, 1)
18qc.measure([0, 1], [0, 1]) # Map q0 -> c0, q1 -> c1
19print('Circuit Diagram with Measurement Gauges:')
20print(qc.draw('text'))
21
22# 2. Execute 1,024 measurement shots on AerSimulator
23sim = AerSimulator()
24counts = sim.run(qc, shots=1024).result().get_counts()
25print('\nMeasurement Readout (1,024 shots):')
26for outcome, freq in counts.items():
27 pct = (freq / 1024) * 100
28 print(f' State \'{outcome}\' : {freq} shots ({pct:.1f}%)')
⚑ How to Run in Google Colab (3 Quick Steps)
  1. Click "Copy for Google Colab" above.
  2. Click Open New Google Colab Notebook (opens in a new tab).
  3. Click on the first empty code cell, press Ctrl + V (or Cmd + V) to paste, then press Shift + Enter to execute!

πŸ”„ Algorithmic Execution Flow

1
Create Entangled Pair

Prepare (|00> + |11>)/sqrt(2).

β†’
2
Attach Readout Gauges

Map quantum state collapse onto classical bit registers.

β†’
3
Sample 1,024 Shots

Observe identical bit outcomes ('00' and '11') with zero cross-terms.

πŸ“₯ Input / Initial State
QuantumCircuit(2, 2) with Bell state and measurement.
πŸ“€ Expected Output
State '00': ~512 shots (50.0%)
State '11': ~512 shots (50.0%)
State '01': 0 shots
State '10': 0 shots
πŸ’‘ What Does This Demonstration Show?

Measurement converts continuous quantum probability amplitudes into discrete classical bitstrings. The perfect agreement between bit 0 and bit 1 confirms entanglement.

Course Learning Resource β€’ Slide DeckLesson 311 Slides

Lesson 3: Quantum Measurement with a One-Qubit Circuit

Hadamard gate, quantum registers, simulation, and histogram measurement.

Author: Dr. Syed Muzamil Bashaβ€’ FDP Approved Curriculum
Open in New Tab
Available Slide Decks:

πŸ“ Learning Check

Test your understanding with these questions. Remember, this is for learning, not examination!

Question 1: Why do quantum cloud platforms (like IBM Quantum) run circuits for multiple "shots" (e.g. 1,024 or 4,096 shots) rather than executing once?

Question 2: What happens to a qubit immediately after measurement?

Question 3: If you measure |ψ⟩ = 0.8|0⟩ + 0.6|1⟩, what is the probability of outcome "0"?

Question 4: Can you measure a qubit without destroying its superposition?

Question 5: In Qiskit, what do the measure gates (meter symbols) do in a circuit?