QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
HomeLearnCatalogRanksPlaygroundDocs
04 · Measurement0%

You are reading without signing in. Sign in or continue as guest to take quizzes and climb the ranks.

Learn/QC 101Quantum Foundations·Lesson 4 of 7

Measurement

What a measurement does to a state, why shots matter and how to read a histogram.

Beginner10 min read6 sections · 2 questions+45
By the end you will be able to
  1. 01State the Born rule.
  2. 02Explain why one shot tells you almost nothing and 4096 shots tell you a lot.
  3. 03Read a QubitLab histogram and estimate its statistical error.

A measurement asks the qubit a yes/no question in a chosen basis. The answer is random, with probabilities given by the squared amplitudes, and afterwards the qubit is in the state matching the answer. The superposition is gone; you cannot measure the same copy twice to learn more.

P(x)=∣ax​∣2,∣ψ⟩;outcome x​;∣x⟩
The Born rule and the collapse. Everything you see in a histogram is estimated from repeated runs of the whole circuit.

01Shots and statistical error

Definition
Shot

One complete run of the circuit, from preparing the qubits to reading every classical bit. Each shot returns a single bit string; a histogram is the count of many shots.

Because each run gives one bit string, you repeat the circuit many times (shots) and count. With N shots the estimate of a probability p has standard error about √(p(1−p)/N). For p = 0.5 and 1024 shots that is ±1.6 percentage points; for 4096 shots ±0.8. QubitLab defaults to 4096 shots for that reason.

Hands-on

Shots in action

Run this with 64 shots, then 4096 (Run panel → Shots). Watch how the two bars approach 50/50 and how the ideal reference line stays fixed.

OpenQASM 3
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
bit[1] c;
h q[0];
c[0] = measure q[0];
Sign in to run (nothing is saved)
Open in the IDE Open in the Playground
Worked solution
How many shots do I need?

You expect p ≈ 0.5 and want the estimate within ±2 percentage points (one standard error).

  1. 1Standard error: √(p(1 − p)/N) = √(0.25/N) = 0.5/√N.
  2. 2Set 0.5/√N = 0.02, so √N = 25.
  3. 3Square both sides: N = 625.

Answer: About 625 shots. Halving the error needs four times as many shots.

02Measuring in another basis

Example
Telling |+⟩ from |−⟩

Measured directly, both read 0 or 1 half the time, so no number of shots separates them. Put H before the measurement: |+⟩ becomes |0⟩ and always reads 0, |−⟩ becomes |1⟩ and always reads 1. One shot now tells them apart.

Hardware only measures in the computational basis. To measure in the X basis you rotate first: apply H, then measure. The sequence H then measure answers the question 'was the qubit |+⟩ or |−⟩?'. This trick is how every algorithm turns phase information into bits.

Knowledge check

2 questions · one try each counts

Question 1

A single shot of a circuit returns 1. What do you know about the state before measurement?

Sign in to answer and climb the ranks; you will come back to this lesson.

Question 2

To estimate a probability near 0.5 to within ±1 percentage point, roughly how many shots are needed?

Sign in to answer and climb the ranks; you will come back to this lesson.

Key takeaway

Measurement is random with probabilities |a|², destroys the superposition, and is always in the computational basis on hardware. Rotate first to measure anything else, and use enough shots to trust your histogram.

Finished reading?

Knowledge check: 2 questions waiting above. Questions are optional. Mark it complete, or press Next: moving on marks it complete too.

Up next
Lesson 5 · 10 min
Quantum Coin Game & Interference
Why two Hadamards are not two coin flips: amplitudes add and cancel like waves.
Further reading
  • Docs: simulation targets and shots
More in Quantum Foundations
  • Why quantum computing?
  • Bits, qubits and notation
  • Superposition and the Hadamard gate
Superposition and the Hadamard gateQuantum Coin Game & Interference
In this lesson0%
  1. Introduction
  2. Shots and statistical error
  3. Try it: Shots in action
  4. Measuring in another basis
  5. Knowledge check
  6. Key takeaway
QubitLab
IDELearnPlaygroundDocsCommunity
Log in
QubitLab
IDELearnPlaygroundDocsCommunity
Log in