[Math] Determinant of a matrix of ones, whose anti diagonal elements are zero

determinantlinear algebramatrices

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.

Best Answer

Let $J$ be the $n\times n$ matrix of all zeros except ones on the anti-diagonal and $e$ be the vector of all ones. Then $$ A=-J+ee^T. $$ Now apply the matrix determinant lemma. Note that $J^{-1}=J$.

Related Question