# FS3

Find the Fourier series for $f(x) = 1+x\,$ on $[-\pi,\pi]\,$

The general Fourier series on $[-L,L]\,$ is:

$f(x) = \frac{a_0}{2} + \sum_{k=1}^\infty a_k \, \cos(\frac{k\pi x}{L}) + b_k \, \sin(\frac{k\pi x}{L})\,$

$a_n = \frac{1}{L} \int_{-L}^L f(x) \cos(\frac{n\pi x}{L}) \, dx, \,\,\, n=0,1,2,...\,$

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

The n = 0 case is not needed since the integrand in the formula for $b_0\,$ is $\sin(0)\,$.

In the present problem, $a_n = \frac{1}{\pi}\int_{-\pi}^\pi (1+x) \cos(\frac{n\pi x}{\pi})\,dx = \frac{1}{\pi}\left(\left[\frac{(1+x)\sin(nx)}{n}\right]_{-\pi}^\pi - \int_{-\pi}^\pi \frac{(1+x)\cos(nx)}{n^2}\,dx\right) = 0\,$

But since the right hand side is not defined if n = 0, the 0 index for a will have to be calculated seperately.

$a_0 = \frac{1}{\pi}\int_{-\pi}^\pi (1+x)\,dx = \frac{1}{\pi}\left[x+\frac{1}{2}x^2\right]_{-\pi}^\pi = 2, \,\,\,\,$

$b_n = \frac{1}{\pi}\int_{-\pi}^\pi (1+x) \sin(nx)\,dx = \frac{1}{\pi}\left(-\,\frac{1}{n}\left[(1+x)\cos(nx)\right]_{-\pi}^\pi + \int_{-\pi}^\pi \frac{\cos(nx)}{n}\,dx\right)\,$

$= \frac{1}{\pi}\left(-\,\frac{1}{n}(1+\pi-1+\pi)\cos(nx) + \left[\frac{\sin(nx)}{n^2}\right]_{-\pi}^\pi\right) = \frac{2 (-1)^{n+1}}{n}\,$

So the Fourier series is

$f(x) = 1+x \sim 1 + \sum_{n=1}^\infty \frac{2 (-1)^{n+1}}{n} \sin(nx) \,$ for $[-\pi,\pi]\,$

##### Toolbox

 Get A Wifi Network Switcher Widget for Android