# Diagonal entries are zero, others are $1$. Find the determinant. [duplicate]

$$\det\begin{vmatrix} 0 & \cdots & 1& 1 & 1 \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ 1 & \cdots & 1 & 1 & 0 \end{vmatrix}=?$$

Attempt:

First I tried to use linearity property of the determinants such that $$\det\binom{ v+ku }{ w }=\det\binom{v }{ w }+k\det \binom{ u }{ w }$$

$$v,u,w$$ are vectors $$k$$ is scalar.

I have tried to divide it into $$n$$ parts and tried to compose with sense but didn't acomplish.

Second I tried to make use of "Row Reduction" i.e. adding scalar multiple of some row to another does not change the determinant, so I added the all different rows into other i.e. adding $$2, 3,4,\dots,n$$th row to first row and similarly doing for all rows we got

$$\det\begin{vmatrix} 0 & \cdots & 1& 1 & 1 \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ 1 & \cdots & 1 & 1 & 0 \end{vmatrix}=\det\begin{vmatrix} n-1 & \cdots & n-1& n-1 & n-1 \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ n-1 & \cdots & n-1 & n-1 & n-1 \end{vmatrix}=0$$

The last determinant is zero (I guess) so the given determinant is zero?

I don't have the answer this question, so I am not sure. How to calculate this determinant?

## marked as duplicate by Martin R, Michael Hoppe, Martin Sleziak, Xander Henderson, DidDec 27 '18 at 17:16

$$\det A_n=\begin{vmatrix} 0 & \cdots & 1& 1 & 1 \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ 1 & \cdots & 1 & 1 & 0 \end{vmatrix}=\det\left(\begin{pmatrix} 1 & \cdots & 1& 1 & 1 \\ \vdots & \ddots & \vdots & \vdots & \vdots \\ 1 & \cdots & 1 & 1 & 1 \end{pmatrix}-I_n\right)=\det(B_n-I_n)$$ Now, $$B_n$$ has rank $$1$$, so $$0$$ is a $$(n-1)$$ fold eigenvalue of $$B_n$$ Hence, $$(-1)$$ is a $$(n-1)$$ fold eigenvalue of $$A_n$$. The other eigenvalue is $$(n-1)$$, since it's the sum of elements in each row. Hence, the determinant is $$(-1)^{(n-1)}(n-1)$$.

Notice that

$$\begin{bmatrix} 0 & 1 & \cdots & 1\\ 1 & 0 & \cdots & 1\\ \vdots & \vdots & \ddots & \vdots\\ 1 & 1 &\cdots & 0 \end{bmatrix}\begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix} = (n-1)\begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix}$$

$$\begin{bmatrix} 0 & 1 & \cdots & 1\\ 1 & 0 & \cdots & 1\\ \vdots & \vdots & \ddots & \vdots\\ 1 & 1 &\cdots & 0 \end{bmatrix}\begin{bmatrix} 1 \\ -1 \\ 0 \\ \vdots \\ 0 \end{bmatrix} = -\begin{bmatrix} 1 \\ -1 \\ 0 \\ \vdots \\ 0 \end{bmatrix}$$ $$\begin{bmatrix} 0 & 1 & \cdots & 1\\ 1 & 0 & \cdots & 1\\ \vdots & \vdots & \ddots & \vdots\\ 1 & 1 &\cdots & 0 \end{bmatrix}\begin{bmatrix} 1 \\ 0 \\ -1 \\ \vdots \\ 0 \end{bmatrix} = -\begin{bmatrix} 1 \\ 0 \\ -1 \\ \vdots \\ 0 \end{bmatrix}$$ $$\vdots$$ $$\begin{bmatrix} 0 & 1 & \cdots & 1\\ 1 & 0 & \cdots & 1\\ \vdots & \vdots & \ddots & \vdots\\ 1 & 1 &\cdots & 0 \end{bmatrix}\begin{bmatrix} 1 \\ 0 \\ 0 \\ \vdots \\ -1 \end{bmatrix} = -\begin{bmatrix} 1 \\ 0 \\ 0 \\ \vdots \\ -1 \end{bmatrix}$$

All eigenvectors here are linearly independent so the eigenvalues are $$-1$$ with multiplicity $$n-1$$ and $$n-1$$ with multiplicity one.

Therefore the determinant is $$(-1)^{n-1}(n-1)$$.

For $$n = 1$$, we have $$\det \left[ \begin{matrix} 0 \end{matrix} \right] = 0.$$

For $$n=2$$, we have $$\det \left[ \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix} \right] = -1.$$

For $$n = 3$$, we have $$\det \left[ \begin{matrix} 0 & 1 & 1 \\ 1 & 0 & 1 \\ 1 & 1 & 0 \end{matrix} \right] = 0 \det \left[ \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix} \right] - 1 \det \left[ \begin{matrix} 1 & 1 \\ 1 & 0 \end{matrix} \right] + 1 \det \left[ \begin{matrix} 1 & 0 \\ 1 & 1 \end{matrix} \right] = 2.$$

For $$n = 4$$, we have $$\det \left[ \begin{matrix} 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 \end{matrix} \right] = -3.$$

For $$n = 5$$, we have $$\det \left[ \begin{matrix} 0 & 1 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 & 1 \\ 1 & 1 & 0 & 1 & 1 \\ 1 & 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 1 & 0 \end{matrix} \right] = 4.$$

So, in general, if $$A$$ is your $$n \times n$$ matrix with all diagonal entries equal to $$0$$ and all off-diagonal entries equal to $$1$$, then we have $$\det A = (-1)^{n-1} (n-1).$$

Hope this helps.

For calculation of determinants, I've used this online tool.