Skip to content
Kartikey Purohit
← Course overview

Day 6 — Estimator & Error Mitigation

Math Prep

Solve this BEFORE lesson.md. EstimatorV2 returns one number per (circuit, observable): O\langle O \rangle. This prep makes that number concrete, then gives the minimal noise math behind "error mitigation."

Requires: Day 3 math prep (Paulis, expectation values) + Day 4 §4–5. Video back-up: Watrous Lesson 09 Density Matrices, Lesson 10 Quantum Channels; notes in resource-artifactory/notes/video-notes/.


1. Observables = Hermitian operators = weighted Pauli sums

Any measurable quantity is a Hermitian operator OO; any nn-qubit Hermitian operator expands uniquely in the Pauli basis:

O=P{I,X,Y,Z}ncPP,cP=12nTr(PO),  cPRO = \sum_{P \in \{I,X,Y,Z\}^{\otimes n}} c_P\, P, \qquad c_P = \tfrac{1}{2^n}\mathrm{Tr}(PO),\; c_P \in \mathbb{R}

That's precisely what SparsePauliOp([...], coeffs) encodes. Examples:

  • 11=12(IZ)|1\rangle\langle1| = \tfrac{1}{2}(I - Z) — "probability of 1" as an observable.
  • 00=12(I+Z)|0\rangle\langle0| = \tfrac{1}{2}(I + Z).
  • Ising-type Hamiltonian: H=ZZ+0.5XI+0.5IXH = ZZ + 0.5\,XI + 0.5\,IX.

Linearity does the work: O=PcPP\langle O\rangle = \sum_P c_P \langle P\rangle — the Estimator measures each Pauli term (grouping commuting ones into shared measurement bases) and sums with coefficients. II=1\langle I\cdots I\rangle = 1 always, so identity terms shift the answer by their coefficient with zero variance.

2. Values and bounds

O\langle O\rangle lies between λmin(O)\lambda_{\min}(O) and λmax(O)\lambda_{\max}(O). For a single Pauli: [1,+1][-1, +1]. Reference values (compute these until instant):

State Z\langle Z\rangle X\langle X\rangle Y\langle Y\rangle
0\|0\rangle +1+1 0 0
1\|1\rangle 1-1 0 0
+\|+\rangle 0 +1+1 0
\|-\rangle 0 1-1 0
+i\|{+i}\rangle 0 0 +1+1
Ry(θ)0R_y(\theta)\|0\rangle cosθ\cos\theta sinθ\sin\theta 0

Bell Φ+|\Phi^+\rangle: ZZ=XX=+1\langle ZZ\rangle = \langle XX\rangle = +1, YY=1\langle YY\rangle = -1, all single-qubit Paulis =0= 0.

Variance of a Pauli estimate: outcomes are ±1, so Var=1P2\mathrm{Var} = 1 - \langle P\rangle^2, and the shot-noise on P^\widehat{\langle P\rangle} is (1P2)/N\sqrt{(1-\langle P\rangle^2)/N}. Estimator's precision parameter is exactly this target standard error.

3. How noise moves expectation values

