# Fourier Series of The Sine Function

I am computing the Fourier series of

$$f(x)=\sin\frac{\pi x}{L}.$$

The Fourier series of a piecewise smooth function $f(x)$ defined on the interval $-L\leq x\leq L$ is given by

$$f(x)\sim a_0+\sum_{n=1}^{\infty}a_n\cos\frac{n\pi x}{L}+\sum_{n=1}^{\infty}b_n\sin\frac{n\pi x}{L},$$

where

\begin{align} a_0&=\frac{1}{2L}\int_{-L}^{L}f(x)\,dx,\\ a_n&=\frac{1}{L}\int_{-L}^{L}f(x)\cos\frac{n\pi x}{L}\,dx,\\ b_n&=\frac{1}{L}\int_{-L}^{L}f(x)\sin\frac{n\pi x}{L}\,dx.\\ \end{align}

Since $f$ is an odd function, we have that both $a_0$ and $a_n$ are equal to zero. However, $b_n$ is the integral of an even function. Hence

$$b_n=\frac{2}{L}\int_{0}^{L}f(x)\sin\frac{n\pi x}{L}\,dx.\tag{1}$$

But it turns out that $(1)$ is equal to zero, because

$$b_n=\frac{2L\sin(n\pi)}{\pi(1-n^2)}=0,\qquad n\in\mathbb{N}.$$

On the other hand, my book claims that $b_n=1$. Why is this so?

-
There's no $x$ on the right side. Presumably you meant $f(x) = \sin( \pi x/L)$. –  Robert Israel Oct 22 '12 at 22:26
I'm sorry. You're correct; that's what I meant (somewhat). –  Josué Molina Oct 22 '12 at 22:28

A trigonometric polynomial is equal to its own fourier expansion. So f(x)=sin(x) has a fourier expansion of sin(x) only (from $[-\pi,\pi]$ I mean). The series is finite just like how the taylor expansion of a polynomial is itself (and hence finite). In addition, $b_n=0$ IF $n\neq1$ because your expression is undefined for $n=1$. For all other values of $n$, you are correct and $b_n=0$. And you can see that from equation (1) too. $n=1$ must be handled separately. And when you do compute the integral with $n=1$, you will get $b_1=1$.
$$\sin\left( \frac{n \pi x}{L} \right) \sin\left(\frac{\pi x}{L}\right) = \frac{1}{2}\cos\left(\frac{(n-1)\pi x}{L}\right) - \frac{1}{2}\cos\left(\frac{(n+1)\pi x}{L}\right)$$ But when integrating this, you want to treat the case $n=1$ separately (the general form has $n-1$ in the denominator, which wouldn't make sense).