How do I calculate the eigenvalues of a matrix with $1$'s everywhere except the main diagonal? I am trying to calculate the eigenvalues of a square $n \times n$ matrix whose entries are $0$ along the main diagonal and $1$ elsewhere. How do I compute the eigenvalues of this matrix?
I'm thinking along the lines of diagonalisation, but I am not sure at this rate.
 A: Note:
$$\begin{vmatrix}-t & 1 & \cdots &1&1\\ 1 & -t & \cdots  & 1& 1 \\ \vdots & \vdots & \ddots & \vdots & \vdots\\ 1& 1 &\cdots & -t& 1\\ 1& 1 &\cdots & 1& -t\end{vmatrix}=0 \stackrel{\text{add columns}}{\Rightarrow} \\
(n-1-t)\begin{vmatrix}1 & 1 & \cdots &1&1\\ 1 & -t & \cdots  & 1& 1 \\ \vdots & \vdots & \ddots & \vdots & \vdots\\ 1& 1 &\cdots & -t& 1\\ 1& 1 &\cdots & 1& -t\end{vmatrix}=0 \stackrel{R_1-R_i\to R_i,i=2,3,...,n}{\Rightarrow} \\
(n-1-t)\begin{vmatrix}1 & 1 & \cdots &1&1\\ 0 & 1+t & \cdots  & 0& 0 \\ \vdots & \vdots & \ddots & \vdots & \vdots\\ 0& 0 &\cdots & 1+t& 0\\ 0& 0 &\cdots & 0& 1+t\end{vmatrix}=0 \Rightarrow \\
(n-1-t)(1+t)^{n-1}=0 \Rightarrow \\
t_1=n-1,t_i=-1, i=2,3,...,n.$$
A: Consider the $n\times n$ matrix $J$ with all entries equal to $1$, with $n>1$. Then its rank is $1$ and $n$ is an eigenvalue. So the algebraic multiplicity of the eigenvalue $0$ is at most $n-1$, but its geometric multiplicity is $n-1$. Hence we know all the eigenvalues with their algebraic multiplicity.
Hence the characteristic polynomial $p_J(x)$ is $(n-x)(0-x)^{n-1}$, by definition of algebraic multiplicity. Therefore
$$
\det(J-xI)=(n-x)(0-x)^{n-1}
$$
and your matrix is obtained with $x=1$, so the determinant is $(-1)^{n-1}(n-1)$
