Determinant of this matrix So I have a problem.. I already found out what kind of matrix it is..
So all main diagonals of this matrix are 0.. the rest is 1.. it's not 4x4 or 3x3 etc.. it's size is nxn.. does anyone of you know a formular to calculate the determinant for this nxn matrix or how it's called? Thanks alot
Here is an example
$$\begin{pmatrix}0&1&1&1\\1&0&1&1\\1&1&0& 1\\1& 1& 1& 0\end{pmatrix}$$
I hope you can help me out and thanks alot
 A: Suppose you know about eigenvalues. The determinant is the product of the eigenvalues (including multiplicities).  If $J$ is the $n\times n$ all-ones matrix, and $I$ is the $n\times n$ identity matrix, then your matrix is $J-I$.  Use the fact that $J$ has rank 1 with constant row-sums to find the eigenvalues of $J$, then use this to find the eigenvalues of $J-I$.
As a side note, suppose you also know about graph theory.  Then your matrix is the adjacency matrix of the complete graph on $n$ vertices. 
A: Let $A_n$ be this $n\times n$ matrix.
Hints:


*

*Let $B_n$ be $A_n$, but with the first row replaced to $(1,0,0,0,\dots)$, and let $C_n$ be again $A_n$ but with the first $0$ of first row replaced to $1$. 

*Observe that $\det A_n+\det B_n=\det C_n$.

*Express $\det B_n$ using $\det A_{n-1}$.

*Subtract first row from each other row in $C_n$, and determine $\det C_n$.

A: Although I suspect your professor/the author wanted to use part of the already answered question (here) and apply it to get the determinant for this one, here is another way using diagonalization:
Verify that $A = PDP^{-1}$ where
$$D = \left(\begin{matrix}-1 & 0 &  \cdots & 0 & 0\\
0 & -1 &  \cdots & 0 & 0\\ \vdots & \vdots & \ddots & 0 & 0\\ 0 & 0 & \cdots & -1 & 0\\0 & 0 & \cdots & 0 & n-1\end{matrix}\right)$$
and
$$P = \left(\begin{matrix}-1 & -1 &  \cdots & -1 & 1\\
0 & 0 &  \cdots & 1 & 1\\ \vdots & \vdots & \cdot^{\large \cdot^{\large \cdot}} & 0 & 1\\ 0 & 1 & \cdots & 0 & 1\\1 & 0 & \cdots & 0 & 1\end{matrix}\right)$$
Note you can just find the eigenvalues and their multiplicities, and dont actually have to compute it. In doing this you will find $\lambda =-1$ has geometric multiplicity $n-1$, and $\lambda=n-1$ has multiplicity $1$. But as this is a task in of itself, for your consideration here is $P^{-1}$
$$P^{-1} = \dfrac{1}{n}\left(\begin{matrix}-1 & -1 &  \cdots & -1 & n-1\\
-1 & -1 &  \cdots & n-1 & -1\\ \vdots & \vdots & \cdot^{\large \cdot^{\large \cdot}} & -1 & -1\\ -1 & n-1 & \cdots & -1 & -1\\1 & 1 & \cdots & 1 & 1\end{matrix}\right)$$
Once you are convinced of this, we have 
$$\det(A) = \det(PDP^{-1}) = \det(D) = (-1)^{n-1}(n-1) $$
which is the same as $(-1)^n(1-n)$.
