# Homework Help: Finding a fourier series for a cosine function

1. Sep 6, 2009

### Susanne217

Hi I have been working on a example and have worked it out as this

1. The problem statement, all variables and given/known data

$$f(x) = $$\left( \left \begin{array}{ccc}0 & \mathrm{for} & -\pi < x \leq 0 \\ cos(x) & \mathrm{for} & 0 < x < \pi\end{array}$$ where f is defined on the interval $$]-\pi,\pi[$$. Find the corresponding fourier series for f. and writ the sum for $$x = p \cdot \pi$$ where $$p \in \mathbb{Z}$$ 2. Relevant equations Complex Fourier series is defined as $$\sum_{n=-\infty}^{\infty} c_{n} \cdot e^{i\cdot n \cdot t}$$ where $$c_{n} = \frac{1}{2\pi} \int_{-\pi}^{\pi} f(t) \cdot e^{-i \cdot n \cdot t} dt$$ 3. The attempt at a solution First I find $$c_{0} = \frac{1}{2\pi} \int_{-\pi}^{\pi} cos(t) dt = [\mathrm{sin(t)}]_{\mathrm{t} = -\pi}^{\pi} = 0$$ Next I find $$c_{n} = \frac{1}{2\pi} \int_{-\pi}^{\pi} (cos(t) \cdot cos(n \cdot t) - cos(t) \cdot sin(n \cdot t) \cdot i) dt$$ $$c_{n} = [\frac{{sin(n-1)\cdot t}}{2 \cdot (n-1)} + \frac{{sin(n11)\cdot t}}{2 \cdot (n+1)}-(\frac{{cos(n-1)\cdot t}}{2 \cdot (n-1)} - \frac{{cos(n+1)\cdot t}}{2 \cdot (n+1)}) \cdot i]_{t=-\pi}^{\pi} = \frac{sin(n+1)\cdot \pi}{2\cdot(n+1)}$$ which I then multiply by $$\frac{1}{2\pi}$$ from which I get $$c_{n} = \frac{sin(n+1)}{2(n+1)}$$ Where I end up with the fourier series $$\sum_{n=-\infty}^{\infty} \frac{sin(n+1)}{2(n+1)} \cdot e^{i \cdot n \cdot x}$$ Have I got it right? I fairly new to fourier series so I would be very happy if someone would reflect on my work and comment it please. p.s. Not sure about question two. Do I insert the value of into the sum? Thank you Best Regards Susanne 2. Sep 6, 2009 ### latentcorpse remember that $c_0=\frac{1}{2 \pi} \int_{-\pi}^{\pi} f(t) dt$ but $f(t)$ is not constnat on the interval $[-\pi,\pi]$.... and so $c_0=\frac{1}{2 \pi} \int_{-\pi}^{\pi} f(t) dt=\frac{1}{2 \pi} \int_{-\pi}^0 0 dt + \frac{1}{2 \pi} \int_0^{\pi} \cos{t} dt=\frac{1}{2 \pi} \int_0^{\pi} \cos{t} dt=\frac{1}{2 \pi} \sin{t} |_{0}^{\pi}=0$ which is what you got. but you'll have to do the same when calculating $c_n$ which will probably change things. 3. Sep 6, 2009 ### Susanne217 Hi following your line of thought I then get $$c_{n} = \frac{1}{2\pi} \int_{\pi}^{pi} cos(t) \cdot cos(n \cdot t) - (cos(t) \cdot sin(n \cdot t) \cdot i) dt = \frac{1}{2\pi} \int_{\pi}^{0} cos(t) \cdot cos(n \cdot t) - (cos(t) \cdot sin(n \cdot t) \cdot i) dt + \frac{1}{2\pi} \int_{0}^{pi} cos(t) \cdot cos(n \cdot t) - (cos(t) \cdot sin(n \cdot t) \cdot i) dt$$ where $$c_{n} = (\frac{-1}{2(n+1)\cdot \pi}-\frac{1}{2(n-1)\cdot \pi}) \cdot sin(n \cdot \pi)$$ does that look better? Best Regards Susanne 4. Sep 6, 2009 ### latentcorpse $c_n=\frac{1}{2 \pi} \int_{-\pi}^{\pi} f(t) e^{-int} dt=\frac{1}{2 \pi} \int_{-\pi}^{0} 0 dt + \frac{1}{2 \pi} \int_{0}^\pi} \cos{t} e^{-int} dt$ do you understand why that is? so $c_n=\frac{1}{2 \pi} \int_{0}^\pi} \cos{t} e^{-int} dt=\frac{1}{2 \pi} \int_{0}^\pi} \cos{t} \( \cos{nt}-i \sin{nt}$$$
as the first term disappears entirely

5. Sep 6, 2009

### Susanne217

Hi again yes the reason why that term disappears it do to basic calculus.

I have tried the new version of $$c_{n}$$

and I get

$$c_n = (\frac{-1}{4(n+1)\cdot \pi} - \frac{1}{4(n-1)\cdot \pi}) \cdot sin(n\pi) + \frac{cos(n\cdot \pi) -1}{2 \cdot n \cdot \pi} \cdot i$$

Hopefully this looks better?

Best Regards
Susanne

Last edited: Sep 6, 2009
6. Sep 6, 2009

### latentcorpse

hmmm.
first of all i meant to put a bracket in my last line:

$c_n=\frac{1}{2 \pi} \int_0^{\pi} \cos{t} (\cos{nt}-i \sin{nt}) dt$

then it's just integrating by parts.

i'll assume you managed that ok.

you have $c_n=(\frac{-1}{4(n+1) \cdot \pi}-\frac{1}{4(n-1) \cdot \pi}) \cdot \sin{(n \pi)} + \frac{\cos{(n \cdot \pi)}-1}{2 \cdot n \cdot \pi} \cdot i$

but $\sin{n \pi}=0$ and $\cos{n \pi}=(-1)^n$ which will simplify things i hope...