Quantum Computing Master Course — 096. Observables and Expectations
Lesson 096: Observables and Expectations
Smartyfy Quantum Computing Master Course
Prerequisites and objectives
A measurement produces individual outcomes, while an expectation value describes their probability-weighted average. You will connect a Hermitian observable to its measurement outcomes, calculate expectations and variances from density matrices, and distinguish intrinsic outcome variation from uncertainty in an estimated mean.
Assume a normalized density matrix ρ. An observable O is a Hermitian operator. Its eigenvalues are real, and its spectral decomposition is O=Σa aPa, where Pa projects onto the eigenspace with outcome value a.
From probabilities to an expectation
The probability of outcome a is pa=Tr(Paρ). Multiplying each outcome value by its probability and adding gives ⟨O⟩=Σa a pa=Tr(Oρ). For a pure state, this becomes ⟨ψ|O|ψ⟩.
The trace expression is real for a Hermitian observable and valid state. Intermediate matrix entries may be complex; the final imaginary part cancels. A tiny residual imaginary value in floating-point arithmetic should be assessed against numerical tolerance.
An expectation value need not be an allowed individual outcome. Measuring Z gives +1 or −1, but its mean can be any number between them. A mean of zero does not mean that one shot returned a zero eigenvalue.
Pauli expectations from a qubit matrix
Write ρ=[[a,c],[conjugate(c),1−a]]. Using X=[[0,1],[1,0]], Y=[[0,−i],[i,0]], and Z=[[1,0],[0,−1]] gives ⟨X⟩=2Re(c), ⟨Y⟩=−2Im(c), and ⟨Z⟩=2a−1.
These are exactly the components of the Bloch vector. Each lies between minus one and one, but that separate condition is not enough for a physical triple: the squared vector length must also be at most one.
For a Pauli observable P, P²=I. Its two outcome probabilities are p+=(1+⟨P⟩)/2 and p−=(1−⟨P⟩)/2. Thus knowing its expectation completely determines that particular binary measurement distribution.
Worked state and three measurement distributions
Consider ρ=[[0.7,0.2−0.1i],[0.2+0.1i,0.3]]. Its determinant is 0.21−0.05=0.16, so its nonnegative diagonal entries and unit trace establish a valid qubit state.
The Bloch vector is (0.4,0.2,0.4). Therefore X-plus has probability 0.7, Y-plus has probability 0.6, and Z-plus has probability 0.7. The Y sign is positive because the upper-right imaginary part is negative.
| Observable | Expectation | Plus probability | Variance |
|---|---|---|---|
| X | 0.4 | 0.7 | 0.84 |
| Y | 0.2 | 0.6 | 0.96 |
| Z | 0.4 | 0.7 | 0.84 |
Variance is a second-moment calculation
The variance of O is Var(O)=Σa pa(a−⟨O⟩)². Expanding the square gives Var(O)=Tr(O²ρ)−Tr(Oρ)². This is nonnegative and has the square of the observable’s units.
For a Pauli measurement, Var(P)=1−⟨P⟩². The worked X and Z variances are 1−0.16=0.84, while the Y variance is 1−0.04=0.96.
A pure state can have nonzero variance for many observables. For instance, |0⟩ has zero Z variance but unit X variance. Purity describes the state; variance also depends on the measurement chosen.
Worked sum of noncommuting terms
Let O=2X+Z, using dimensionless coefficients. Linearity gives ⟨O⟩=2(0.4)+0.4=1.2. This remains valid even though X and Z do not commute.
To calculate the variance, square the whole operator: O²=4X²+Z²+2(XZ+ZX). Because XZ=−ZX, the cross terms cancel and O²=5I. Thus Var(O)=5−1.2²=3.56.
The eigenvalues of O are ±√5. An ideal direct measurement of this observable produces those two values, not separate simultaneous values for X and Z. Their plus-eigenvalue probability is (1+1.2/√5)/2.
Linearity of expectation therefore does not imply that the terms can be measured simultaneously without disturbance, or that the variance equals the sum of their separate variances. The operator product and the actual measurement protocol matter.
Estimate a mean from repeated preparations
Suppose S independent, identically prepared copies are measured with the same observable, giving outcomes o1 through oS. Their average is an unbiased estimator of ⟨O⟩ under this ideal sampling model.
Its variance is Var(O)/S, and its standard deviation is √(Var(O)/S). For the worked Z measurement with S=400, this standard deviation is √(0.84/400), approximately 0.045826.
This uncertainty belongs to the estimated average. The individual Z outcomes still have variance 0.84 no matter how many additional copies are measured. More data sharpen an inference; they do not make each future shot less random.
Independence and stable preparation are assumptions. Drift, correlations, readout bias, or a wrong measurement model can invalidate a simple one-over-square-root sample-size interpretation.
Termwise estimation has its own variance
One can estimate ⟨2X+Z⟩ by measuring X on one group of copies and Z on another. With S independent shots for each term, the estimator 2 X̄+Z̄ has variance 4 Var(X)/S+Var(Z)/S=4.2/S.
This uses two groups, totaling 2S shots, and differs from directly measuring O on S copies. The latter has variance 3.56/S but requires access to the appropriate eigenbasis measurement. Those are different protocols and resource counts.
A fair comparison should fix total preparations and include the implementation cost of the chosen measurement settings. The algebraic observable alone does not specify the easiest experimental estimator.
Four exercises with worked solutions
-
A Z measurement has p0=0.8 and p1=0.2. Find its expectation and variance.
Solution. Assign eigenvalues +1 to zero and −1 to one. The expectation is 0.8−0.2=0.6, and the variance is 1−0.6²=0.64. The probability of outcome zero is not itself the Z expectation.
-
For the worked state, calculate ⟨3I−Y⟩.
Solution. The identity expectation is one, so the result is 3−0.2=2.8. Adding a constant shifts the mean but does not change the variance; the variance remains 0.96.
-
What happens to an estimated mean’s standard deviation if the shot count increases from 100 to 900 under the independent model?
Solution. The count increases by nine, so the standard deviation is divided by three. The underlying single-shot variance does not change.
-
Can the zero X expectation of |0⟩ mean that X has an eigenvalue zero?
Solution. No. X has eigenvalues ±1, each with probability one half for |0⟩. Their average is zero even though neither individual outcome is zero.
Five explained multiple-choice questions
-
The expectation of O in state ρ is: A. Tr(O)Tr(ρ) in general. B. The largest eigenvalue of O. C. Tr(Oρ). D. The most likely outcome only.
Answer: C. The trace weights every spectral outcome by its probability; it is neither a product of traces nor a maximum.
-
For a Pauli observable with mean 0.6, the variance is: A. 0.64. B. 0.6. C. 0.36. D. 1.6.
Answer: A. Its second moment is one, so subtract the squared mean rather than the mean itself.
-
Linearity of expectation for X+Z requires simultaneous X and Z measurements: A. Yes, because it is a sum. B. No; separate ensembles can estimate the terms. C. Only for mixed states. D. Only when the expectation vanishes.
Answer: B. Linearity is an algebraic identity and does not make noncommuting measurements jointly sharp.
-
Four times as many independent shots reduce standard error by: A. Two. B. Four. C. Sixteen. D. No factor because outcomes remain random.
Answer: A. The uncertainty of the mean scales as the inverse square root of shot count.
-
A pure state necessarily has zero variance for every observable: A. True because its density matrix has rank one. B. True only for Pauli observables. C. False only if its ket is unnormalized. D. False; |0⟩ has unit X variance.
Answer: D. Measurement uncertainty depends on the relation between the state and observable, not purity alone.
Pitfalls and summary
Keep eigenvalue outcomes, probabilities, expectations, and estimator uncertainty distinct. Compute a variance from the full squared operator, and specify the measurement protocol and sample assumptions before comparing precision or resources.
Primary sources and further study
These sources support the definitions and context. The numerical examples, exercises, and explanations here were prepared for this lesson. Research papers are optional advanced reading.