Characteristic polynomial of a matrix of $1$'s I am trying to calculate the characteristic polynomial of the $n \times n$ matrix $A = \{ a_{ij} = 1 \}$.

*

*Case $n=2$: I obtained $p(\lambda)=\lambda^2-2\lambda$ .


*Case $n=3$: I obtained $p(\lambda)=-\lambda^3+3\lambda^2$.


*Case $n=4$: I obtained $p(\lambda)=\lambda^4 - 4\lambda^3$.
I guess that for the general case, we have
$$p(\lambda)=(-1)^n\lambda^{n}+(-1)^{n-1}n\lambda^{n-1}$$
I tried to use induction, but it didn't work, unless I've done wrong. Can somebody help me? Or give me a hint?
 A: The trace is $n$. The eigenvalue $0$ has multiplicity $n-1$. From this we can write down the characteristic polynomial without any computation.  Or else we can pick up the eigenvalue of $n$ by noting that the all $1$'s vector times our matrix  is the all $n$'s vector.
A: Using the matrix determinant lemma,
$$\det \left( s \, \mathrm I_n - \mathbb 1_n \mathbb 1_n^\top \right) = s^n \left( 1 - \frac{1}{s} \mathbb 1_n^\top \mathbb 1_n \right) = s^n - n s^{n-1} = s^{n-1} \left( s - n \right)$$

linear-algebra matrices determinant characteristic-polynomial
A: Note that the matrix $$A = e e^T$$ where $e = \begin{pmatrix}1\\1\\1\\\vdots\\1\\1 \end{pmatrix}_{n \times 1}$.
Hence, $A^2 = \left(ee^T \right) \left(ee^T  \right)= e \left(e^T e \right) e^T = n ee^T = nA$.
This clearly indicates that the matrix is a rank one matrix. Hence it must have $n-1$ eigenvalues as $0$. The only non-zero eigen value if $\lambda =n$, since we have $\lambda^2 = n \lambda$ and $\lambda \neq 0$.
A: Hint: Denote $v=(1,1,...,1)$ and $v_j=(1,0,..,0,-1,0,...,0)$ (all zeroes except for the first, where there is $1$ and the $j$th, where there is $-1$) (all column vectors). What happens when you multiply $A\cdot v$ and $A\cdot v_j$?
A: We wish to compute the determinant of the $n\times n$ matrix
$$
M=\begin{bmatrix}
1-\lambda&1&1&\cdots&1\\
1&1-\lambda&1&\cdots&1\\
1&1&1-\lambda&\cdots&1\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
1&1&1&\cdots&1-\lambda
\end{bmatrix}\tag1
$$
Here are two approaches, the second of which uses a generalization of the lemma cited in Rodrigo de Azevedo's answer.

Finding a Similar Matrix
Note that the $n-1$ dimensional subspace orthogonal to $\begin{bmatrix}1&1&1&\cdots&1\end{bmatrix}^\text{T}$ is multiplied by $-\lambda$. (If the subspace is orthogonal to a given vector, we can subtract that vector from each row of the matrix when operating on that subspace.)
$\begin{bmatrix}1&1&1&\cdots&1\end{bmatrix}^\text{T}$ is multiplied by $n-\lambda$. (Just compute it.)
Thus, $M$ is similar to
$$
\begin{bmatrix}
-\lambda&0&0&\cdots&0\\
0&-\lambda&0&\cdots&0\\
0&0&-\lambda&\cdots&0\\
\vdots&\vdots&\vdots&\ddots&\vdots\\
0&0&0&\cdots&n-\lambda\\
\end{bmatrix}\tag2
$$
Therefore,
$$
\det(M)=(-\lambda)^{n-1}(n-\lambda)\tag3
$$

$\boldsymbol{\det(\lambda I_n-AB)=\lambda^{n-m}\det(\lambda I_m-BA)}$
As shown in this answer,

$$
\det(\lambda I_n-AB)=\lambda^{n-m}\det(\lambda I_m-BA)\tag4
$$

Let $A=\begin{bmatrix}1&1&1&\cdots&1\end{bmatrix}^\text{T}$ and $B=A^\text{T}$, then $M=AB-\lambda I_n$.
Furthermore, $m=1$ and $BA=\begin{bmatrix}n\end{bmatrix}$.
$(4)$ then says that
$$
\begin{align}
\det(-M)
&=\det(\lambda I_n-AB)\tag{5a}\\[2pt]
&=\lambda^{n-1}\det(\lambda I_1-BA)\tag{5b}\\[2pt]
&=\lambda^{n-1}\det(\lambda I_1-\begin{bmatrix}n\end{bmatrix})\tag{5c}\\
&=\lambda^{n-1}(\lambda-n)\tag{5d}
\end{align}
$$
which, since $\det(-M)=(-1)^n\det(M)$, becomes
$$
\det(M)=(-\lambda)^{n-1}(n-\lambda)\tag6
$$
