Determinant of symmetric matrix with the main diagonal elements zero

How to prove that the determinant of a symmetric matrix with the main diagonal elements zero and all other elements positive is not zero (i.e., that the matrix is invertible)?

EDIT: OP indicates in a comment that the entries above the diagonal are to be distinct.


\begin{vmatrix} 0 & 2 & 3 & 15 \\ 2 & 0 & 5 & 9 \\ 3 & 5 & 0 & 6 \\ 15 & 9 & 6 & 0 \end{vmatrix}

This matrix has determinant zero.


Added: The determinant in the $4\times 4$ case is quite nice: $$2[(af)^2+(be)^2+(cd)^2]-(af+be+cd)^2. $$ To get integer entries, consider the Diophantine equation $$2[x^2+y^2+z^2]=(x+y+z)^2 $$ which has solutions $x=cr^2$, $y=cs^2$, $z=ct^2$ where $r+s=t$. We need to be able to split $x,y,z$ into six distinct factors, two each. I eventually hit upon $c=3$, $r=2$, $s=3$, and $t=5$. This gives $x=12$, $y=27$, $z=75$ which I split as $a=2$, $f=6$, $b=3$, $e=9$, $c=15$, and $d=5$.


The assertion is not true. Counter-example.

$$\begin{vmatrix} 0 & 2 & 1 & 1 \\ 2 & 0 & 1 & 1 \\ 1 & 1 & 0 & 2 \\ 1 & 1 & 2 & 0 \end{vmatrix} $$

If entries of the matrix are distinct, then we need to show that rows (or columns) of this matrix are linearly independent. Let's do it with a $4 \times 4$ matrix and then we'll try to generalize.

$$ A = \begin{vmatrix} 0 & a & b & c \\ a & 0 & d & e \\ b & d & 0 & f \\ c & e & f & 0 \end{vmatrix}$$ where $ a \ne b \ne c \ne d \ne f \ne g$.

Assume that these rows are linearly dependent (i.e. we can write one of the rows in terms of other rows). Without loss of generality, we can write row 1 in terms of other rows. Then one must find $x_1, x_2, x_3$ (not all of them zero) such that,

$$ax_1 + bx_2 + cx_3 = 0 \\ 0x_1 + dx_2 + ex_3 = a \\ dx_1 + 0x_2 + fx_3 = b \\ ex_1 + fx_2 + 0x_3 = c $$

If we can show that there is a contradiction (i.e. there are no such $x_1, x_2, x_3$ which satisfy above system, we prove that rows of this matrix are linearly independent, thus determinant of this matrix in non-zero.


Here's another way to get a counterexample.

Start with Dilawar's $$\pmatrix{0&2&1&1\cr2&0&1&1\cr1&1&0&2\cr1&1&2&0\cr}$$ It is certainly symmetric, has determinant zero, and positive integer entries (off the diagonal), but the objection is we want all the entries (above the diagonal) to be distinct. If you multiply any row or column by any positive integer, the determinant remains zero (and the off-diagonal entries remain positive integers). To keep the matrix symmetric, if you multiply some column by $a$, you must multiply the corresponding row by $a$ as well. A little bit of experimenting shows that if you multiply the second row and column by 3, the bottom row and column by 4, you get $$\pmatrix{0&6&1&4\cr6&0&3&12\cr1&3&0&8\cr4&12&8&0\cr}$$ and you win.

Not that it's a competition, but I note the entries here are slightly smaller than those in Byron's answer.


EDIT: As pointed out in comment I forgot the constraint that no zeros are allowed off the diagonal, so this answer is wrong.

(Correct if we remove "no zeros on off-diagonal constraint", so maybe it can be useful to someone.)


Here is a whole family of counter-examples, take any matrix created as in this question: $${\bf d} \in \mathbb R^N \,\,\,\,\&\,\,\,\,\exists j,k: j\neq k \,\,\,\,\&\,\,\,\, {\bf d}_{j} = {\bf d}_{k}$$ Now construct matrix $${\bf M} = |{\bf d1}^T-{\bf 1d}^T|$$

With $|\cdot |$ denoting element-wise absolute value.

As per answer by StevenStadnicki, we can show that rows/columns nr $j$ and $k$ must be duplicate why the matrix cannot have full rank, and therefore have at least one $0$ eigenvalue which forces $\text{det}({\bf M})=0$.