Out of interest I was trying to derive some properties of commutators in quantum mechanics. I found that, in my calculations, will have an all-zeroes main diagonal. I must be making a mistake, because the canonic commutation relation is proportional to the identity operator:$$[\hat{x}, \hat{p}] = \hat{x}\hat{p} - \hat{p}\hat{x} = i\hbar\hat{I},$$which only has non-zero values on its main diagonal.
My question is, can someone spot the mistake that I am making? I would really appreciate that. This problem has been bugging me for some weeks now! I use relatively little assumptions, I think. I'm not a mathematician by training.
My reasoning is as follows. Let's have two Hermitian operators, $\hat{a}$ and $\hat{b}$. I make this assumption because operators associated with observables have to be Hermitian, to guarantee real-valued measurement results. Both can be expressed in their respective eigenbases as:$$\hat{a}=\sum_ia_i|a_i\rangle\langle a_i|,\\\hat{b}=\sum_ib_i|b_i\rangle\langle b_i|,$$where $a_i$ and $b_i$ are real valued for all $i$, since $\hat{a}$ and $\hat{b}$ are Hermitian. Let's use the eigenbasis of $\hat{a}$. Then, $\hat{b}$ can be expressed in the eigenbasis of $\hat{a}$ like:$$\hat{b}= \hat{I}\hat{b}\hat{I} = \bigg(\sum_i | a_i \rangle\langle a_i |\bigg) \hat{b} \bigg(\sum_j | a_j \rangle\langle a_j |\bigg) = \sum_{ij}\langle a_i|\hat{b}| a_j \rangle | a_i \rangle\langle a_j |.$$ The commutator of $\hat{a}$ and $\hat{b}$ is defined by:$$[\hat{a}, \hat{b}] \equiv \hat{a}\hat{b} - \hat{b}\hat{a}.$$ Tackling both terms one at a time, gives:$$\hat{a}\hat{b} = \bigg(\sum_k a_k|a_k \rangle\langle a_k|\bigg)\bigg(\sum_{ij}\langle a_i|\hat{b}| a_j \rangle | a_i \rangle\langle a_j |\bigg) = \sum_{ij}a_i\langle a_i|\hat{b}| a_j \rangle | a_i \rangle\langle a_j |,\\\hat{b}\hat{a} = \bigg(\sum_{ij}\langle a_i|\hat{b}| a_j \rangle | a_i \rangle\langle a_j |\bigg)\bigg(\sum_k a_k|a_k \rangle\langle a_k|\bigg) = \sum_{ij}a_j\langle a_i|\hat{b}| a_j \rangle | a_i \rangle\langle a_j |.$$
Thus the commutator is found to be:$$[\hat{a}, \hat{b}] = \sum_{ij}(a_i - a_j)\langle a_i|\hat{b}| a_j \rangle | a_i \rangle\langle a_j |,$$which can be seen to be skew-Hermitian, because:$$\langle a_i|[\hat{a}, \hat{b}]| a_j \rangle = (a_i - a_j)\langle a_i|\hat{b}| a_j \rangle = -(a_j - a_i)\langle a_j|\hat{b}| a_i \rangle^* = -\big((a_j - a_i)\langle a_j|\hat{b}| a_i \rangle\big)^* = -\langle a_j |[\hat{a}, \hat{b}]| a_i \rangle^*.$$In the second equality I used the assumption that $\hat{b}$ is Hermitian.
Many thanks for reading this! I hope my explanation was clear!