Lesson 13 of 15

Pauli Expectation Values

Pauli Expectation Values

The expectation value of an observable HH in quantum state ∣ψ⟩|\psi\rangle is:

⟨H⟩=⟨ψ∣ H ∣ψ⟩\langle H \rangle = \langle\psi|\, H\, |\psi\rangle

This is the average outcome of measuring HH many times when the system is in state ∣ψ⟩|\psi\rangle. Expectation values are the fundamental output of variational quantum algorithms such as VQE and QAOA.

The Pauli Matrices

Every single-qubit Hermitian observable can be written as a linear combination of the three Pauli matrices and the identity:

X=(0110),Y=(0−ii0),Z=(100−1)X = \begin{pmatrix}0 & 1 \\ 1 & 0\end{pmatrix}, \qquad Y = \begin{pmatrix}0 & -i \\ i & 0\end{pmatrix}, \qquad Z = \begin{pmatrix}1 & 0 \\ 0 & -1\end{pmatrix}

Each has eigenvalues ±1\pm 1.

Computing Expectation Values

For a qubit state ∣ψ⟩=α∣0⟩+β∣1⟩|\psi\rangle = \alpha|0\rangle + \beta|1\rangle, write out the matrix products:

Z expectation:

⟨Z⟩=⟨ψ∣Z∣ψ⟩=∣α∣2−∣β∣2\langle Z \rangle = \langle\psi|Z|\psi\rangle = |\alpha|^2 - |\beta|^2

This is simply the probability of measuring ∣0⟩|0\rangle minus the probability of measuring ∣1⟩|1\rangle.

X expectation:

⟨X⟩=⟨ψ∣X∣ψ⟩=α∗β+β∗α=2 Re(α∗β)\langle X \rangle = \langle\psi|X|\psi\rangle = \alpha^* \beta + \beta^* \alpha = 2\,\text{Re}(\alpha^*\beta)

Y expectation:

⟨Y⟩=⟨ψ∣Y∣ψ⟩=i(β∗α−α∗β)=2 Im(α∗β)\langle Y \rangle = \langle\psi|Y|\psi\rangle = i(\beta^*\alpha - \alpha^*\beta) = 2\,\text{Im}(\alpha^*\beta)

Special States

State⟨Z⟩\langle Z \rangle⟨X⟩\langle X \rangle⟨Y⟩\langle Y \rangle
$0\rangle = (1, 0)$+1+100
$1\rangle = (0, 1)$−1-100
$+\rangle = \frac{1}{\sqrt{2}}(1, 1)$00+1+1
$-\rangle = \frac{1}{\sqrt{2}}(1, -1)$00−1-1
$+i\rangle = \frac{1}{\sqrt{2}}(1, i)$0000

These correspond exactly to the six face-centres of the Bloch sphere: states aligned with the positive and negative XX, YY, and ZZ axes have expectation value +1+1 or −1-1 along their axis and 00 along the others.

Bloch Sphere Connection

A pure state on the Bloch sphere at polar angle θ\theta and azimuthal angle ϕ\phi is:

∣ψ⟩=cos⁡θ2∣0⟩+eiϕsin⁡θ2∣1⟩|\psi\rangle = \cos\frac{\theta}{2}|0\rangle + e^{i\phi}\sin\frac{\theta}{2}|1\rangle

Its Pauli expectation values give the Cartesian coordinates of the Bloch vector:

⟨X⟩=sin⁡θcos⁡ϕ,⟨Y⟩=sin⁡θsin⁡ϕ,⟨Z⟩=cos⁡θ\langle X \rangle = \sin\theta\cos\phi,\qquad \langle Y \rangle = \sin\theta\sin\phi,\qquad \langle Z \rangle = \cos\theta

Your Task

Implement pauli_expectation(state, pauli) where state is a 2-element list [α,β][\alpha, \beta] (possibly complex) and pauli is 'X', 'Y', or 'Z'. Return the real-valued expectation value.

Python runtime loading...
Loading...
Click "Run" to execute your code.