Writing trace of a linear operator in terms of inner products

linear algebratrace

This fact may be obvious, but say that I have a linear operator $T: V \to V$, where $V$ is finite-dimensional, and an orthonormal basis $\{e_1, \ldots, e_n\}$ for $V$. I want to write an expression for the trace of $T$, which is supposed to take the form
\begin{align*}
\text{trace}(T) = \langle Te_1, e_1 \rangle + \ldots + \langle Te_n, e_n\}.
\end{align*}

I am trying to understand why this holds in general. If this were the standard basis for $\mathbb{R}^n$ and we were using the standard dot product, $\langle Te_i, e_i \rangle$ would give the $i$th entry of the $i$th column, and summing would therefore sum the diagonal of the matrix. But that doesn't generalize to any basis and any inner product.

Best Answer

Orthonormal expansion says that $$x = \sum_{k=1}^n \langle x,e_k\rangle e_k$$for all $x \in V$, provided the basis $\mathcal{B} = (e_k)_{k=1}^n$ is orthonormal (proof: write $x = \sum_{i=1} x_ie_i$ for some coefficients $x_i$ and hit both sides with $\langle \cdot, e_k\rangle$ to obtain $x_k = \langle x,e_k\rangle$). That said, you should recall how the trace is defined:

  1. pick any basis $\mathcal{B}$ for $V$.
  2. write each $T(e_j)$ as a combination $\sum_{i=1}^k a_{ij} e_i$, so that you have a matrix $[T]_{\mathcal{B}} = (a_{ij})_{i,j=1}^n$.
  3. define ${\rm tr}(T) = {\rm tr}[T]_{\mathcal{B}}$, where in the right we have a matrix trace.
  4. show that the definition above does not depend on the choice of $\mathcal{B}$, by using that the matrix trace is invariant under conjugation.

Now you just want to exploit the fact that the chosen $\mathcal{B}$ is orthonormal. Orthonormal expansion gives $$T(e_j) = \sum_{i=1}^n \langle T(e_j),e_i\rangle e_i.$$So $[T]_{\mathcal{B}} = (\langle T(e_j),e_i\rangle)_{i,j=1}^n$. Then $${\rm tr}(T) = \sum_{i=1}^n \langle T(e_i),e_i\rangle.$$

If the basis is not orthonormal, one needs to write $g_{ij} = \langle e_i,e_j\rangle$ (and $(g_{ij})_{i,j=1}^n$ is no longer necessarily the identity matrix). Then $$x = \sum_{i=1}^n x_i e_i \implies \langle x,e_j\rangle = \sum_{i=1}^n x_i g_{ij} \implies x_i = \sum_{j=1}^n g^{ij}\langle x,e_j\rangle,$$where $(g^{ij})_{i,j=1}^n$ is the inverse matrix of $(g_{ij})_{i,j=1}^n$. So in general we'll have $${\rm tr}(T) = \sum_{i,j=1}^n g^{ij}\langle T(e_i),e_j\rangle.$$This is not a mistake: the trace is given in terms of the inner product by a double sum, which now accounts for the fact that the basis may be non-orthonormal.

Related Question