# Problem understanding expectation value of operators defined with density operator in quantum mechanics

I have a problem in understanding why we can write the expectation value of an operator $$\hat{O}$$ as the trace of $$\hat{\rho}\hat{O}$$ where $$\hat{\rho}$$ is the density matrix defined for pure state.

at page 2, after equation $$(8)$$, I read the following: $$\langle\hat{O}\rangle= \sum_{m}^{} \sum_{n}^{} a_m^*a_n Q_{mn}= \sum_{m}^{} \sum_{n}^{} \rho_{nm} Q_{mn}= \sum_{n}^{} [\rho Q]_{nn} \quad .$$

I can't understand the last passage, why do we pass from a double sum to a single sum just over $$n$$?

Here $$Q_{mn}$$ are the matrix elements of the operator $$Q$$ with respect to an orthonormal basis $${u_m,u_n,...}$$ and $$\rho_{nm}$$ are the matrix elements of the density matrix again with respect to the same basis, $$a_m=\langle u_m|\psi\rangle$$ and $$u_n=\langle\psi|u_n\rangle$$ and $$\rho=|\psi\rangle\langle\psi|$$.

• Hint: Make use of the completeness relation for a ONB (in Dirac Notation): $\mathbb I =\sum_m |m\rangle \langle m|$. May 13 at 19:28

For two matrices $$M$$ and $$N$$, the definition of matrix multiplication is $$[MN]_{ab}= \sum_c M_{ac} N_{cb}$$
In this case, $$\sum_n \underbrace{\left(\sum_m \rho_{nm}Q_{mn}\right)}_{= [\rho Q]_{nn}}= \sum_n [\rho Q]_{nn} = \mathrm{Tr}(\rho Q)$$
• With $[MN]_{ab}$ do you mean the $ab$ element of the matrix that is the product of $M$ and $N$? May 13 at 20:53