Fourier series for function

72 Views Asked by At

Consider the function f(x) = |x|

$ - π \leq x < π $

Compute its Fourier series.

$ a_{0} = \frac{1}{π} \int_{-π}^{π}|x| dx = \frac{2}{π} \int_{0}^{π} x dx $

I get the answer to be pi,

I am having trouble working out an

$ a_{n} = \frac{2}{π} \int_{0}^{π} x \cos \left(nx\right) dx $

doing integration by parts I get

$ \frac{x\sin \left(nx\right)}{n} + \frac{\cos \left(nx\right)}{n^{2} }$

Is this so far correct ?

1

There are 1 best solutions below

4
On BEST ANSWER

$$a_n= \frac{1}{\pi} \int_{-\pi}^{\pi} |x| \cos{kx} dx=\frac{1}{\pi} \int_{-\pi}^{0} (-x) \cos{kx} dx+ \frac{1}{\pi} \int_{0}^{\pi} x \cos{kx}dx$$

We set $-x=u$.

So $\int_{-\pi}^0 (-x) \cos{kx} dx=-\int_{\pi}^0 u \cos{ku} du= \int_0^{\pi} x \cos{kx} dx$.

So $a_n=\frac{2}{\pi} \int_0^{\pi} x \cos{kx}dx= \frac{2}{\pi} \int_0^{\pi} x \left( \frac{\sin{kx}}{k} \right)' dx= \frac{2}{\pi}\left[ x \frac{\sin{kx}}{k}\right]_0^{\pi}- \frac{2}{k \pi}\int_0^{\pi} \sin{kx}dx= -\frac{2}{k^2 \pi}[- \cos {kx}]_0^{\pi}= \frac{-2}{k^2 \pi} [- \cos{k \pi}+ \cos0]=-\frac{2}{k^2 \pi} [1+(-1)^{k+1}]$