Find a determinant of this matrix. I've got matrix
\begin{equation*}
A=\left(
\begin{array}{ccccccc}
a & 0 & 0 & \ldots & 0 & 0 & b \\
0 & a & 0 & \ldots & 0 & b & 0 \\
0 & 0 & a & \ldots & b & 0 & 0 \\
\ldots & \ldots & \ldots & \ldots \\
0 & 0 & b & \ldots & a & 0 & 0 \\
0 & b & 0 & \ldots & 0 & a & 0 \\
b & 0 & 0 & \ldots & 0 & 0 & a \\
\end{array}
\right)
\end{equation*}
оf $2n$ size (number columns and rows). I need to find it's determinant using a traditional formula:
$$\det A = \sum_{\sigma \in S_{2n}}{\text{sgn}(\sigma)\prod_{i=0}^{2n}{A_{i\sigma(i)}}}$$
Where $\text{sgn}(\sigma)$ is $(-1)^{inv(\sigma)}$, and $inv(\sigma)$ is the number of inversions in $\sigma$.
It's easy to see that non-null terms in will be if and only if $\sigma(i) \in \{i, 2n - i + 1\}$.
So, the answer for me looks like: $\text{sgn}(\sigma_1)a^{k_1}b^{2n - k_1} + \text{sgn}(\sigma_2)a^{k_2}b^{2n - k_2}\ldots$. (where each $sgn(\sigma_i)$ is $\pm1$).
But I have no idea how to expand this and count all $\sigma$'s.
 A: We have to focus on permutations $\sigma \in S_{2n}$ such that $\sigma(i) \in\{i, 2n-i+1\}$ for all $i \in \{1, \ldots, 2n\}$.
To uniquely determine such a permutation, we have to pick $k$ numbers out of $1, 2, \ldots, n$ which will be fixed points of $\sigma$. If $i$ is one of the remaining $n-k$ numbers, then set $\sigma(i)=2n-i+1$.
The action of $\sigma$ on $n+1, \ldots, 2n$ is now uniquely determined like this:
$$\sigma(i) = \begin{cases} 2n-i+1, &\quad\text{if }i \in \sigma(\{1,\ldots, n\}),\\
i,  &\quad\text{otherwise}.\\\end{cases}$$
To find the sign of $\sigma$, notice that $\sigma$ is a composition of $n-k$ transpositions $(i,  2n-i+1)$ each having sign $-1$ so $\operatorname{sgn}(\sigma) = (-1)^{n-k}$.
Now if $i$ is a fixed point of $\sigma$ then $A_{i\sigma(i)} = a$ and otherwise $A_{i\sigma(i)} = b$. Since $\sigma$ as above has $2k$ fixed points and $2n-2k$ other points, it yields the product $a^{2k}b^{2n-k}$ in the determinant formula.
All in all, we get
$$\det A = \sum_{\sigma \in S_{2n}} \operatorname{sgn}(\sigma) \prod_{i=1}^{2n} A_{i\sigma(i)} = \sum_{k=0}^{n}{n\choose k}(-1)^{n-k} a^{2k}b^{2n-2k} = (a^2-b^2)^n.$$
A: This is simply the value $(a^2-b^2)^n$
