<s>[INST] Determinant of a matrix of ones, whose anti diagonal elements are zero I'm trying to prove a formula I have constructed for the determinant of a general $n\times n $ real matrix $A$, given here in the case $n=5$:
$$ A = \begin{bmatrix}
1 & 1 & 1 & 1 & 0 \\
1 & 1 & 1 & 0 & 1 \\
1 & 1 & 0 & 1 & 1 \\
1 & 0 & 1 & 1 & 1 \\
0 & 1 & 1 & 1 & 1
\end{bmatrix}.
$$
That is, the matrix containing all 1's apart from the anti-diagonal which consists of zeros.
Using a simple matlab code I've computed the determinants for the first few values of $n$, and have come to the formula
$$ \det A =
\begin{cases}
-(n-1) \hspace{1em}\mbox{ if }\,\,\, n \equiv -1,0\mod 4, \\
n-1 \hspace{2.2em}\mbox{ otherwise,}
\end{cases}
$$
but I'm unsure where to start to prove this.
 [/INST] This is easy to calculate by row reduction:
Add all rows to row 1.
$$\det(A) = \begin{vmatrix}
1 & 1 & ... & 1 & 0 \\
1 & 1 & ... & 0 & 1 \\
... & ... & ... & ... & ... \\
1 & 0 & ... & 1 & 1 \\
0 & 1 & ... & 1 & 1
\end{vmatrix}=\begin{vmatrix}
n-1 & n-1 & ... & n-1 & n-1 \\
1 & 1 & ... & 0 & 1 \\
... & ... & ... & ... & ... \\
1 & 0 & ... & 1 & 1 \\
0 & 1 & ... & 1 & 1
\end{vmatrix}\\=(n-1)\begin{vmatrix}
1 & 1 & ... & 1 & 1 \\
1 & 1 & ... & 0 & 1 \\
... & ... & ... & ... & ... \\
1 & 0 & ... & 1 & 1 \\
0 & 1 & ... & 1 & 1
\end{vmatrix}=(n-1)\begin{vmatrix}
1 & 1 & ... & 1 & 1 \\
0 & 0 & ... & -1 & 0 \\
... & ... & ... & ... & ... \\
0 & -1 & ... & 0 & 0 \\
-1 & 0 & ... & 0 & 0
\end{vmatrix}$$
where in the last row we subtracted row 1 from all rows. Now add again all rows to row 1:
$$\det(A)=(n-1)\begin{vmatrix}
0 & 0 & ... & 0 & 1 \\
0 & 0 & ... & -1 & 0 \\
... & ... & ... & ... & ... \\
0 & -1 & ... & 0 & 0 \\
-1 & 0 & ... & 0 & 0
\end{vmatrix}$$
The last determinant is easy now to calculate.
</s>