Fourier series question - represent $x$ as a series of $\cos$

71 Views Asked by At

I was asked to represent $f(x)=x$ in $(0,\pi)$ as a sum of $\cos$ functions, using fourier series.

I couldn't solve it on my own, but here is what the teacher did, and I don't fully understand why this is true. Ill show you what he did but spare you the long integrations.

he calculated $a_0$:

$a_0=\frac{1}{\pi} \int_{0}^{\pi}f(x)dx=\frac{1}{\pi} \int_{0}^{\pi}xdx=\frac{\pi}{2}$

He then calculated $a_n$:

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

And so according to him, in $(0,\pi)$ we can represent $f(x)=a_0+\sum_{n=1}^{\infty}a_n\cos (nx)=\frac{\pi}{2}+\sum_{n=1}^{\infty}\frac{2((-1)^n-1)}{\pi n^2}\cos(nx)$

And I don't understand at all why that's true.

The fourier series include not just $\cos$, but $\sin$ as well. Can we just ignore the $\sin$ part and it will still converge to the right value?

Also, the coefficients seems to have been calculated wrong. If we would have wanted a fourier series (not just $\cos$) then we would have had $a_0=\frac{1}{2\pi} \int_{0}^{\pi}f(x)dx$ and $a_n=\frac{1}{\pi}\int_{0}^{\pi}f(x)\cos(nx)dx$

He multiplied the coefficients by $2$, and ignored the $\sin$ part. Why is this result correct?