# Math Help - fourier series

1. ## fourier series

g is periodic of period 2pi
and, for x 2 (−pi, pi] are

given by the formulae:

g(x) = 0, -pi < x </= 0
sin x 0 < x < pi

I really dont understand how to go about this, since it seems neither to be an even or odd function. Do I need to integrate separately over -pi to 0 and then 0 to pi?

many thanks

2. $g(x) = \begin{cases} 0 & \text{if } -\pi < x \leq 0 \\ \sin x & \text{if } 0 < x < \pi \end{cases}$

You are correct. Since g(x) is neither even nor odd, you have to split your integrals over the appropriate intervals:

\begin{aligned} a_n & = \frac{1}{\pi} \int_{-\pi}^{\pi} g(x)\cos (nx) \ dx \\ & = \frac{1}{\pi} \left( \int_{-\pi}^{0} g(x)\cos (nx) \ dx + \int_{0}^{\pi} g(x)\cos (nx) \ dx \right) \\ & \ \ \vdots \end{aligned}

3. sorry

I follow what I have to do but I end up having to integrate sinx sinnx.. is this right? could somebody please go through the methid?

many thanks

4. Originally Posted by James0502
sorry

I follow what I have to do but I end up having to integrate sinx sinnx.. is this right? could somebody please go through the methid?

many thanks
These might help

$\int_0^{\pi} sin x \sin n x\, dx = \left\{ \begin{array}{cc} \frac{\pi}{2} ,&\mbox{ if } n = 1 \\ 0 , & \mbox{ if } n \ne 1 \end{array} \right.$

$\int_0^{\pi} sin x \cos n x\, dx = \left\{ \begin{array}{cc} 0 ,&\mbox{ if } n = 1 \\ - \frac{1+\cos n \pi}{n^2-1} , & \mbox{ if } n \ne 1 \end{array} \right.$

5. Could someone please check my working so far..

I get a[n] = 1/2pi[((-1)^n+1)/(n+1) + ((-1)^(n+1))/(1-n))]

a[0] = 1/2

Is this correct? What about when n = 1? I did as above but this meant I could not eliminate anything for being an odd/even function..

many thanks

6. Originally Posted by James0502
Could someone please check my working so far..

I get a[n] = 1/2pi[((-1)^n+1)/(n+1) + ((-1)^(n+1))/(1-n))]

a[0] = 1/2

Is this correct? What about when n = 1? I did as above but this meant I could not eliminate anything for being an odd/even function..

many thanks
Here are the first few terms in the Fourier series

$g \approx \frac{1}{\pi} + \frac{1}{2} \sin x - \frac{2}{3 \pi} \cos 2x - \frac{2}{15 \pi} \cos 4 x - \frac{2}{35 \pi} \cos 6x - \frac{2}{63 \pi} \cos 8x$

and a picture to go with it (the hint of a blue curve is the original whereas the red, the approximation).