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?
 A: Your aim is to factor $P(x)=−x^3+9x^2−24x+16$ and you already know that $x=1$ is a root. Hence $1-x$ divides $P(x)$. Since the degree of $P$ is $3$, the quotient has degree $2$. Since the leading term of $P(x)$ is $-x^3$, the leading term of the quotient is $x^2$. Since the constant term of $P(x)$ is $16$, the constant term of the quotient is $16$ as well. Hence
$$
P(x)=(1-x)(16+ax+x^2).
$$
You also already know that $4$ is a root, hence $16+ax+x^2=0$ for $x=4$, that is, $a=-8$. Finally,
$$
P(x)=(1-x)(16-8x+x^2)=(1-x)(4-x)^2.
$$
Note: One does not need to compute the determinant like you did, to determine the characteristic polynomial. Start from the fact that $A=4I-J$ where $J$ is the matrix of ones. Since $J^2=3J$ (this is the only matrix computation needed in this solution), $(A-4I)^2=J^2=3J=4I-A$, that is $A^2-5A+4I=0$, or 
$$
(4I-A)(I-A)=0.
$$
Since $A\ne4I$ and $A\ne I$, the minimal polynomial $\mu_A$ of $A$ is such that $\mu_A(x)=(1-x)(4-x)$. The characteristic polynomial $\chi_A$ is a multiple of $\mu_A$ with the same roots hence $\chi_A(x)=(1-x)^2(4-x)$ or $\chi_A(x)=(1-x)(4-x)^2$. The trace of $A$ is $9$, which must be the sum of the roots of $\chi_A$, hence 
$$
\chi_A(x)=(1-x)(4-x)^2.
$$
A: This comes up pretty often, I think it is worth throwing in a bit more than you asked.
Suppose I have an $n$ by $n$ square matrix where all entries are equal to $1$:
$$ R_n \; \; = \; \;
 \left(  \begin{array}{ccccccc}
 1 & 1 & 1 & 1 & 1 & 1 & 1  \\
 1 & 1 & 1 & 1 & 1 & 1 & 1  \\
 1 & 1 & 1 & 1 & 1 & 1 & 1  \\
 1 & 1 & 1 & 1 & 1 & 1 & 1  \\
 1 & 1 & 1 & 1 & 1 & 1 & 1  \\
 1 & 1 & 1 & 1 & 1 & 1 & 1  \\
 1 & 1 & 1 & 1 & 1 & 1 & 1  
\end{array} 
  \right).
  $$
What are the eigenvalues and eigenvectors? ( Here $n=7,$ I will keep typing $n$ because the exact value really does not matter).
Well, we get an automatic eigenvalue $n,$ with eigenvector (I use columns always)
$$
 \left(  \begin{array}{c}
 1  \\
 1  \\
 1  \\
 1  \\
 1  \\
 1  \\
 1  
\end{array} 
  \right).
  $$
 We then get  $n-1$ genuine eigenvalues $0,$ with linearly independent eigenvectors 
$$
 \left(  \begin{array}{c}
 1  \\
 -1  \\
 0  \\
 0  \\
 0  \\
 0  \\
 0  
\end{array} 
  \right) \;
 \left(  \begin{array}{c}
 1  \\
 0  \\
 -1  \\
 0  \\
 0  \\
 0  \\
 0  
\end{array} 
  \right) \;
 \left(  \begin{array}{c}
 1  \\
 0  \\
 0  \\
 -1  \\
 0  \\
 0  \\
 0  
\end{array} 
  \right) \;
 \left(  \begin{array}{c}
 1  \\
 0  \\
 0  \\
 0  \\
 -1  \\
 0  \\
 0  
\end{array} 
  \right) \;
 \left(  \begin{array}{c}
 1  \\
 0  \\
 0  \\
 0  \\
 0  \\
 -1  \\
 0  
\end{array} 
  \right) \;
 \left(  \begin{array}{c}
 1  \\
 0  \\
 0  \\
 0  \\
 0  \\
 0  \\
 -1  
\end{array} 
  \right) \;
  $$
