Question:
I am studying alone, and I found p.76 of the book quantum computation and quantum information of nielsen &c huang that: $$\text{Tr}(M |\psi\rangle \langle\psi)=\langle\psi| M |\psi\rangle\,.$$
I want to be sure that my understanding of the formula is correct by proving a more general expression: $$\text{Tr}(M |\psi\rangle\langle\phi|)=\langle\phi| M |\psi\rangle\,,$$ with $M$ an operator is correct.
Answer:
1- We know that $$\text{Tr}(A) = \sum_i \lambda_i\,,$$ with $\lambda_i$ all the eigenvalues of $A$. Hence with $|i\rangle$ the eigenvector associated to the eigenvalue $\lambda_i$ we can write that $$\text{Tr}(A) = \sum_i \langle i|A|i\rangle \text{  as      }\,\,\, A|i\rangle=\lambda_i |i\rangle\,.$$
Rem: To simplify the scripture I suppose that to each eigenvalue match only one eigenvector (I do not think that it will change a lot my demonstration in the case this is not the case).
2- By identifying $A=M |\psi\rangle\langle\phi|$ we can then write (with $|i\rangle$ the eigenvectors of $M |\psi\rangle \langle\phi|$), $$\begin{align} \text{Tr}(M |\psi\rangle \langle\phi|) &= \sum_i \langle i|M |\psi\rangle \langle\phi|i\rangle\\ &= \sum_i \langle\phi|i\rangle \langle i|M |\psi\rangle\\ &= \langle \phi| \bigg(\sum_i |i\rangle \langle i| \bigg) M |\psi\rangle \,. \end{align}$$ The term $\sum_i ∣i⟩⟨i∣ = I$ is the identity operator since it represents a sum over a complete set of projectors onto an orthonormal basis.
3- Hence we get $$\text{Tr}(M |\psi \rangle \langle\phi|)=\langle\phi| M |\psi \rangle\,.$$
Is this correct? Did I forgot to write some conditions in order to make my prove more precise?
 
     
    