# Why is the trace of the outer product of two states equal to the inner product of the two states?

Why is it that, given two quantum states $$|\psi_1\rangle$$, $$|\psi_2\rangle$$, $$\mathrm{Tr}(|\psi_1\rangle\langle\psi_2|) = \langle\psi_2|\psi_1\rangle \quad$$ I went through the equation with the qubit space $$\mathcal{H}=\{|0\rangle,|1\rangle\}$$ and saw that the maths checks out, but I'm lacking any deeper understanding or intuition.

The calculation itself takes one line. Letting $$|n\rangle$$ be an arbitrary orthonormal basis, we have

$$\mathrm{Tr}\left(|\psi_1\rangle\langle \psi_2|\right)= \sum_n \langle n|\psi_1\rangle\langle \psi_2|n\rangle = \sum_n\langle \psi_2|n\rangle\langle n|\psi_1\rangle$$ $$= \langle \psi_2|\left( \sum_n |n\rangle\langle n| \right)|\psi_1\rangle = \langle \psi_2|\psi_1\rangle$$

As far as intuition goes, the trace of an operator is equal to the sum of its eigenvalues. The eigenvalue equation for this operator is $$|\psi_1\rangle\langle \psi_2|\phi\rangle = \lambda |\phi\rangle \implies \langle \psi_2|\psi_1\rangle\langle \psi_2|\phi\rangle = \lambda \langle \psi_2|\phi\rangle$$ $$\implies \bigg(\langle \psi_2|\psi_1\rangle -\lambda\bigg) \langle \psi_2|\phi\rangle = 0$$

So either $$\lambda = \langle \psi_2|\psi_1\rangle \implies |\phi\rangle = |\psi_1\rangle$$ or $$\langle \psi_2|\phi\rangle = 0$$, in which case $$\lambda = 0$$. We can therefore conclude that if $$|\psi_1\rangle$$ and $$|\psi_2\rangle$$ are orthogonal, then all of the operator's eigenvalues (and therefore its trace) are zero; if they are not orthogonal, then the operator's single non-zero eigenvalue (and again, therefore its trace) is equal to $$\langle \psi_2|\psi_1\rangle$$.

• Example of something that takes one line but needs 3 lines for readability: Zagier's one-sentence proof Nov 25, 2022 at 17:51

Traces are invariant under cyclical rotation. I.e. \begin{align} \mathrm{Tr}(ABCD) = \mathrm{Tr}(DABC) = \mathrm{Tr}(CDAB) = \mathrm{Tr}(BCDA) \end{align}

This holds for any number of matrices, and the individual matrices do not need to be square. Just their product must be square.

In the physics setting you should interpret $$|\psi_1\rangle$$ as a column vector (i.e. a tall, narrow matrix), and $$\langle\psi_2|$$ as a row vector (i.e. a flat, wide matrix). Furthermore $$\langle\psi_2|\psi_1\rangle$$ is just a number (i.e. a $$1\times 1$$ matrix), so we can write \begin{align} \mathrm{Tr}(|\psi_1\rangle\langle\psi_2|) = \mathrm{Tr}(\langle\psi_2|\psi_1\rangle)=\langle\psi_2|\psi_1\rangle \end{align}

It is actually a somewhat common trick in physics (for example when computing Feynman diagrams in QFT), to surround a single number with a $$\mathrm{Trace}()$$ and then cycle the terms around.