Solution (source code)

= Solution

<Fourier orthogonality> isolates a <coefficient>. Multiplication by $\sin(mx)$ and <integration> over $[0,2\pi]$ annihilates the constant, all <cosine> terms and all <sine> terms except the one with $n=m$, whose squared integral is $\pi$. Thus the corresponding <coefficients> on the two sides must agree for each positive integer $m$.

Multiplication by $\cos(mx)$ works in the same way, while <integration> against the constant mode extracts $a_0$. This is the uniqueness of the <Fourier coefficients>; it does not follow from comparing a few point values of the series.