This is from Nielson and Chuang's textbook "Quantum Computation and Quantum Information".
They state the Simultaneous Diagonalisation Theorem: Suppose $A$ and $B$ are Hermitian operators. Then $[A,B]=AB - BA = 0$ iff there exists an orthonormal basis such that both $A$ and $B$ are diagonal with respect to that basis.
In the proof of this theorem, they say "you can easily verify that if $A$ and $B$ are diagonal in the same orthonormal basis, then $[A,B]=AB-BA=0$.
I think you could prove this by letting $U$ be a unitary operator performing the change of basis from orthonormal to canonical basis. Then $A = UDU^{*}$ and $B=UEU^{*}$ Then $$AB=UDU^{*}UEU^{*}=UDEU^{*}=UEDU^{*}=UEU^{*}UDU^{*}=BA$$ ($D$ and $E$ are diagonal)
$\newcommand\bra[1]{\left\langle#1\right|}\newcommand\ket[1]{\left|#1\right\rangle} $ However, the notation the book specifies is the diagonal representation $A=\sum_{i} a_{i} \ket{i} \bra{i}$ and $B = \sum_{i} b_{i} \ket{i} \bra{i}$ where $\ket{i}$ is some common orthonormal set of eigenvectors for $A$ and $B$. How do I prove that if $A$ and $B$ are diagonal, then $[A,B]=0$ using this notation?