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?

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}) $$