# How to diagonalize matrices with repeated eigenvalues?

Consider the matrix $$A=\begin{pmatrix}q & p & p\\p & q & p\\p & p & q\end{pmatrix}$$ with $p,q\neq 0$. Its eigenvalues are $\lambda_{1,2}=q-p$ and $\lambda_3=q+2p$ where one eigenvalue is repeated. I'm having trouble diagonalizing such matrices. The eigenvectors $X_1$ and $X_2$ corresponding to the eigenvalue $(q-p)$ have to be chosen in a way so that they are linearly independent. Otherwise the diagonalizing matrix $S$ becomes non-invertible. What is the systematic way to find normalized linearly independent eigenvectors in this situation?

• There isn't a systematic way. For some matrices, diagonalization is entirely impossible, like with $\left(\begin{smallmatrix}1&1\\0&1\end{smallmatrix}\right)$. Commented Apr 10, 2018 at 19:52
• Try to use Gauss method to solve $$AX = (p-q)X$$ Commented Apr 10, 2018 at 19:53
• in this example the matrix is symmetric so the eigenvectors can be mutually orthogonal Commented Apr 10, 2018 at 19:53
• What's more, as every row has an identical sum $q + 2p$, $(1, 1, 1)$ must be an eigenvector. Commented Apr 10, 2018 at 19:53
• @DavidQuinn "must be" or there exists an orthogonal set of eigenvectors. Commented Apr 10, 2018 at 20:02

To find eigenvalues, one can take A-$\lambda$I and row reduce it, which gives somewhat arbitrary solutions. For instance, here you can first try to get an eigenvector using just the "first" two dimensions, and get (1,-1,0), and then get an eigenvector of the remaining eigenspace. Or you could take (1,-.5,-.5) as your first eigenvector, and end up with a different basis.
The sum of each row of the matrix is $$q+2p$$ and therefore $$(1,1,1)$$ is an eigenvector corresponding to the eigenvalue $$q+2p$$. Now to compute the remaining eigenvectors, look for a basis of the null space of$$A-(q-p)\operatorname{Id}=\begin{pmatrix}p&p&p\\p&p&p\\p&p&p\end{pmatrix}.$$You may take $$(1,-1,0)$$ and $$(0,1,-1)$$.