TITLE: How to calculate the determinant of all-ones matrix minus the identity?
QUESTION [16 upvotes]: How do I calculate the determinant of the following $n\times n$ matrices
$$\begin {bmatrix}
0 & 1 & \ldots & 1 \\
1 & 0 & \ldots & 1 \\
\vdots & \vdots & \ddots & \vdots \\
1 & 1 & ... & 0
\end {bmatrix}$$
and the same matrix but one of columns replaced only with $1$s?
In the  above matrix all off-diagonal elements are $1$ and diagonal elements are $0$.

REPLY [2 votes]: Let $A_n$ denote the $n\times n$ matrix of the form you give: $0$ on the diagonal and $1$ everywhere else. I'll find $\det A_n$ by computing the eigenvalues of $A_n$ and multiplying them together. 
First, let $B_n = A_n + I_n$, so that $B_n$ consists of all $1$'s. Since $B_n$ has rank $1$ it has an eigenvalue $0$ of multiplicity $n-1$; since $\operatorname{tr} B_n = n$ and the trace is the sum of the eigenvalues, the other eigenvalue of $B_n$ must be $n$. Now $v$ is an eigenvector for $B_n$ with eigenvalue $\lambda$ if and only if $v$ is an eigenvector for $A_n$ with eigenvalue $\lambda - 1$ (why?). Hence the eigenvalues of $A_n$ are
$$
\underbrace{-1,-1,\dots,-1}_{n-1\text{ times}},n-1
$$
and $\det A_n = (-1)^{n-1}(n-1)$.
This is similar to a few of the other answers, but I thought it elegant enough to warrant inclusion.