The determinant of a certain square matrix. Let $n > 1$ be an odd number. Let $A$ be an $n \times n$ matrix defined as follows
\begin{equation}
\label{wams} a_{i, j} = \begin{cases} 1, & \text{for}\ i - j  \equiv \pm 2 \pmod n\\ 2, & \text{for}\ i = j\\ 0, & \text{otherwise}.\end{cases}
\end{equation}
Calculate the determinant of matrix $A$.

Could someone please give me a hint for this question? I am completely green. I have tried at my best level, and still am not able to come up with a solution.
 A: Probably not the answer you are looking for, but when you're looking to calculate a determinant for a family of matrices, you have two natural options right off the bat. The first is to try to factor it into stuff you know how to calculate, and the second is to argue by induction.
Matrix factorization is usually fairly computational, Meaning that we don't really know what answer we will get without actually performing the algorithm underlying our factorization. The complexity of the task is somewhat bounded from below by that algorithm, so closed form solutions are unlikely. When factorizations are nice to describe, it follows that the resulting argument and expression is likely to be somewhat ad hoc, and dependent on the particular structure of the matrix in question.
This is alright, though, since that is part of what makes math fun to do. One strategy that is helpful is to try to write out your matrix in terms of sums of elementary matrices (Matrices $e_{ij}$ which are 1 in the $(i,j)$th entry and zero elsewhere). The algebra for these is very easy to describe, $e_{ij}e_{kl}=\delta_{jk}e_{il}$, or alternatively $e_{ij}e_{jk}=e_{ik}$, and zero otherwise.
This has a seemingly completely unrelated interpretation as follows. Let $X$ be some graph, and associate with $X$ the matrix $$A(X)=\sum_{a\sim b}e_{ab}$$ This matrix is known as the adjacency matrix of $X$, and it can be deduced (exercise for you), that the $(A^d)_{ij}$ is the number of ways to walk from $[i]$ to $[j]$ in $d$ steps.
Surprisingly, this allows us to factor the given matrix. Let's just pretend that our matrix is the $d$th power of some adjacency matrix. The matrix is fixed by cyclic permutations of the columns, which tells us that it is vertex transitive. This means that the degrees of all of our vertices are equal. The sum of the entries in each column, then, must be the degree to the power of the "walk" length. This number is 4, and we'd like to end up with a walk of length greater than 1 because that is how we will factor our resulting matrix, so we choose to look for walks of length 2 in a graph whose degree is 2. Consider then, the graph $X$ whose vertices are $\mathbb{Z}/n\mathbb{Z}$, and where there is an edge between two vertices $a,b$ if $[a-b]=[\pm 1]$ (Draw this, it's not complicated).
Let $A(X)$ be the adjacency matrix of this graph, and verify that $A(X)^2$ is the toeplitz matrix whose determinant we wish to calculate by simply counting the paths of length two from any vertex. It immediately follows that the determinant of our matrix factors as $\det(A(X))^2$. This is much easier to compute, and I leave it to you to do so.
A: Given the $n\times n$ matrix $B$ defined as
$$
b_{i,j} = 
\begin{cases} 
1, & \text{for}\ j = i+2 \pmod n\\ 
1, & \text{for}\ i = j\\ 
0, & \text{otherwise}.
\end{cases}
$$
we have that $A=B \cdot B^T$ (where $B^T$ indicates the transpose of $B$).
On matrix $B$, if we subtract column $i$ from column $i+2$ (for $i=1\dots n-2$) it takes the form
$$
\left(\begin{array}{cc}
I & 0\\
* & C
\end{array}\right)
$$
with $I$ as the identity matrix of order $n-2$ and
$$
C=\left(\begin{array}{cc}
1 & \left(-1\right)^{\frac{n-1}{2}}\\
\left(-1\right)^{\frac{n+1}{2}} & 1
\end{array}\right)
$$
that gives $\det\left(B\right)=2$. Therefore $\det\left(A\right)=4$.
