The eigenvalues and corresponding eigenvectors for the matrix
The matrix is
$$\begin{pmatrix} 0&2&2\\ 2&0&2\\ 2&2&0 \end{pmatrix} $$
I have calculated the equation for eigenvalues, which is $\lambda^3-4\lambda-16=0$, but how do I solve this equation? Can this matrix be diagonalized?
I have calculated the equation for eigenvalues, which is $\lambda^3-4\lambda-16=0$, but how do I solve this equation?
Your characteristic equation is wrong. You can avoid having to solve a cubic equation by first using some properties of determinants; e.g. subtracting the third column from the second and then adding the third row to the second: $$\begin{vmatrix} -\lambda&2&2\\ 2&-\lambda&2\\ 2&2&-\lambda \end{vmatrix} =\begin{vmatrix} -\lambda&0&2\\ 2&-\lambda-2&2\\ 2&2+\lambda&-\lambda \end{vmatrix} =\begin{vmatrix} -\lambda&0&2\\ 4&0&2-\lambda\\ 2&2+\lambda&-\lambda \end{vmatrix}$$ Expanding along the second column now gives: $$(2+\lambda)\left(-\lambda(2-\lambda)-8\right)=0 \iff (2+\lambda)^2(\lambda-4)=0 \iff \lambda = -2 \vee \lambda = 4$$ Now proceed with finding the corresponding eigenvectors. You should find two linearly indepedent eigenvectors for the double eigenvalue $\lambda = -2$, so yes: the matrix is diagonalizable.
One can quickly find the eigenvalues of a matrix of this form without forming and solving the characteristic equation. Call your matrix $A$. Observe that the matrix of all $2$’s is singular. That matrix is equal to $A+2I$, so $-2$ is an eigenvalue. It should be clear that the kernel of $A+2I$ is two-dimensional, so $-2$ is at least a double eigenvalue. Using the fact that the trace of a matrix is equal to the sum of its eigenvalues, we find that the third eigenvalue is $0-2(-2)=4$.
More generally, the same line of reasoning shows that the eigenvalues of the matrix $\small{\pmatrix{a&k&k\\k&a&k\\k&k&a}}$ are $a-k$, $a-k$ and $a+2k$. This has a straightforward generalization to $n\times n$ matrices as well.