|q⟩ Bad Qubits

intermediate · Physics · Density Matrices & Mixed States

Expectation Values with ρ

The density operator turns expectation values into a single, basis-independent formula that works for pure and mixed states alike.

The master formula

For any observable AA (a Hermitian operator) and any state ρ\rho,

A=Tr(ρA).\langle A\rangle = \operatorname{Tr}(\rho A).

That one trace replaces the pure-state expression ψAψ\langle\psi|A|\psi\rangle and the ensemble average ipiψiAψi\sum_i p_i \langle\psi_i|A|\psi_i\rangle — both are special cases.

Why it works

Start from the ensemble average over the pure states making up ρ\rho:

A=ipiψiAψi.\langle A\rangle = \sum_i p_i \langle\psi_i|A|\psi_i\rangle.

Use the cyclic property of the trace, ψiAψi=Tr(Aψiψi)\langle\psi_i|A|\psi_i\rangle = \operatorname{Tr}\big(A|\psi_i\rangle\langle\psi_i|\big). Pull the sum inside the (linear) trace:

A=Tr ⁣(Aipiψiψi)=Tr(Aρ)=Tr(ρA).\langle A\rangle = \operatorname{Tr}\!\Big(A \sum_i p_i |\psi_i\rangle\langle\psi_i|\Big) = \operatorname{Tr}(A\rho) = \operatorname{Tr}(\rho A).

The last equality again uses cyclicity, Tr(Aρ)=Tr(ρA)\operatorname{Tr}(A\rho) = \operatorname{Tr}(\rho A). The result depends only on ρ\rho, never on which ensemble produced it — exactly the ambiguity-free behavior we wanted.

Reading off probabilities

Measurement probabilities are a special case. The probability of outcome kk with projector Pk=kkP_k = |k\rangle\langle k| is

p(k)=Tr(ρPk)=kρk=ρkk.p(k) = \operatorname{Tr}(\rho P_k) = \langle k|\rho|k\rangle = \rho_{kk}.

So the diagonal entries of ρ\rho are precisely the computational-basis outcome probabilities — which is why we called them populations.

Try it

For the mixed state ρ=(3/41/41/41/4)\rho = \begin{pmatrix}3/4 & 1/4\\ 1/4 & 1/4\end{pmatrix}, compute Z=Tr(ρZ)\langle Z\rangle = \operatorname{Tr}(\rho Z) with Z=(1001)Z = \begin{pmatrix}1 & 0\\ 0 & -1\end{pmatrix}. The answer is the difference of the two populations.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.