Finding Fourier cosine series of sine function

2.4k Views Asked by At

I am trying to find Fourier cosine series of following function, but think that I am messing up somewhere.

$$ f(x)=\sin \bigg ( \frac{\pi x}{l} \bigg ) $$ Fourier cosine series can be written as $$ f(x)=\frac{a_0}{2} + \sum\limits_{n=1}^\infty a_n \cos \bigg ( \frac{n \pi x}{l} \bigg )\\ a_n=\frac{2}{l} \Bigg [\int\limits_{0}^l \sin \bigg ( \frac{\pi x}{l} \bigg )\cos \bigg ( \frac{n \pi x}{l} \bigg)\,dx \Bigg]\\ =\frac{-1}{l} \Bigg [\frac{\cos(n(1+\pi))}{\frac{n(1+\pi)}{l}} + \frac{\cos(n(1-\pi))}{\frac{n(1-\pi)}{l}} - \frac{1}{\frac{n(1+\pi)}{l}} + \frac{1}{\frac{n(1-\pi)}{l}} \Bigg]\\ =\Bigg [\frac{-\cos(n(1+\pi))}{n(1+\pi)} + \frac{\cos(n(1-\pi))}{n(1-\pi)} + \frac{1}{n(1+\pi)} - \frac{1}{n(1-\pi)} \Bigg] $$

The problem is I am getting cosine terms in the expansion, which is against my thinking that cosine series expansion of sine function should be zero. Am I messing up in the algebra part or thinking? Can someone comment? Thanks!

2

There are 2 best solutions below

0
On

Certainly you should get cosine terms in the Fourier cosine series for $f(x)$.

I think you are confusing your situation with the result regarding full Fourier series on $-\ell<x<\ell$, $$ {1\over 2}a_0+\sum_{n=1}^\infty a_n\cos(n\pi x/\ell)+b_n\sin(n\pi x/\ell), $$ that says if $f(x)$ is an odd function on $-\ell<x<\ell$, then $a_n=0$ for all $n=0,1,2,\dots$ (and if $f(x)$ is an even function on $-\ell<x<\ell$, then $b_n=0$ for all $n=1,2,\dots$)

0
On

With

$$f(x)=\sin\left(\dfrac{\pi x}{l}\right),$$

you want to find $a_n$. The formula says:

$$a_n=\dfrac{2}{l}\int_0^l \sin\left(\dfrac{\pi x}{l}\right) \cos\left(\dfrac{n\pi x}{l}\right)dx.$$

With $u=\pi x/l$, you get:

$$a_n=\dfrac{2}{\pi}\int_0^\pi \sin(u) \cos(nu)\, du.$$

One of these identities can help you:

$$\int\sin (a_1x) \cos(a_2x)\, dx= -\dfrac{\cos((a_1-a_2)x)}{2(a_1-a_2)}-\dfrac{\cos((a_1+a_2)x)}{2(a_1+a_2)}+C.$$

With $a_1=1$ and $a_2=n$:

$$\int_0^\pi\sin (u) \cos(nu)\, du = -\dfrac{\cos((1-n)\pi)}{2(1-n)}-\dfrac{\cos((1+n)\pi)}{2(1+n)} + \dfrac{1}{2(1-n)}+\dfrac{1}{2(1+n)}$$

If $n$ is even:

$$\int_0^\pi\sin (u) \cos(nu)\, du = -\dfrac{-1}{2(1-n)}-\dfrac{-1}{2(1+n)} + \dfrac{1}{2(1-n)}+\dfrac{1}{2(1+n)}=\dfrac{2}{(1-n)(1+n)}$$

If $n$ is odd:

$$\int_0^\pi\sin (u) \cos(nu)\, du = -\dfrac{1}{2(1-n)}-\dfrac{1}{2(1+n)} + \dfrac{1}{2(1-n)}+\dfrac{1}{2(1+n)}=0$$

Special cases:

$$\int_0^\pi\sin (u)\, du =2$$ $$\int_0^\pi\sin (u) \cos(u)\, du =0$$

Now, you can find the expression for $a_n$.