ψQuantum Computing 2026

CHAPTER 03

Measurement and changes of basis

Learning goals. Project a state onto an orthonormal basis, retain the conjugation and cancellations, calculate conditional states, and connect probabilities to repeated experiments.

3.1 A basis specifies a question

An orthonormal basis {|b0,|b1}\{|b_0\rangle,|b_1\rangle\} satisfies bj|bk=δjk\langle b_j|b_k\rangle=\delta_{jk}. Projective measurement in this basis gives

p(bj)=|bj|ψ|2.p(b_j)=|\langle b_j|\psi\rangle|^2.

For an ideal rank-one measurement, outcome bjb_j leaves the system in |bj|b_j\rangle up to global phase. The prior state determines probabilities; the observed result determines the conditioned state afterward.

Writing |ψ=c0|b0+c1|b1|\psi\rangle=c_0|b_0\rangle+c_1|b_1\rangle and multiplying by bj|\langle b_j| gives cj=bj|ψc_j=\langle b_j|\psi\rangle. A basis change calculates new coordinates of the same vector. Physically applying a gate changes the vector; a gate followed by Z measurement can implement a different measurement basis.

3.2 One state, three full calculations

Our recurring example is

|ψ=2|0+3i|113.|\psi\rangle=\frac{2|0\rangle+3i|1\rangle}{\sqrt{13}}.

Its norm squared is

(20|3i1|)(2|0+3i|1)13=4+6i(0)6i(0)9i213=4+913=1.\frac{(2\langle0|-3i\langle1|)(2|0\rangle+3i|1\rangle)}{13} =\frac{4+6i(0)-6i(0)-9i^2}{13} =\frac{4+9}{13}=1.

3.2.1 Z basis

0|ψ=20|0+3i0|113=2(1)+3i(0)13=213,p(0)=(213)*(213)=413.\begin{aligned} \langle0|\psi\rangle &=\frac{2\langle0|0\rangle+3i\langle0|1\rangle}{\sqrt{13}}\\ &=\frac{2(1)+3i(0)}{\sqrt{13}}=\frac2{\sqrt{13}},\\ p(0)&=\left(\frac2{\sqrt{13}}\right)^* \left(\frac2{\sqrt{13}}\right)=\frac4{13}. \end{aligned}

Similarly,

1|ψ=2(0)+3i(1)13=3i13,\langle1|\psi\rangle=\frac{2(0)+3i(1)}{\sqrt{13}} =\frac{3i}{\sqrt{13}}, p(1)=(3i)(3i)13=9i213=913.p(1)=\frac{(-3i)(3i)}{13}=\frac{-9i^2}{13}=\frac9{13}.

3.2.2 X basis

+|ψ=(0|+1|)(2|0+3i|1)26=20|0+3i0|1+21|0+3i1|126=2+0+0+3i26=2+3i26.\begin{aligned} \langle+|\psi\rangle &=\frac{(\langle0|+\langle1|)(2|0\rangle+3i|1\rangle)}{\sqrt{26}}\\ &=\frac{2\langle0|0\rangle+3i\langle0|1\rangle +2\langle1|0\rangle+3i\langle1|1\rangle}{\sqrt{26}}\\ &=\frac{2+0+0+3i}{\sqrt{26}}=\frac{2+3i}{\sqrt{26}}. \end{aligned}

The squared modulus is

p(+)=(23i)(2+3i)26=4+6i6i9i226=1326=12.p(+)=\frac{(2-3i)(2+3i)}{26} =\frac{4+6i-6i-9i^2}{26} =\frac{13}{26}=\frac12.

For the other outcome,

|ψ=(0|1|)(2|0+3i|1)26=2+003i26=23i26,p()=(2+3i)(23i)26=12.\begin{aligned} \langle-|\psi\rangle &=\frac{(\langle0|-\langle1|)(2|0\rangle+3i|1\rangle)}{\sqrt{26}}\\ &=\frac{2+0-0-3i}{\sqrt{26}}=\frac{2-3i}{\sqrt{26}},\\ p(-)&=\frac{(2+3i)(2-3i)}{26}=\frac12. \end{aligned}

