<s>[INST] Show that the following matrix is diagonalizable My question is related to this question discussed in MSE.

$J$ be a $3\times 3$ matrix with all entries $1\,\,$. Then  prove that  $J$ is
diagonalizable.

Can someone explain it in terms of A.M. and G.M. (algebraic and geometric multiplicity) concept ? Thanks in advance for your time.
 [/INST] So we have 
$$ J = \begin{pmatrix} 1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{pmatrix} $$
Let's compute the characteristic polynomial $\chi_J(X) =  \det(J - X)$: 
\begin{align*}
  \chi_J(X) &= \det \begin{pmatrix} 1-X & 1 & 1 \\ 1 & 1-X & 1 \\ 1 & 1 & 1-X \end{pmatrix}\\
   &= (1-X)^3 + 2 - 3(1-X)\\
   &= 1 - 3X + 3X^2 - X^3 + 2 - 3 + 3X\\
   &= -X^3 + 3X^2\\
   &= -X^2(X-3)
\end{align*}
So 0 (with algebraic multiplicity 2) and 3 (with algebraic multiplicity 1) are the eigenvalues of $J$. To check whether $J$ is diagonaziable we will compute the geometric multiplicity of 0, that is $\dim \ker (J-0) = \dim\ker J$. We do Gaussian elimination: Subtrating the first row from the third and the second gives that 
$$ \ker J = \ker \begin{pmatrix} 1 & 1 & 1 \\ 0 & 0&0\\ 0 & 0 & 0 \end{pmatrix}$$
This matrix has rank 1, so its kernel has dimension 2. So $\dim\ker J = 2$ and $J$ is diagonaziable.
</s>