TITLE: A trigonometric sum (is it a Ramanujan sum?)
QUESTION [5 upvotes]: Let A be the following set: $A=\{x \in \mathbb{N}^+: x\lt3003 \text{ and } (x,3003)=1 \}$.
I am asked to find the value of $$\sum_{n\in A}\sin^2\left( \frac{n\pi}{3003}\right).$$

REPLY [8 votes]: For starters, we have $3003=3\cdot 7\cdot 11\cdot 13$, hence $|A|=\varphi(3003)=1440$.
$\sin^2\theta = \frac{1}{2}\left(1-\cos(2\theta)\right) $, hence the given sum equals $720$ minus half the real part of the sum of the roots of the cyclotomic polynomial 
$$ \Phi_{3003}(x) = x^{1440}-x^{1439}+x^{1437}+\ldots $$
and by Vieta's theorem it follows that
$$ \sum_{n\in A}\sin^2\left(\frac{\pi n}{3003}\right) = \color{red}{720-\frac{1}{2}}.$$

By Von Sterneck's formula for Ramanujan sums we get that, in general,
$$ \sum_{\substack{1\leq n \leq M \\ \gcd(n,M)=1}}\!\!\!\sin^2\left(\frac{\pi n}{M}\right) = \frac{\varphi(M)-\mu(M)}{2}$$
where $\varphi$ is Euler's totient function and $\mu$ is Moebius' function.