The complete list of eigenvalues is $\left\{n,0,\ldots,0 \right\}.$
What would I get for the eigenvalues of $k R_n,$ for a real number $k?$ With exactly the same eigenvectors, I would now have eigenvalues $\left\{kn,0,\ldots,0 \right\}.$ In your example the value of $k$ is $-1.$ All that has changed is the eigenvalue of the eigenvector with all 1's, which is now sent to $kn$ times itself.
What are the eigenvalues of $ w I + k R_n,$ with real numbers $w,k?$ With exactly the same (basis of) eigenvectors, we just add, for each eigenvector, $w$ times each. So the eigenvalues are  $\left\{w + kn,w,\ldots,w \right\}.$ Again, these are genuine eigenvalues (the Jacobi normal form is diagonal, which we also know from symmetry). The determinant of the matrix is then $$ ( w + k n ) \;  w^{n-1} = w^n + k \; n \, w^{n-1}.$$
When I have a basis of eigenvectors, and I know the list of eigenvalues, the characteristic polynomial is just the product of $n$ linear terms, each one given by $\left(\mbox{eigenvalue} - \lambda \right)$ in the order you are using. Here, your answer is just
$$ ( w + k n - \lambda) \; ( w  - \lambda)^{n-1}.$$
Now, for your example, indeed $n=3.$
How to get the 3's on the diagonal? In order to get the $-1'$s off the diagonal, we must take $k=-1,$ as I mentioned. So we must add 4 to bump $-1$ up to 3, so that $w=4.$ Meanwhile $w + k n = 1$ and $n-1=2.$ Your characteristic polynomial is 
$$  \det (A - \lambda I) =  (1-\lambda) \; (4 - \lambda)^2.$$
Arturo and Didier (and all enlightened people) would want me to point out how spectacularly incorrect this method is for a matrix such as
$$   
 \left(  \begin{array}{rr}
  3 & 1  \\
   0  & 3  
\end{array} 
  \right)  ,
$$
where the characteristic polynomial is easy enough to find but there is no basis of eigenvectors. 
A: 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).
A: Here is a simple way to get the roots, but only works for this matrix:
$$A-\lambda I= \left(\begin{array}{rrr}
     3-\lambda & -1 & -1 \\
    -1 & 3-\lambda & -1 \\
    -1 & -1 & 3-\lambda
  \end{array}\right) . $$
Each row has the same elements, in a different order, which means that the sum of elements of each row is the same, namely $1-\lambda$.
This gives you one root, it means that $1-\lambda$ is a factor in your polynomial (or alternately you can see that for $\lambda=1$ the sum of the columns is the zero vector, thus for $\lambda=1$ you have $\det(A-\lambda I)=0$.
And one last comment, for this matrix it would have been easier to calculate the determinant by Row Reduction:
$$A-\lambda I= \left|\begin{array}{rrr}
     3-\lambda & -1 & -1 \\
    -1 & 3-\lambda & -1 \\
    -1 & -1 & 3-\lambda
  \end{array}\right|= \left|\begin{array}{rrr}
     1-\lambda & 1-\lambda & 1-\lambda \\
    -1 & 3-\lambda & -1 \\
    -1 & -1 & 3-\lambda
  \end{array}\right|  . $$
$$=(1-\lambda) \left|\begin{array}{rrr}
     1 & 1 & 1 \\
    -1 & 3-\lambda & -1 \\
    -1 & -1 & 3-\lambda
  \end{array}\right| = (1-\lambda) \left|\begin{array}{rrr}
     1 & 1 & 1 \\
    0 & 4-\lambda & 0 \\
    0 & 0 & 4-\lambda
  \end{array}\right|$$
A: You may also use Cardano's formula to find the roots $x_1,x_2,x_3$ of a cubic polynomial $ax^3+bx^2+cx+d$.
$$
\begin{align}
p &= 2 b^3-9 a b c+27 a^2 d,\\
q &= \sqrt{p^2-4 \left(b^2-3 a c\right)^3},\\
x_1 &= -\frac{b}{3 a}
-\frac{1}{3 a} \sqrt[3]{\frac{p+q}{2}}
-\frac{1}{3 a} \sqrt[3]{\frac{p-q}{2}},\\
x_2 &= -\frac{b}{3 a}
+\frac{1+i \sqrt{3}}{6 a} \sqrt[3]{\frac{p+q}{2}}
+\frac{1-i \sqrt{3}}{6 a} \sqrt[3]{\frac{p-q}{2}},\\
x_3 &= -\frac{b}{3 a}
+\frac{1-i \sqrt{3}}{6 a} \sqrt[3]{\frac{p+q}{2}}
+\frac{1+i \sqrt{3}}{6 a} \sqrt[3]{\frac{p-q}{2}}.
\end{align}
$$
(There are some subtleties in handling $q$ when the operand inside the square root is negative. See the Wikipedia entry for details.) In your case we have $a=-1, b=9, c=-24, d=16$. Hence $p=-54, q=0$ and $x_1=1, x_2=x_3=4$.