3.2.3 Y basis

Forming the bra conjugates the imaginary coefficient:

+i|=0|i1|2,i|=0|+i1|2.\langle+i|=\frac{\langle0|-i\langle1|}{\sqrt2}, \qquad\langle-i|=\frac{\langle0|+i\langle1|}{\sqrt2}.

Now expand, including the terms that vanish:

+i|ψ=(0|i1|)(2|0+3i|1)26=20|0+3i0|12i1|0+(i)(3i)1|126=2+003i226=526,p(+i)=2526.\begin{aligned} \langle+i|\psi\rangle &=\frac{(\langle0|-i\langle1|)(2|0\rangle+3i|1\rangle)}{\sqrt{26}}\\ &=\frac{2\langle0|0\rangle+3i\langle0|1\rangle -2i\langle1|0\rangle+(-i)(3i)\langle1|1\rangle}{\sqrt{26}}\\ &=\frac{2+0-0-3i^2}{\sqrt{26}}=\frac5{\sqrt{26}},\\ p(+i)&=\frac{25}{26}. \end{aligned}

For the negative outcome,

i|ψ=(0|+i1|)(2|0+3i|1)26=2+0+0+3i226=126,p(i)=(126)*(126)=126.\begin{aligned} \langle-i|\psi\rangle &=\frac{(\langle0|+i\langle1|)(2|0\rangle+3i|1\rangle)}{\sqrt{26}}\\ &=\frac{2+0+0+3i^2}{\sqrt{26}}=-\frac1{\sqrt{26}},\\ p(-i)&=\left(-\frac1{\sqrt{26}}\right)^* \left(-\frac1{\sqrt{26}}\right)=\frac1{26}. \end{aligned}

A negative amplitude is allowed; a negative probability is not. Each basis has its own normalized distribution:

Basis First outcome Second outcome
Z p(0)=4/13p(0)=4/13 p(1)=9/13p(1)=9/13
X p(+)=1/2p(+)=1/2 p()=1/2p(-)=1/2
Y p(+i)=25/26p(+i)=25/26 p(i)=1/26p(-i)=1/26

Do not add all six probabilities. These are three different experimental choices on freshly prepared copies.

Laboratory L03 — Projection workbench. Start with coefficients 22 and 3i3i. Select Z, X, or Y; reveal the bra, expansion, cancellations, amplitude, and modulus squared. Change the coefficients and sample a chosen number of shots.

3.3 General formulas and a sign check

For normalized α|0+β|1\alpha|0\rangle+\beta|1\rangle,

p(0)=|α|2,p(1)=|β|2,p(0)=|\alpha|^2,\quad p(1)=|\beta|^2, p(±)=|α±β|22=12±Re(α*β),p(\pm)=\frac{|\alpha\pm\beta|^2}{2} =\frac12\pm\operatorname{Re}(\alpha^*\beta), p(±i)=|αiβ|22=12±Im(α*β).p(\pm i)=\frac{|\alpha\mp i\beta|^2}{2} =\frac12\pm\operatorname{Im}(\alpha^*\beta).

Check the Y sign rather than memorizing it:

|αiβ|2=(α*+iβ*)(αiβ)=|α|2+|β|2+i(β*αα*β).|\alpha-i\beta|^2 =(\alpha^*+i\beta^*)(\alpha-i\beta) =|\alpha|^2+|\beta|^2+i(\beta^*\alpha-\alpha^*\beta).

If α*β=u+iv\alpha^*\beta=u+iv, the final term is i((uiv)(u+iv))=i(2iv)=2vi((u-iv)-(u+iv))=i(-2iv)=2v. Divide by two to obtain 1/2+v1/2+v. Real coefficients give balanced Y probabilities; an imaginary relative coefficient need not.

3.4 Consecutive measurements

Prepare |+|+\rangle, measure Z, then measure X. Z gives 0 or 1 equally often. Either conditioned state has balanced X probabilities. Therefore

