Coefficient Calculation on Fourier Series Under two minutes, Yes, How?! Example of one Question for preparing the entrance exam: Fourier series of function:
$$ f(x)=f(x+2\pi), f(x) =\left\{
  \begin{array}{rcr}
    1 &     & -\pi <x<0 \\
    \sin x &  & 0<x<\pi \\
  \end{array}
\right. $$
be like as:
$$ f(x)=\frac{a_0}{2}+\Sigma_{n=1}^{\infty} (a_n \cos nx+b_n \sin nx)   $$
(Question) so the coefficient is:
$$a_n=0,n=2k+1,b_n=0,n=2k$$
My challenge is via the coefficient,  (i.e: calculate the coefficient) under two minutes that consider for each question? Is there any way to calculate this shortly?
Option $1) a_n=0,n=2k+1,b_n=0,n=2k+1$
Option $2) a_n=0,n=2k,b_n=0,n=2k+1$
Option $3) a_n=0,n=2k,b_n=0,n=2k$
Option $4) a_n=0,n=2k+1,b_n=0,n=2k $ (solution)
Very nice short solution is get by my friends, it's not understandable for me, anyone could describe it?

 A: The solution is not hard:
I think:
$$a_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1cos(nx)dx + \int\limits_{0}^{\pi}sin(x)cos(nx) dx) = \frac{1}{\pi} \int\limits_{0}^{\pi}sin(x)cos(nx) dx = \frac{1}{\pi} \frac{cos(n\pi)+1}{1-n^2}$$ 
$$b_{n} = \frac{1}{\pi} (\int\limits_{-\pi}^{0}-1sin(nx)dx + \int\limits_{0}^{\pi}sin(x)sin(nx) dx)=\frac{1}{\pi} (\frac{cos(nx)}{n}|_{-\pi}^{0} + \frac{\pi}{2}) = \frac{1}{\pi} (\frac{1-(-1)^n}{n}+\frac{\pi}{2}) $$ 
A: They're not asking for all the coefficients, just which ones are zero.
Your friend seems to be making arguments to linearity. In the first two (top) graphs, they split into the "1" part and the "sin" part, each 0 on the half of the period. Then he writes the first part as a sum again: a constant 1/2, and an alternating-sign 1/2. (The first two graphs on the bottom row). Similarly with sin, he gets a $\frac{1}{2}\sin(x)$ and a $\frac{1}{2}|\sin(x)|$ term. The original function is the sum of these four terms, so the Fourier transform is the sum of the Fourier transforms of these four terms.
The Fourier transform of the first term is trivial: $a_0=1$. The Fourier transform of the third term is also trivial: $b_1 = 1$. This is actually already enough to fully determine the answer then! (Note: this is assuming that the second and fourth terms don't completely cancel those out. Comparing the magnitudes I can quickly convince myself of this.)
To be slightly more rigorous, your friend considers the parity of coefficients on the other terms as well. The second term has all the odd part left, and the fourth term has all the even part left, so the second gives us $b_n$ terms and the fourth gives $a_n$ terms. In the second term, it's completely odd around $x=\pi$, so all terms must be odd frequencies ($n=2k+1$). Similarly on the fourth one, the entire function is even around $x=\pi$, so everything must be even frequencies so as to maintain that symmetry ($n=2k$).
