Determinant of circulant matrix

Call that matrix $A$ and notice that it is a permutation of a circulant matrix, $$ A = CP $$ Where $P$ is a permutation matrix with ones on the anti-diagonal, and zeros in all other positions. Then

$$ \det[A] = \det[CP] = \det[C]\det[P] $$ The determinant of the permutation part can be shown to depend on the size $n$. It can be written as $$ \det[P] = (-1)^{\left\lfloor\frac{n}{2}\right\rfloor} $$ Now $C$ is $$ \begin{bmatrix} a_{n} & a_{n-1} & a_{n-2} & \cdots & a_1\\ a_{1} & a_{n} & a_{n-1} & \cdots & a_2\\ a_{2} & a_{1} & a_n & \cdots & a_3\\ \vdots & \vdots & \vdots & \ddots & \vdots\\ a_{n-1} & a_{n-2} & a_{n-3} & \cdots & a_{n}\\ \end{bmatrix} $$ $C$ is a circulant matrix. Define the associated polynomial $$ f(\omega) = a_n + \sum_{k=1}^{n-1} a_k\omega^k $$ Then using the product formula on the Wikipedia page for circulant matrices, $$ \det[C] = \prod_{j=0}^{n-1}f(\omega_j), $$ where $\omega_j=e^{\frac{2\pi i j}{n}}$ and $i=\sqrt{-1}$. Then the final formula is $$ \det[A] = (-1)^{\left\lfloor\frac{n}{2}\right\rfloor}\prod_{j=0}^{n-1}\left(a_n + \sum_{k=1}^{n-1} a_k\omega_j^k\right) $$


This answer is just the extension of the above rajb245's answer.

To answer more accurately also for the question "When the determinant is zero?" it's sufficient to quote Wikipedia.

Let the polynomial $ f(x) = a_n + a_1 x + \dots + a_{n-1} x^{n-1} $ be so called the ''associated polynomial'' of circulant matrix $C$. Matrix $C$ is defined as in the above rajb245's answer.

The rank of circulant matrix $ C $ is equal to $ n - d $, where $ d $ is the degree of a polynomial degree of $\gcd( f(x), x^n - 1) $.

So the determinant is equal to zero when $f(x)$ and $x^n-1$ have some common divisors.

This property can be used for constructing a circulant matrix which would be at the same time singular using fact that $x^n-1$ has real root $ \{1 \}$ for odd $n$ and $ \{ -1, +1 \}$ real roots for even $n$.

For example let $n=4$.
Then we have general form of associated polynomial for root $-1$.

$f(x)=(x+1)(b_3+b_1x+b_2x^2)= \\ b_3+(b_1+b_3)x+(b_2+b_1)x^2+b_2x^3 = \\ a_4 + a_1 x + a_2 x^2+ a_3 x^3 $

Take for example $f(x) = 6+7x+3x^2+2x^3$.

Indeed $\det{\begin{bmatrix} 6 & 2 & 3 & 7 \\ 7 & 6 & 2 & 3 \\ 3 & 7 & 6 & 2 \\ 2 & 3 & 7 & 6 \end{bmatrix}}=0$ (circulant matrix)

Also for corresponding anticirculant matrix (of the form as in the question)

$\det{\begin{bmatrix} 7 & 3 & 2 & 6 \\ 3 & 2 & 6 & 7 \\ 2 & 6 & 7 & 3 \\ 6 & 7 & 3 & 2 \end{bmatrix}}=0$.