Pr(final +)=Pr(0)Pr(+0)+Pr(1)Pr(+1)=1212+1212=12.\Pr(\text{final }+) =\Pr(0)\Pr(+\mid0)+\Pr(1)\Pr(+\mid1) =\frac12\frac12+\frac12\frac12=\frac12.

Without the intermediate Z measurement, the final X outcome would be ++ with certainty. Ignoring a measurement record does not undo the physical interaction.

For a projector PmP_m, possibly of higher rank,

p(m)=ψ|Pm|ψ,|ψm=Pm|ψp(m).p(m)=\langle\psi|P_m|\psi\rangle,\qquad |\psi_m\rangle=\frac{P_m|\psi\rangle}{\sqrt{p(m)}}.

Only outcomes with p(m)>0p(m)>0 can be conditioned upon. A projector onto a subspace can retain coherence inside that subspace. Parity checks in quantum error correction exploit this fact.

3.5 Observables and expectation values

If outcomes have numerical values ama_m, define A=mamPmA=\sum_ma_mP_m. Then

A=mamp(m)=ψ|A|ψ.\langle A\rangle=\sum_ma_mp(m)=\langle\psi|A|\psi\rangle.

For Pauli Z, eigenvalues +1,1+1,-1 correspond to |0,|1|0\rangle,|1\rangle. The ket label 0 is not an eigenvalue zero. Our example gives Z=5/13\langle Z\rangle=-5/13, X=0\langle X\rangle=0, and Y=12/13\langle Y\rangle=12/13.

Variance is A2A2\langle A^2\rangle-\langle A\rangle^2. Each Pauli squares to identity, so Var(Z)=1Z2\operatorname{Var}(Z)=1-\langle Z\rangle^2. Incompatible observables lack a shared complete eigenbasis. Their uncertainty is not merely a poorly calibrated detector.

Laboratory L04 — Measurement practice. Generate an integer-coefficient state and requested outcome. Enter a fraction or decimal; request a hint or reveal the derivation step by step.

3.6 Exercises

3.1. Calculate all three-basis probabilities for (3|0+4|1)/5(3|0\rangle+4|1\rangle)/5.

Show solution / guidance

Z: 9/25,16/259/25,16/25. X amplitudes: 7/(52),1/(52)7/(5\sqrt2),-1/(5\sqrt2), giving 49/50,1/5049/50,1/50. Y amplitudes: (34i)/(52)(3\mp4i)/(5\sqrt2), giving 1/2,1/21/2,1/2.

3.2. Replace 3i3i by 3i-3i in the recurring example. What changes?

Show solution / guidance

Z and X probabilities remain unchanged. The imaginary part of α*β\alpha^*\beta changes sign, exchanging Y probabilities: p(+i)=1/26p(+i)=1/26, p(i)=25/26p(-i)=25/26.

3.3. A Z measurement returns 1. What happens on an immediate repeated Z measurement, and if X measurement is inserted?

Show solution / guidance

The conditioned state is |1|1\rangle, so direct repetition returns 1 with certainty. Inserting X leaves |+|+\rangle or ||-\rangle; either gives final Z result 1 with probability 1/21/2.

3.4. Verify orthonormality of |b0=cosη|0+sinη|1|b_0\rangle=\cos\eta|0\rangle+\sin\eta|1\rangle and |b1=sinη|0+cosη|1|b_1\rangle=-\sin\eta|0\rangle+\cos\eta|1\rangle. Find p(b0)p(b_0) for input |0|0\rangle.

Show solution / guidance

Both norms are one and the overlap is cosηsinη+sinηcosη=0-\cos\eta\sin\eta+\sin\eta\cos\eta=0. The projection is cosη\cos\eta, giving probability cos2η\cos^2\eta.

3.5. Find the shot-noise standard deviation of the observed +i+i fraction for the recurring example in 2,600 shots.

Show solution / guidance

(25/26)(1/26)/26000.00377\sqrt{(25/26)(1/26)/2600}\approx0.00377. This describes independent sampling, not preparation or measurement bias.