The first matrix A has eigenvectors
(0,1,0), (2,0,1), (1,0,1)
The second matrix B has eigenvectors
(4,1,2), (1,1,0), (1,0,1).
Both sets form a basis for $R^3$.
Now, how do I pick out a basis of eigenvectors that simultaneously diagonalizes A and B?
I've searched on MSE but have only found proof-y discussions of this topic, but I want to find an explicit basis.
Thanks,
EDIT: I tried putting all six vectors in a matrix, each in a row, and row reduced until I got 3 linearly independent vectors. I used this as S, computed the inverse, but then $S^{-1}AS$ is not diagonal anymore...almost diagonal, though - off by one non-zero entry, with all of A's eigenvalues still on the diagonal. So, I'm pretty close, I think.
EDIT 2:
The matrices are:
$$ A= \begin{bmatrix} 0 & 0 & 2 \\ 0 & 1 & 0 \\ -1 & 0 & 3 \\ \end{bmatrix} $$
and
$$ B= \begin{bmatrix} 0 & 4 & 4 \\ -1 & 5 & 1 \\ -2 & 2 & 6 \\ \end{bmatrix} $$
Eigenvalues for A are 1,2 -- with 1 having geometric multiplicity = 2.
Eigenvalues for B are 3, 4 -- with 4 having geometric multiplicity = 2.
The matrix $A$ has the eigenspaces (according to your computation) $$ E_1(A)=span\left( \pmatrix{0\\1\\0}, \pmatrix{2\\0\\1}\right), E_2(A)=span \pmatrix{1\\0\\1}, $$ while $B$ has the eigenspaces $$ E_4(B)=span\left( \pmatrix{1\\1\\0}, \pmatrix{1\\0\\1}\right), E_3(B)=span \pmatrix{4\\1\\2}. $$ The goal is to find a basis of common eigenvectors. That is, to find vectors that are in eigenspaces of $A$ and of $B$.
Clearly, $\pmatrix{1\\0\\1} \in E_2(A)\cap E_4(B)$, $\pmatrix{4\\1\\2}\in E_1(A)\cap E_3(B)$, $\pmatrix{2\\1\\1}\in E_1(A)\cap E_4(B)$.
Moreover, these vectors are linearly independent, and as such from a basis of eigenvectors of both $A$ and $B$.