Model noise as a channel (Day 3's density matrices earn their keep). The two canonical ones:

Depolarizing noise — with probability pp, replace the state by I/2nI/2^n:

ρ(1p)ρ+pI2n        Pnoisy=(1p)Pideal\rho \mapsto (1-p)\rho + p\,\tfrac{I}{2^n} \;\;\Rightarrow\;\; \langle P\rangle_{\text{noisy}} = (1-p)\langle P\rangle_{\text{ideal}}

Noise shrinks expectation values toward 0 (for traceless observables). Under kk noisy layers: (1p)k(1-p)^k — exponential signal decay with depth.

Readout (measurement) error — classical bit-flip on the recorded outcome with probabilities ϵ01,ϵ10\epsilon_{0\to1}, \epsilon_{1\to0}. Effect on a single-qubit Z\langle Z\rangle with symmetric ϵ\epsilon: Zmeas=(12ϵ)Ztrue\langle Z\rangle_{\text{meas}} = (1-2\epsilon)\langle Z\rangle_{\text{true}} — again a shrink factor.

4. Why mitigation methods work (one line of math each)

  • TREX / readout twirling: measure with random X-flips folded into readout; converts asymmetric readout error into a known symmetric shrink factor, then divide it out.
  • ZNE (zero-noise extrapolation): deliberately amplify noise by factor λ\lambda (e.g. gate folding GGGGG \to GG^\dagger G), measure O(λ)\langle O\rangle(\lambda) at λ=1,3,5\lambda = 1, 3, 5, fit, extrapolate to λ=0\lambda = 0. Works because signal (1p)λk\approx (1-p)^{\lambda k} is smooth in λ. Costs extra circuits; extrapolation can overshoot (estimate, not guarantee).
  • Pauli twirling: conjugate each 2q gate by random Paulis that leave the ideal gate invariant; averages coherent errors into stochastic (depolarizing-like) ones, which ZNE/PEC model better.
  • PEC (probabilistic error cancellation): write the ideal gate as a quasi-probability combination of noisy implementable ones and sample it — unbiased but with sampling overhead γ2k\gamma^{2k}, exponential in depth.
  • DD (dynamical decoupling): insert X–X (or XY4) pulse pairs into idle windows; the pair is identity (XX=IXX = I) but refocuses slow dephasing — a spin echo.

You don't need implementation depth for the exam — you need: what each acronym targets (readout vs gate noise vs idling), whether it's biased, and its cost.

5. Estimator vs Sampler in one probability statement

  • Sampler: returns samples from P(x)P(x) — you post-process.
  • Estimator: returns O^±\widehat{\langle O\rangle} \pm std, having internally chosen measurement bases (X/Y terms need basis rotations — Day 4 §5), grouped commuting terms, and applied mitigation.

If the observable is diagonal (all I/Z), you could get the same number from Sampler counts: Zi=P(biti=0)P(biti=1)\langle Z_i\rangle = P(\text{bit}_i{=}0) - P(\text{bit}_i{=}1). For X/Y terms you cannot, without adding basis-change gates yourself.


PROBLEMS

P1. Expand 1111|11\rangle\langle11| (2 qubits) in the Pauli basis. (Hint: 11=12(IZ)|1\rangle\langle1| = \tfrac12(I-Z) per qubit; tensor and multiply out.)

P2. For ψ=Ry(π/3)0|\psi\rangle = R_y(\pi/3)|0\rangle, compute Z\langle Z\rangle and X\langle X\rangle, then 2Z+X\langle 2Z + X\rangle.

P3. For the Bell state, compute O\langle O \rangle with O=12(ZZ+XX)O = \tfrac12(ZZ + XX). Must an expectation value be an eigenvalue of OO?

P4. Global depolarizing noise with p=0.2p = 0.2 acts on the Bell state. Give ZZnoisy\langle ZZ\rangle_{\text{noisy}}. Now two such layers. Generalize to kk layers.

P5. Symmetric readout error ϵ=0.05\epsilon = 0.05 on ONE qubit of a Bell pair (other qubit read perfectly): what's the measured ZZ\langle ZZ\rangle?

P6. ZNE gives O=0.60\langle O\rangle = 0.60 at noise factor 1 and 0.360.36 at factor 3; assume exponential decay O(λ)=Aebλ\langle O\rangle(\lambda) = A e^{-b\lambda}. Extrapolate to λ=0\lambda = 0.

P7. An estimator must resolve P0\langle P \rangle \approx 0 to precision 0.01. Using Var=1P2\mathrm{Var} = 1 - \langle P\rangle^2, how many effective shots does the term need?

P8. True/false with reason: "Increasing shots reduces the bias caused by depolarizing noise."


ANSWERS

A1. 1111=12(IZ)12(IZ)=14(IIIZZI+ZZ)|11\rangle\langle11| = \tfrac12(I{-}Z)\otimes\tfrac12(I{-}Z) = \tfrac14(II - IZ - ZI + ZZ).

A2. Z=cosπ3=12\langle Z\rangle = \cos\frac{\pi}{3} = \tfrac12; X=sinπ3=32\langle X\rangle = \sin\frac{\pi}{3} = \tfrac{\sqrt3}{2}. Linearity: 212+32=1+321.872\cdot\tfrac12 + \tfrac{\sqrt3}{2} = 1 + \tfrac{\sqrt3}{2} \approx 1.87.

A3. O=12(1+1)=1\langle O\rangle = \tfrac12(1 + 1) = 1. Here 1 happens to be an eigenvalue (Φ+|\Phi^+\rangle is an eigenvector), but in general noO\langle O\rangle is a weighted average of eigenvalues (e.g. Z+=0\langle Z\rangle_{|+\rangle} = 0, which is not ±1).

A4. One layer: (1p)1=0.8(1-p)\cdot1 = 0.8. Two: 0.82=0.640.8^2 = 0.64. kk: 0.8k0.8^k — exponential signal decay with depth, the fundamental depth-limit of noisy hardware.

A5. The recorded parity flips exactly when the noisy bit flips: probability ϵ\epsilon. ZZmeas=(12ϵ)1=0.9\langle ZZ\rangle_{\text{meas}} = (1-2\epsilon)\cdot1 = 0.9.

A6. e2b=0.36/0.60=0.6e^{-2b} = 0.36/0.60 = 0.6b=12ln0.60.255b = -\tfrac12\ln 0.6 \approx 0.255. A=0.60eb0.775A = 0.60\,e^{b} \approx 0.775. Extrapolated ideal value ≈ 0.775larger than any measured value; mitigation "un-shrinks" the signal.

A7. Var ≈ 1, need std 0.01: N=1/0.012=10000N = 1/0.01^2 = 10\,000 effective shots for that term.

A8. False. Shots shrink the statistical error bar around the noisy mean (1p)O(1-p)\langle O\rangle; the bias (gap to the ideal value) is untouched. Removing bias is mitigation's job (ZNE/PEC/TREX), not the shot budget's.


Self-check: you can Pauli-decompose small projectors, compute ⟨Pauli sums⟩ by linearity, predict the (1p)k(1-p)^k shrink, and say in one sentence each what DD, TREX, ZNE, PEC target.