determinant of an $n\times n$ matrix type [duplicate]

How can one compute the determinant of an $n\times n$ matrix where all the diagonal entries are equal to $0$ and all the off-diagonal entries are equal to $1$?

marked as duplicate by Gerry Myerson, William, user31373, Quixotic, Martin SleziakSep 11 '12 at 18:47

Let $A$ denote the $n\times n$ matrix of all ones. The rank of $A$ is 1, and it can be seen that the vector of all ones is an eigenvector for $A$ with eigenvalue $n$, so the characteristic polynomial of $A$ is $t^{n-1}(t-n)$. If $B$ denotes your matrix, then \begin{eqnarray*} \det(B)&=&\det(A-1)\\ &=&(-1)^n\det(1-A)\\ &=&(-1)^n(t^{n-1}(t-n))|_{t=1}\\ &=&(-1)^n(1-n) \end{eqnarray*}