<s>[INST] How to compute the characteristic polynomial of $A$ The matrix associated with $f$ is:
$$ \left(\begin{array}{rrr}
     3 & -1 & -1 \\
    -1 & 3 & -1 \\
    -1 & -1 & 3
  \end{array}\right) .
$$
First, I am going to find the characteristic equation of $\det(A- \lambda I)$. Please correct me if I'm wrong.
$$= (3-\lambda)(3-\lambda)(3-\lambda)-1-1-(3-\lambda)-(3-\lambda)-(3-\lambda)
=-\lambda^3+9\lambda^2-24\lambda+16 .$$
How to factor this? I know the $\lambda$'s should be $1$, $4$ and $4$. But how am I supposed to find these values?
 [/INST] Notice that your characteristic equation is
$$(3-\lambda)^3 - 3(3-\lambda)  - 2 = 0.$$
Making the change of variable $x=3-\lambda$, we get the depressed cubic
$$x^3 - 3x - 2 = 0.$$
By the rational root theorem, you can test $1$, $-1$, $2$ and $-2$, which tells you that $x=2$ is a solution. Factoring out $x-2$ we have
$$0 = x^3-3x-2 = (x-2)(x^2+2x+1) = (x-2)(x+1)^2.$$
So the roots are $x=2$ and $x=-1$ (twice), and since $x=3-\lambda$, we get that the roots of the original equation are $\lambda=3-x$, or $\lambda = 1$, and $\lambda=4$ (twice).
</s>