Eigenvalues of matrices of order $n$ How to find eigenvalues of following matrices of order $n$?
$$A=\begin{bmatrix} 
1 & 1 & 1 & 1 & \cdots & 1 \\
1 & 0 & 1 & 1 & \cdots & 1 \\
1 & 1 & 0 & 1 & \cdots & 1 \\
1 & 1 & 1 & 0 & \cdots & 1 \\
\vdots & \vdots & \vdots & \vdots &\ddots & \vdots \\
1 & 1 & 1 & 1 & \cdots & 0 \\
\end{bmatrix}_n$$
$$B=\begin{bmatrix} 
-1 & 1 & 1 & 1 & \cdots & 1 \\
1 & 0 & 1 & 1 & \cdots & 1 \\
1 & 1 & 0 & 1 & \cdots & 1 \\
1 & 1 & 1 & 0 & \cdots & 1 \\
\vdots & \vdots & \vdots & \vdots &\ddots & \vdots \\
1 & 1 & 1 & 1 & \cdots & 0 \\
\end{bmatrix}_n$$
I had apply matrix calculator to find eigenvalues and I found that exactly $n-2$ eigenvalues of both matrices are $-1$,but I was not able to find rest of the eigenvalues. 
 A: Using row reduction,
$$
\det A=\begin{vmatrix} 
1 & 1 & 1 & 1 & \cdots & 1 \\
1 & 0 & 1 & 1 & \cdots & 1 \\
1 & 1 & 0 & 1 & \cdots & 1 \\
1 & 1 & 1 & 0 & \cdots & 1 \\
\vdots & \vdots & \vdots & \vdots &\ddots & \vdots \\
1 & 1 & 1 & 1 & \cdots & 0 \\
\end{vmatrix}_n
=\begin{vmatrix} 
1 & 1 & 1 & 1 & \cdots & 1 \\
0 & -1 & 0 & 0 & \cdots & 0 \\
0 & 0 & -1 & 0 & \cdots & 0 \\
0 & 0 & 0 & -1 & \cdots & 0 \\
\vdots & \vdots & \vdots & \vdots &\ddots & \vdots \\
0 & 0 & 0 & 0 & \cdots & -1 \\
\end{vmatrix}_n=(-1)^{n-1}
$$
One can see explicitly that there are $n-2$ linearly independent eigenvectors for the eigenvalue $-1$. Indeed if we solve the system $(A+I)x=0$, we easily get 
$$
x_1=0; \ \ x_2+x_3+\cdots+x_n=0
$$
(so the dimension of the solution space, the eigenvectors of $-1$, is $n-2$). We know from $\det A=(-1)^{ n-1}$ that the product of the eigenvalues is $(-1)^{n-1}$. So, as $A $ is real and symmetric (thus selfadjoint) the geometric multiplicities agree with the algebraic ones; we then have
$$
(-1)^{n-1}=\lambda_1\lambda_2\,(-1)^{n-2}.
$$
It follows that $\lambda_1\lambda_2=-1$.
We also know that the trace of $A$ is $1$; so 
$$
1=\lambda_1+\lambda_2+(n-2)(-1)=\lambda_1\lambda_2+2-n.
$$
Thus
$$
\lambda_1+\lambda_2=n-1,\ \ \lambda_1\lambda_2=-1.
$$
This is a quadratic, and one finds that 
$$
\lambda_1=\frac{n-1+\sqrt{n^2-2n+5}}2,
\ \ \ \ \ 
\lambda_2=\frac{n-1-\sqrt{n^2-2n+5}}2
$$
The case for $B$ is similar. We get the same $n-2$ dimensional subspace of eigenvectors of $-1$. For the other two eigenvalues, working with the trace and the determinant we get
$$
\det B=(-1)^{n-1}\,(2n-3)
$$
Thus
$$
\lambda_1\lambda_2\,(-1)^{n-2}=(-1)^{n-1}\,(2n-3),\ \ \lambda_1+\lambda_2=-1.
$$
This reduces to 
$$
\lambda_1\lambda_2=3-2n,\ \ \lambda_1+\lambda_2=-1.
$$
One then obtains
$$
\lambda_1=-\frac{1+\sqrt{8n-11}}2,\ \ \ \ \ \lambda_2=-\frac{1-\sqrt{8n-11}}2.
$$
