If $(e_1,…,e_n)$ is an orthonormal basis, why does $\operatorname{trace}(T) =\langle Te_1,e_1\rangle +\cdots+\langle Te_n,e_n\rangle $?

If $(e_1,…,e_n)$ is an orthonormal basis, why does $\operatorname{trace}(T) =\langle Te_1,e_1\rangle +\cdots+\langle Te_n,e_n\rangle $?

I can derive it via matrices but is there a better way of understanding it? Thank you!

Solutions Collecting From Web of "If $(e_1,…,e_n)$ is an orthonormal basis, why does $\operatorname{trace}(T) =\langle Te_1,e_1\rangle +\cdots+\langle Te_n,e_n\rangle $?"

Since we have an orthonormal basis, we (ought to) know that

$$\forall\,x\in V\;,\;\;x=\sum_{k=1}^n\langle x,e_k\rangle e_k$$

Using the above and since the trace is an invariant of an operator, let us check what the matrix representation of $\;T\;$ wrt the basis $\;\{e_1,…,e_n\}\;$ is:

$$Te_i=\sum_{k_1}^n\langle Te_i,e_k\rangle e_k$$

and from here we get at once what we want.

Because for an othogonal basis $B=(e_1,\ldots,e_n)$, the coordinate function for $e_i$ is $x\mapsto\langle x,e_i\rangle$. (You can see by taking for $x$ any linear combination of $e_1,\ldots,e_n$, and checking that this extracts the coefficient of $e_i$.) Then $\langle Te_i,e_i\rangle$ is the $i$-th coordinate of the vector $Te_i$ when expressed in the basis$~B$. The list of all such coordinates of $Te_i$ form column$~i$ of the matrix for $T$ in the basis$~B$, so this is taking the $i$-th diagonal entry, and summing just gives the trace of that matrix.