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.


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?

  • 1
    $\begingroup$ related: quantumcomputing.stackexchange.com/q/5045/55 $\endgroup$
    – glS
    Feb 11 at 10:38
  • 1
    $\begingroup$ You don't actually need the spectral decomposition of $A$. You can let $|i\rangle$ be any orthonormal basis, and just define the trace to be $\text{Tr}(A)=\sum_i\langle i|A|i\rangle$. $\endgroup$
    – DaftWullie
    Feb 12 at 16:26

2 Answers 2


Your proof is not general, it assumes implicitly that the operator $M|\psi\rangle\langle \phi|$ is diagonalizable (there is a basis of eigenvectors).

You can instead just use basic fact of Trace, namely $\mathrm{Tr}(AB)=\mathrm{Tr}(BA)$.

So $\mathrm{Tr}(M|\psi\rangle\langle \phi|)=\mathrm{Tr}(\langle \phi|M|\psi\rangle)$

But $\langle \phi|M|\psi\rangle \in \mathbb{C}$ is just a scalar so

$\mathrm{Tr}(\langle \phi|M|\psi\rangle)=\langle \phi|M|\psi\rangle$

Edit. More insight

Here is a visual proof for those who are unsure about the formula:

$M|\psi\rangle$ is an operator applied to vector $|\psi\rangle$, the result is a vector which lives in the same state space as $|\psi\rangle$. Let us write the matrix representation in a given basis :

\begin{alignat*}{1} M|\psi\rangle&=\begin{bmatrix} \alpha_1 \\ \alpha_2\\ \vdots\\ \alpha_l\\ \vdots\\ \end{bmatrix} \end{alignat*}

$|\phi\rangle$ is a vector which lives in same state space as $|\psi\rangle$, let its representation be:

\begin{alignat*}{1} |\phi\rangle&=\begin{bmatrix} \beta_1 \\ \beta_2\\ \vdots\\ \beta_l\\ \vdots\\ \end{bmatrix} \end{alignat*}

Its dual vector is represented by the conjugate transpose of the previous column:

\begin{alignat*}{1} \langle\phi|&=\begin{bmatrix} \overline{\beta_1} & \overline{\beta_2} & \dots & \overline{\beta_l} & \dots\\ \end{bmatrix} \end{alignat*}

So now think about what happens when we make the matrix multiplication of a column by a row: we get a square (maybe infinite) matrix

\begin{alignat*}{1} M|\psi\rangle \langle\phi|&=\begin{bmatrix} \alpha_1\overline{\beta_1} & \alpha_1\overline{\beta_1}& \dots &\alpha_1\overline{\beta_i}&\dots&&\\ \alpha_2\overline{\beta_1} & \alpha_2\overline{\beta_2}& \dots &\dots&\dots&&\\ \vdots & & \ddots &&&&\\ \alpha_i\overline{\beta_1} & & &\alpha_i\overline{\beta_i}&&&\\ \vdots & & & &\ddots&&\\ \end{bmatrix} \end{alignat*}

You can check that the trace of the latter is indeed the inner product $\langle\phi|M|\psi\rangle$.

  • $\begingroup$ Thank a lot for yout help ! Indeed it is easier and from far better! $\endgroup$
    – OffHakhol
    Feb 10 at 11:43
  • $\begingroup$ Sorry I have question. You use the property that $Tr(AB)=Tr(BA)$ but $A,B$ are matrixes while it is not the case for $|\phi>$ that you ve moved to left. How did you justify this? $\endgroup$
    – OffHakhol
    Feb 10 at 15:47
  • 2
    $\begingroup$ $|\phi\rangle$ is a matrix: it is a vector and a vector is matrix with 1 column. The formula is valid for any format; of course $AB$ has to be a square matrix. In quantum physics we may have "infinite" matrix, so this is a kind of generalized matrix multiplication. $\endgroup$ Feb 10 at 18:50
  • $\begingroup$ Thk a lot for your editing that add useful information $\endgroup$
    – OffHakhol
    Feb 13 at 10:23

$\newcommand{\bra}[1]{\left<#1\right|}\newcommand{\ket}[1]{\left|#1\right>}\newcommand{\bk}[2]{\left<#1\middle|#2\right>}\newcommand{\bke}[3]{\left<#1\middle|#2\middle|#3\right>}$ If you want to be more rigorous in proving that $$\text{Tr}(M |\psi\rangle\langle\phi|)=\langle\phi| M |\psi\rangle\,,\tag{1}$$ from scratch, without using any identity/formula, a good approach would be to consider everything in terms of the vector and matrix elements as a summation with respect to the basis and then do some algebra, and everything should work out automatically.

Let $\{ \ket{i}\}$ be the basis we are working with. Then, we can write

$$\ket{\psi} = \sum_i a_i \ket{i}\,,\tag2$$ $$\ket{\phi} = \sum_i b_i \ket{i}\,,\tag3$$ $$M = \sum_{ij} m_{ij} \ket{i}\bra{j}\,.\tag4$$

Now, let's first compute RHS of Eq. $(1)$.

\begin{align} \langle\phi| M |\psi\rangle &= \bigg(\sum_i b^*_i \bra{i}\bigg)\cdot\bigg(\sum_{jk} m_{jk} \ket{j}\bra{k}\bigg)\cdot\bigg(\sum_l a_l \ket{l}\bigg)\,,\tag{5.1}\\ &= \sum_{ijkl} b_i^* m_{jk}a_l \langle i|j\rangle \langle k|l\rangle\,,\tag{5.2}\\ &= \sum_{ijkl} b_i^* m_{jk}a_l \cdot \delta_{ij} \cdot \delta_{kl}\,,\tag{5.3}\\ &= \sum_{ik} b_i^* m_{ik}a_k\,.\tag{5.4} \end{align}

Now, conmputing the part inside the trace in the LHS of Eq.$(1)$,

\begin{align} M \ket{\psi} \bra{\phi} &= \bigg(\sum_{jk} m_{jk} \ket{j}\bra{k}\bigg) \cdot \bigg(\sum_l a_l \ket{l}\bigg) \cdot \bigg(\sum_i b^*_i \bra{i}\bigg)\,,\tag{6.1}\\ &= \sum_{ijkl} m_{jk}a_l b^*_i \ket{j} \langle k|l\rangle\bra{i}\,,\tag{6.2}\\ &= \sum_{ijkl} m_{jk}a_l b^*_i \ket{j}\cdot \delta_{kl} \cdot\bra{i}\,,\tag{6.3}\\ &= \sum_{ijk} m_{jk} a_k b^*_i \ket{j} \bra{i}\,.\tag{6.4} \end{align}

Now, taking trace, \begin{align} \text{Tr} (M \ket{\psi} \bra{\phi}) &= \text{Tr}\bigg( \sum_{ijk} m_{jk} a_k b^*_i \ket{j} \bra{i} \bigg)\,,\tag{7.1}\\ &= \sum_{x} \bra{x} \bigg( \sum_{ijk} m_{jk} a_k b^*_i \ket{j} \bra{i} \bigg) \ket{x}\,,\tag{7.2}\\ &= \sum_{xijk} m_{jk} a_k b^*_i \langle x | j \rangle \langle i | x \rangle\,,\tag{7.3}\\ &= \sum_{xijk} m_{jk} a_k b^*_i \cdot \delta_{xj} \cdot\delta_{ix}\,,\tag{7.4}\\ &= \sum_{ik} m_{ik} a_k b^*_i \tag{7.5}\,. \end{align}

Comparing Eq. $(5.4)$ and $(7.5)$, we can conclude that we have proved Eq. $(1)\,.$


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.