DeepPractise
DeepPractise

Measurement Sampling & Shots

Track: Quantum Gates & Circuits · Difficulty: Beginner · Est: 12 min

Measurement Sampling & Shots

Overview

A common point of confusion is this:

  • “If the circuit is deterministic, why do I get different answers when I run it again?”

This page addresses the practical execution problem:

  • measurement produces random samples from a probability distribution,
  • so you need repeated runs (called shots) to estimate probabilities.

By the end, “shots,” “histograms,” and “randomness” should feel natural and non-mystical.

Intuition

When you measure a qubit in the computational basis, quantum theory predicts probabilities. For a single qubit,

  • you get outcome 0 with probability P(0)P(0),
  • and outcome 1 with probability P(1)P(1).

A single run gives one outcome, not the full distribution. So you repeat the experiment.

A shot is one complete execution of the circuit, including measurement.

If you run the same circuit many times:

  • the list of observed bitstrings is a set of samples,
  • the fraction of each outcome approaches the true probability.

A histogram is just a visual summary of those counted outcomes.

Formal Description

Why measurement is probabilistic

Suppose (just before measurement) the system is in a state

ψ=xαxx.|\psi\rangle = \sum_x \alpha_x |x\rangle.

If you measure in the computational basis, quantum theory says:

P(x)=αx2.P(x) = |\alpha_x|^2.

Measurement returns one bitstring xx drawn according to this distribution.

What a “shot” is

One shot means:

  1. prepare the initial state,
  2. apply the circuit’s gates,
  3. measure,
  4. record the classical outcome.

Repeat for NN shots to get NN samples.

Why repeated runs are required

If P(0)=0.5P(0)=0.5 for a single-qubit experiment, a single shot is just one outcome. You might see 0 or 1.

Only after many shots can you estimate the probability. A simple estimator is frequency:

P^(x)=#times outcome x appearedN.\widehat{P}(x) = \frac{\#\text{times outcome }x\text{ appeared}}{N}.

As NN grows, these frequencies become more stable.

How histograms arise

For multi-qubit measurement, each shot produces a bitstring like 00, 01, 10, 11 (for two qubits), or longer strings for more qubits.

A histogram is a map:

  • bitstring → count (or percentage).

Worked Example

Suppose a 2-qubit circuit ideally produces the Bell state

Φ+=12(00+11).|\Phi^+\rangle = \tfrac{1}{\sqrt{2}}(|00\rangle + |11\rangle).

The ideal measurement distribution in the computational basis is:

  • P(00)=1/2P(00)=1/2
  • P(11)=1/2P(11)=1/2
  • P(01)=0P(01)=0
  • P(10)=0P(10)=0

Now imagine you run N=10N=10 shots. You might see outcomes like:

00, 11, 00, 00, 11, 00, 11, 11, 00, 11

Counts:

  • 00 occurred 5 times
  • 11 occurred 5 times

So the histogram is 50% / 50%.

But with only 10 shots, you could easily get 6/4 or 7/3. That doesn’t mean the circuit “changed.” It means sampling has variation at small sample sizes.

Turtle Tip

Turtle Tip

A circuit run gives you a sample, not a probability. Shots are how you turn samples into probability estimates.

Common Pitfalls

Common Pitfalls
  • Don’t interpret shot-to-shot variation as “the circuit is unstable.” In the ideal model, the pre-measurement state is fixed; measurement is the random step.
  • Don’t confuse “probability” with “frequency.” Frequency is an estimate that improves as shots increase.

Quick Check

Quick Check
  1. What is one “shot” in circuit execution?
  2. Why do you need many shots to estimate P(x)P(x)?

What’s Next

Samples and histograms are the raw measurement output. Often, algorithms don’t use raw bitstrings directly—they use expectation values like Z\langle Z \rangle or X\langle X \rangle computed from samples. Next we explain how expectation values are estimated from circuit measurements.