Question Find the Fourier series for the function defined by
$$f(x)=\begin{cases} -1, & -\pi\leq x\lt 0 \\ 0, & x=0\\ 1, & 0\lt x\leq \pi \end{cases}.$$
Tell whether the series is an expansion of $f(x)$. Hence deduce the value of the series $$1-\frac{1}{3}+ \frac{1}{5}- \frac{1}{7}+\cdots $$.
Effort: Fourier series of $f(x)$ is
$$\frac{a_0}{2}+\sum\limits_{n=1}^{\infty}(a_n\cos nx+ b_n\sin nx)$$ where
$a_0= \frac{1}{\pi}\int\limits_{-\pi}^{\pi} f(x) dx$,
$a_n= \frac{1}{\pi}\int\limits_{-\pi}^{\pi} f(x) \cos nx dx$
$b_n= \frac{1}{\pi}\int\limits_{-\pi}^{\pi} f(x) \sin nx dx$
Here the function is odd so Fourier coefficients, $a_n=0$ and we have after some calculations $b_n= \frac{2}{\pi}(1-(-1)^n$. Please help me to deduce the value of the last series.
Hint: Recall that a Fourier series decomposes $$ f(x) = \sum a_ne^{inx}. $$ So you need to find the $a_n$. What is their definition? Look it up and compute.