TITLE: What does it mean for an operator to be diagonal with respect to an orthonormal basis?
QUESTION [5 upvotes]: Suppose that you have a seperable Hilbert space, $H$, an orthonormal basis of $H$, $(e_n)$, and the set $D=\{T\in B(H):T\,\text{is diagonal with respect to the basis}\,(e_n)\}$.
Problem: What, exactly,  does it mean to say that an operator is diagonal with respect to an orthonormal basis?
As a particular example, if you were to take two operators in this space, say, $S,T\in D$, how would you verify that the composition $S\circ T$ was also in $D$? Which properties of an operator being in $D$ would you be checking this product against?

REPLY [3 votes]: This means that the set of vectors $e_i$ are eigenvectors of the operator, i.e. there exists a set of values $\lambda_i$ such that 
$$Te_i = \lambda_i e_i.$$
In your example, suppose that both $S$ and $T$ verify the above, with possibly different eigenvalues $\sigma_i$ and $\tau_i$, then for every vector in your basis you have
$$S(T e_i) = S(\tau_i e_i) = \tau_i Se_i = \tau_i\sigma_i e_i$$
Therefore the composition $ST$ also belongs to your set $D$, with the product of eigenvalues of $S$ and $T$.
Note that I used the word vector but I suppose you understand how to treat general vector spaces. Also, orthonormality is not needed.