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?
[Math] How to diagonalize matrices with repeated eigenvalues
diagonalizationeigenvalues-eigenvectorslinear algebramatrices
Related Solutions
Once we have one eigenvector $v$ corresponding to the eigenvalue $\lambda$, any non-zero scalar multiple of $v$ is also an eigenvector corresponding to $\lambda$. So rather than talking about the number of eigenvectors, we talk about the number of linearly independent eigenvectors ( for example corresponding to a particular eigenvalue), equivalently the dimensions of the eigenspaces (corresponding to a particular eigenvalue).
One useful thing is that for an eigenvalue, its geometric multiplicity cannot exceed its algebraic multiplicity. In general, one is often forced to solve for the eigenspace. Depending on the information you have, you may be able to make some deductions without solving for the eigenspace/s.
Again in regard to your last question, you need to be clear on what you are asking.
For example $A = \left(\begin{matrix} 1 & 1\\0 & 1\end{matrix}\right)$ has one repeated eigenvalue (multiplicity two) $\lambda =1$. Solving for the corresponding eigenspace, we get $v = t \left(\begin{matrix} 1\\0\end{matrix}\right)$, $t\in\mathbb{R}$. So we can write down only one eigenvector, if we are asked to give the set of linearly independent eigenvectors (any nonzero scaler multiple of $\left(\begin{matrix} 1\\0\end{matrix}\right)$ will do).
On the other hand, the $2\times 2$ identity matrix again has only one eigenvalue (multiplicity two) but its corresponding eigenspace has dimension $2$ (note any nonzero vector is an eigenvector). So we have two linearly independent eigenvectors.
No, there are plenty of matrices with repeated eigenvalues which are diagonalizable. The easiest example is $$ A=\begin{bmatrix}1&0\\0&1\end{bmatrix}. $$ The identity matrix has $1$ as a double eigenvalue and is (already) diagonal. If you want to write this in diagonalized form, you can write $$ A=I^{-1}AI=I^{-1}II $$ since $A$ is a diagonal matrix.
In general, $2\times 2$ matrices with repeated eigenvalue $\lambda$ are diagonalizable if and only if the eigenspace corresponding to $\lambda$ is two dimensional. In other words, if $$ A-\lambda I=\begin{bmatrix}a-\lambda&b\\c&d-\lambda\end{bmatrix} $$ has a two-dimensional null space. Using the rank-nullity theorem, we get that this happens exactly when the matrix has $0$ pivots. If $A-\lambda I$ has any nonzero entries, then it will have a pivot. Therefore, a $2\times 2$ matrix with repeated eigenvalues is diagonalizable if and only if it is $\lambda I$.
If $B$ is an $n\times n$ matrix, all of whose eigenvalues are $\lambda$, a similar result holds. A sneakier way to prove this is that if $B$ is diagonalizable, then $$ B=P^{-1}(\lambda I)P=\lambda P^{-1}IP=\lambda I, $$ where P is an invertible (basis changing) matrix.
Therefore, the only $n\times n$ matrices with all eigenvalues the same and are diagonalizable are multiples of the identity.
If only some of $B$'s eigenvalues have multiplicity, then the situation becomes more complicated and you really need to compute the dimensions of all the eigenspaces.
As the other posters comment, there are diagonal matrices which are not multiples of the identity, for example $$ \begin{bmatrix}1&0\\0&2\end{bmatrix} $$ and if all the eigenvalues of a matrix are distinct, then the matrix is automatically diagonalizable, but there are plenty of cases where a matrix is diagonalizable, but has repeated eigenvalues.
Best Answer
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, these for a basis of th null space of$$A-(q-p)\operatorname{Id}=\begin{pmatrix}p&p&p\\p&p&p\\p&p&p\end{pmatrix}.$$So, take $(1,-1,0)$ and $(0,1,-1)$.