I have 3 diagonalizable matrices $A,B,C$. They commute with each other $[A,B]=[B,C]=[A,C]=0$
[edit] The matrix $A$ is Hermitian but $B$ and $C$ have no properties. [/edit]
I can get the eigenvalues of $A$ : $a_{i\alpha_i}$. The index $i$ labels different eigenvalues. The index $\alpha_i$ lists all equal eigenvalue for a given $i$.
If an eigenvalue is degenerate $\alpha_i=\{1,2,\dots\}$, if it's unique $\alpha_i=1$.
If I'm not wrong, if the $i$th eigenvalue is not degenerate, the corresponding eigenvector is also an eigenvector of $B$ and $C$.
Now, let's say the $i$th eigenvalue is degenerate. I can have a basis of eigenvectors for this subspace $v_{i\alpha}$. With this eigenvectors I can create a matrix $M_{\alpha\beta} = v_{i\alpha}^T B v_{i\beta}$. By diagonalizing $B$, I can get the eigenvalues of the $B$ operator and then compute new eigenvectors of $A$ and $B$ : $w_{i\beta} = \sum_{\alpha} m_{\beta}^{\alpha}v_{\alpha}$ where $m_{\beta}^{\alpha}$ is the $\alpha$th component of the $\beta$th eigenvector of $M$.
At the end of this operation, I'm left with a set of eigenvectors that diagonalizes $A$ and $B$.
[edit] I just realized that this new set is not orthogonal. [/edit]
My main question comes now. I think I managed to find a correct set of eigenvectors because when I run a code that uses the method explained above, I get the correct result. But when I use the same procedure to diagonalize the third matrix, $C$, my code gives wrong result.
The matrices have been requested, so here they are (for this 12x12 matrix, $A$, $B$ and $C$ are symmetrical, but I'm looking for a solution that works for matrices with the above properties) :
A =
0 1 1 0 1 0 0 0 1 0 0 0
1 0 1 1 0 0 0 0 0 0 0 1
1 1 0 0 0 0 1 0 0 0 1 0
0 1 0 0 1 1 0 0 0 0 0 1
1 0 0 1 0 1 0 0 1 0 0 0
0 0 0 1 1 0 0 1 0 1 0 0
0 0 1 0 0 0 0 1 1 0 1 0
0 0 0 0 0 1 1 0 1 1 0 0
1 0 0 0 1 0 1 1 0 0 0 0
0 0 0 0 0 1 0 1 0 0 1 1
0 0 1 0 0 0 1 0 0 1 0 1
0 1 0 1 0 0 0 0 0 1 1 0
B=
0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0
C=
0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0 0