[Math] Fourier series expansion for $f(x)=x$ over the interval $-\pi\leq x\leq \pi$

calculusfourier series

Fourier series expansion for $f(x)=x$ over the interval $-\pi\leq x\leq \pi$

Since $f(x)$ is odd $a_n=0$ ,

$$b_n=\frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin(nx)dx=\frac{1}{\pi}\int_{-\pi}^\pi x\sin(nx)dx$$.

$$\left.-\frac{x\cos (nx)}{n}+\dfrac{\sin(nx)}{n^{2}}\right|_{-\pi}^{\pi}$$

How do I get the coefficient $b_n= -\dfrac{2}{n}cos(n\pi)=\dfrac{2}{n}(-1)^{n+1}$?

Best Answer

Notice that $\sin (n\pi) = \sin(-n\pi)=0$. This is because the angles $0, \pi, 2\pi,...$ all lie on the $x$-axis.

Also, $\cos(n\pi) = (-1)^{n}$ because

$$\cos(n\pi) = \frac{e^{in\pi}+e^{-in\pi}}{2} = \frac{(e^{i\pi})^n+(e^{-i\pi})^n}{2}=\frac{(-1)^n+(-1)^n}{2}=(-1)^n$$


You forgot to divide

$$\left.-\frac{x\cos (nx)}{n}+\dfrac{\sin(nx)}{n^{2}}\right|_{-\pi}^{\pi}$$ by $\pi$.

So, you need to have

$$b_n=\frac{1}{\pi}\left.\left[ -\frac{x\cos(nx)}{n} + \frac{\sin(nx)}{n^2} \right]\right\vert_{-\pi}^\pi = -\left.\frac{1}{\pi} \frac{x\cos(nx)}{n}\right|_{-\pi}^\pi$$

because the part with $\sin$ vanishes. This further gives us

$$b_n=-\frac{1}{n\pi} [x\cos(nx)]|_{-\pi}^\pi= -\frac{1}{n\pi}[\pi\cos(nx)-(-\pi)\cos(-n\pi)] = -\frac{1}{n\pi}\cdot 2\pi\cos(n\pi) = \frac{2\cdot(-1)^{n+1}}{n}$$