# From diagonalizing bases for matrices A and B, how do I find one basis that diagonalizes both matrices?

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.

• I've deleted my answer because I think it only works for symmetric matrices. I'll rethink it and let you know. Aug 10 '15 at 22:27
• Ah, ok, got it. Thanks for the quick response, @joriki. I will do some more work on this before moving on to new problems. And unfortunately, I have not seen discussions on this topic on MSE that talk about finding an explicit basis -- the questions and answers I have found are mainly proving the claim of simultaneous diagonalizability. Aug 10 '15 at 22:30

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$.