TITLE: Largest possible value of trigonometric functions
QUESTION [8 upvotes]: Find the largest possible value of 
$$\sin(a_1)\cos(a_2) + \sin(a_2)\cos(a_3) + \cdots + \sin(a_{2014})\cos(a_1)$$
Since the range of the $\sin$ and $\cos$ function is between $1$ and $-1$, shouldn't the answer be $2014$?

REPLY [4 votes]: From
$$
f_n(a) = \sum_{k=1}^n \sin a_k \cos a_{k+1}
$$
with $a_{n+1} = a_1$
the stationary points are located at the solutions for
$$
\frac{\partial }{\partial a_k}f_n(a) = -\sin a_{k-1}\sin a_k + \cos a_k \cos a_{k+1} = 0
$$
and then
$$
\tan a_n\tan a_{n-1}\cdots\tan a_{2} = \cot a_1
$$
or 
$$
\tan a_n\tan a_{n-1}\cdots\tan a_{2}\tan a_1 = 1
$$
or
$$
\prod_k\sin a_k = \prod_k\cos a_k
$$
which is obtained for $a_k = \frac{\pi}{4}$ when
$$
f_n(a) = \frac n2
$$