TITLE: Determinant of circulant matrix
QUESTION [11 upvotes]: Find the determinant of the following matrix in the terms of $a_1,a_2,\cdots,a_n$ explicitly,
$$
\begin{bmatrix}
a_1 & a_2 & a_3 & \cdots & a_n\\
a_2 & a_3 & a_4 & \cdots & a_1\\
a_3 & a_4 & a_5 & \cdots & a_2\\
\vdots & \vdots & \vdots & \ddots & \vdots\\
a_n & a_1 & a_2 & \cdots & a_{n-1}\\
\end{bmatrix}
$$
When the determinant is zero?

REPLY [6 votes]: 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$.