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=(0ii0),Z=(1001)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ψ=αβ+βα=2Re(αβ)\langle X \rangle = \langle\psi|X|\psi\rangle = \alpha^* \beta + \beta^* \alpha = 2\,\text{Re}(\alpha^*\beta)

Y expectation:

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

Special States

StateZ\langle Z \rangleX\langle X \rangleY\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)$001-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θ20+eiϕsinθ21|\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.