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

calculusfourier series

I am totally new to Fourier series. Here I try to compute the Fourier series for the function $f(x)=x$ over the interval $-\pi\leq x \leq\pi$.

Since $f(x)$ is an odd function:

$a_n=0$ (why is this the case?), $$b_n=\frac{1}{\pi}\int_{-\pi}^\pi f(x)\sin(nx)dx=\frac{1}{\pi}\int_{-\pi}^\pi x\sin(nx)dx$$.

Which means $${ -\dfrac{x\cos(nx)}{n}+\dfrac{\sin(nx)}{n^2}}$$ (There should be a evaluate sign here but I don't know how to type it in latex)

What should I do next?

I am just tracing the steps from this website: http://www.sosmath.com/fourier/fourier1/fourier1.html

I know the end result should be $2(\sin(x)-\dfrac{\sin(2x)}{2}+\dfrac{\sin(3x)}{3}$…)

Best Answer

By partial integration $$b_n=\frac{1}{\pi}\int_{-\pi}^{\pi}x\sin(nx)dx=-\left.\frac{x\cos(nx)}{n\pi}\right|_{-\pi}^{\pi}+\frac{1}{n\pi}\int_{-\pi}^{\pi}\cos(nx)dx$$ The last integral is zero! The left part is $$-\left.\frac{x\cos(nx)}{n\pi}\right|_{-\pi}^{\pi}=\frac{2}{n}\cdot (-1)^n$$