# Expectation value of pure state in quantum mechanics

It's well known that in quantum mechanics, the expectation value of a self-adojint operator $A$ in pure state $|\psi\rangle$ is $\langle\psi |A|\psi\rangle = \operatorname{Tr}(A |\psi \rangle \langle\psi |)$. My question is: why this equality holds? I can't see it. I am also unable to find the proof anywehere...

-
This is an application of the cyclic invariance of the trace: $\langle\psi |A|\psi\rangle = \operatorname{Tr}(\langle\psi |A|\psi\rangle)=\operatorname{Tr}(A |\psi \rangle \langle\psi |)$. Are you familiar with that property? –  joriki Apr 12 '13 at 14:17

I'll prove the following fact which you may find useful in general: Let $A$ and $B$ be two matrices. If either of the products $AB$ or $BA$ is well-defined and square, then they both are, and $\mathrm{Tr}(AB)=\mathrm{Tr}(BA)$.
Proof: That $AB$ is well-defined and square means that $B$ is the same shape as the transpose of $A$, so $BA$ is also well-defined and square. So let $A$ have dimensions $m\times n$ and $B$ have dimensions $n\times m$. Then the trace of $AB$ is $\sum_{i=1}^m (AB)_{ii} = \sum_{i=1}^m\sum_{j=1}^n a_{ij} b_{ji}$, and interchanging the order of summations we get $\sum_{j=1}^n \sum_{i=1}^m b_{ji}a_{ij} = \sum_{j=1}^n(BA)_{jj}$, which is the trace of $BA$.
In your case, you just need to apply this result to the matrices $\langle\psi|$ and $A|\psi\rangle$: you obtain $\mathrm{Tr}(A|\psi\rangle\langle\psi|) = \mathrm{Tr}(\langle\psi|A|\psi\rangle) = \langle\psi|A|\psi\rangle$, since the latter is just a number.