Solve this BEFORE lesson.md. Day 3 is qiskit.quantum_info — the module that is the math. Everything here maps 1:1 onto a class you'll use: Pauli, SparsePauliOp, Statevector, Operator, DensityMatrix, partial_trace, state_fidelity.
Requires: Day 1–2 math prep. Video back-up: Watrous Lessons 01–02 and (deeper, optional) Lesson 09 Density Matrices; notes in resource-artifactory/notes/video-notes/.
Reversed order flips the sign: YX=−iZ, etc. So distinct Paulis anticommute: XY=−YX.
Every product of Paulis is again a Pauli times a phase from {±1,±i} — that's why Pauli objects in Qiskit carry a phase and print things like -iY. Multi-qubit Paulis are tensor strings like Z⊗I⊗X = "ZIX" (little-endian trap: in the string "ZIX", the RIGHTMOST letter is qubit 0 — so X acts on q0, I on q1, Z on q2).
Commutation of Pauli strings: count the positions where the two strings differ and neither is I. Odd count ⇒ anticommute; even ⇒ commute. (Pauli.commutes does exactly this.)
A projector satisfies Π2=Π=Π†. Measurement probability via projectors: P(x)=⟨ψ∣Πx∣ψ⟩ — same Born rule, new clothes. Spectral theorem: every Hermitian A=∑jλjΠj (eigenvalues × projectors), e.g. Z=(+1)∣0⟩⟨0∣+(−1)∣1⟩⟨1∣.
Properties: ρ†=ρ, ρ⪰0, Tr(ρ)=1. Purity=Tr(ρ2): equals 1 iff pure; minimum 1/2n for the maximally mixed state I/2n.
∣+⟩⟨+∣=21(1111) — pure superposition: off-diagonals present (coherence).
21I — 50/50 classical mixture: no off-diagonals, purity 21.
Both give 50/50 Z-measurements; only ∣+⟩ gives deterministic X-measurements. That's the entire pure-vs-mixed distinction.
Born rule and expectations in ρ-form: P(x)=Tr(Πxρ), ⟨A⟩=Tr(Aρ).
(Qiskit's state_fidelity uses the squared-overlap convention: 1 = same state, 0 = orthogonal. Watrous's book uses the square root of this — beware when cross-reading.) Global phase drops out: F(∣ψ⟩,eiγ∣ψ⟩)=1. Example: F(∣0⟩,∣+⟩)=∣⟨0∣+⟩∣2=21.
P1. Compute XZ and express it as a phase times a Pauli. Do X and Z commute or anticommute?
P2. Do the Pauli strings "XX" and "ZZ" commute? "XI" and "ZZ"? (Use the differ-and-not-I counting rule.)
P3. Is T Hermitian? Is it unitary? What are its eigenvalues?
P4. Write the projector onto ∣−⟩ as a 2×2 matrix and verify Π2=Π.
P5. Compute ⟨X⟩ for ∣ψ⟩=cos2θ∣0⟩+sin2θ∣1⟩ (real amplitudes).
P6. For the Bell state ∣Φ+⟩, compute ⟨Z⊗Z⟩ and ⟨Z⊗I⟩ from the outcome probabilities.
P7. Write ρ for the classical mixture "70% ∣0⟩, 30% ∣1⟩" and for the pure state 0.7∣0⟩+0.3∣1⟩. Which matrix entries differ? Compute both purities.
P8. Show Trq0(∣Φ+⟩⟨Φ+∣)=21I by expanding ∣Φ+⟩⟨Φ+∣ and applying the keep-matching-B-indices rule.
P9. Compute state_fidelity between ∣+⟩ and ∣+i⟩=21(∣0⟩+i∣1⟩).
P10. The exam asks: "Which is true of ρ=I/2?" — (a) it's a pure superposition, (b) measuring in ANY basis gives 50/50, (c) it equals ∣+⟩⟨+∣. Pick and justify.
A1.XZ=(01−10)=−iY. And ZX=iY=XZ ⇒ they anticommute (XZ=−ZX).
A2."XX" vs "ZZ": differ at 2 positions ⇒ even ⇒ commute (both are symmetries of the Bell basis). "XI" vs "ZZ": differ at 1 non-identity position ⇒ odd ⇒ anticommute.
A3.T†=diag(1,e−iπ/4)=T ⇒ not Hermitian. T†T=I ⇒ unitary. Eigenvalues: 1 and eiπ/4 (it's diagonal).
A5.⟨ψ∣X∣ψ⟩=2cos2θsin2θ=sinθ. Sanity check at θ=π/2: the state is ∣+⟩... no — at θ=π/2 the state is cos4π∣0⟩+sin4π∣1⟩=∣+⟩ and sin(π/2)=1=⟨X⟩∣+⟩. ✓
A6.ZZ outcomes: ∣00⟩,∣11⟩ each prob 21, bits always equal ⇒ eigenvalue +1 always ⇒ ⟨ZZ⟩=1. Single qubit is uniformly random ⇒ ⟨Z⊗I⟩=21(+1)+21(−1)=0.
A7.ρmix=(0.7000.3); ρpure=(0.70.210.210.3). Difference: the off-diagonal coherences (0.21≈0.458). Purities: mix 0.49+0.09=0.58; pure =1 (check: 0.49+0.09+2⋅0.21=1 ✓).
A8.∣Φ+⟩⟨Φ+∣=21(∣00⟩⟨00∣+∣00⟩⟨11∣+∣11⟩⟨00∣+∣11⟩⟨11∣). Tracing out q0 kills the cross terms (q0 bra ≠ q0 ket) and leaves 21(∣0⟩⟨0∣+∣1⟩⟨1∣)=21I on q1. ∎
A9.⟨+∣+i⟩=21(1+i), so F=21+i2=42=21.
A10.(b).P(x)=Tr(Πx2I)=21 for any rank-1 projector, in every basis. (a),(c) false: I/2 has purity 21 (mixed); ∣+⟩⟨+∣ has off-diagonals.
Self-check: you can multiply any two Paulis with the right phase, compute ⟨Pauli⟩ for the standard states instantly, tell pure from mixed by looking at a density matrix, and state why a Bell state's reduced state is I/2.