# Fourier Series Question

## Homework Statement

Find the Fourier series corresponding to the following functions that are periodic over the
interval $$[-\pi,\pi]$$

$$f(x) = 1, -\pi/2 < x< \pi/2; f(x)$$ otherwise.

## Homework Equations

Fourier Series:

$$f(x) = \frac{1}{2}a_0 + \sum^\infty_{n=1}a_n cos\frac{2*\pi*n*x}{l} + \sum^\infty_{n=1} b_n sin\frac{2*\pi*n*x}{l}$$

$$\frac{1}{l}\int^{l/2}_{-l/2}f(x) dx$$

$$a_n = \frac{1}{l}\int^{l/2}_{-l/2}f(x) cos frac{2*\pi*n*x}{l}dx$$

$$a_n = \frac{1}{l}\int^{l/2}_{-l/2}f(x) sin frac{2*\pi*n*x}{l}dx$$

## The Attempt at a Solution

So far I have:

$$a_0 = 1$$

$$a_n = \frac{1}{\pi n}[sin(nx)]^{\pi/2}_{-\pi/2}$$

$$b_n = -\frac{1}{\pi n}[cos(nx)]^{\pi}_{-\pi}$$

But I am not sure what to do now. I seem to be mainly confused about the n's

TFM

My equations didn't come out quite right...Sorry. Should be:

$$a_0 = \frac{1}{l}\int^{l/2}_{-l/2}f(x) dx$$

$$a_n = \frac{1}{l}\int^{l/2}_{-l/2}f(x) cos \frac{2*\pi*n*x}{l} dx$$

$$b_n = \frac{1}{l}\int^{l/2}_{-l/2}f(x) sin \frac{2*\pi*n*x}{l}dx$$

TFM

Note that:

$$\sin( n \cdot \pi /2)= 1$$ if n = 1,3,5...
$$\sin( n \cdot \pi /2) = 0$$ if n = 2,4,6,...

and

$$\cos( n \cdot \pi ) = (-1)^{n}$$

So for $$a_n$$

$$a_n = \frac{1}{\pi n}[sin(nx)]^{\pi/2}_{-\pi/2}$$

n = 1,3,5...

so

$$a_n = \frac{1}{\pi 1}[sin(1x)]^{\pi/2}_{-\pi/2},$$

$$\frac{1}{\pi * 3}[sin(3x)]^{\pi/2}_{-\pi/2},$$

$$\frac{1}{\pi * 5}[sin(5x)]^{\pi/2}_{-\pi/2} ...$$

and

$$\cos( n \cdot \pi ) = (-1)^{n}$$

cos of n pi always = -1? (as long as pi is a whole number)

TFM