Calculating sign of a permutation of unknown size, but with a pattern I'm trying to calculate the determinant of the following matrix, using the Leibniz formula:
$$
\begin{pmatrix}
0 & 1 & 0 & \cdots & 0 & 1 \\
1 & 0 & 1 & \ddots & \ddots & 0\\
0 & 1 & \ddots & \ddots & \ddots & \vdots\\
\vdots & \ddots & \ddots & \ddots & 1 & 0\\
0 & \ddots & \ddots & 1 & 0 & 1\\
1 & 0 & 0 & 0& 1 & 0
\end{pmatrix}.
$$
So, the only permutation that are relevant (non-zero product) are:
$\sigma_1 =
\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & ... & n \\
2 & 3 & 4 & 5 & 6 & 7 & ... & 1
\end{pmatrix}$ 
$\sigma_2 =
\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & ... & n \\
n & 1 & 2 & 3 & 4 & 5 & ... & 1
\end{pmatrix} $
$\sigma_3 =
\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & ... & n-1 & n \\
2 & 1 & 4 & 3 & 6 & 5 & ... & n   & n-1
\end{pmatrix} $
$\sigma_4 =
\begin{pmatrix}
1 & 2 & 3 & 4 & 5 & 6 & ... & n-2 & n-1 & n \\
n & 3 & 2 & 5 & 4 & 7 & ... & n-1 & n-2 & 1
\end{pmatrix}$

How would I proceed to determine $\operatorname{Sgn}(\sigma)$ based on the value of $n$?
Thanks!
 A: $\mathrm{sgn}(\sigma)=(-1)^{\mathrm{inv}(\sigma)}$, where $\mathrm{inv}(\sigma)$ is the number of inversions of $\sigma$, that is to say, the number of pairs of positions $(i,j)$ where $i<j$ but $\sigma(i)>\sigma(j)$ (a larger value is to the left of a smaller value). 
For the permutations you listed, the numbers of inversions are
$$
\begin{split}
\mathrm{inv}(\sigma_1)&=n-1,\\
\mathrm{inv}(\sigma_2)&=n-1,\\
\mathrm{inv}(\sigma_3)&=\left\lfloor\frac{n}{2}\right\rfloor,\\
\mathrm{inv}(\sigma_4)&=\left(\left\lfloor\frac{n}{2}\right\rfloor-1\right)+(n-2)+(n-2)+1=\left\lfloor\frac{n}{2}\right\rfloor+2n-4.
\end{split}
$$
In particular, the parity of the number of inversions is the same for $\sigma_1$ and $\sigma_2$ as well as for $\sigma_3$ and $\sigma_4$, so $\mathrm{sgn}(\sigma_1)=\mathrm{sgn}(\sigma_2)$ and $\mathrm{sgn}(\sigma_3)=\mathrm{sgn}(\sigma_4)$. Thus, the determinant can only take values $-4$, $0$, $4$.
I also see that you implicitly assume that $n$ is even. In that case, $n-1$ is odd, so $\mathrm{sgn}(\sigma_1)=\mathrm{sgn}(\sigma_2)=-1$, so the determinant is $-4$ if $\frac{n}{2}$ is odd, and $0$ if $\frac{n}{2}$ is even. 
