1

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!

David
  • 1,100
b2850624
  • 167
  • If you compute the cosine series for the sine (restricted to $[0,l]$) what you will get is the even periodic extension of sine. You also should not use $n$ as both a parameter in the original function as well as the index for the Fourier coefficients (you have to fix the function at the outset, so use $\sin(m x / l)$ for some fixed $m$ if you want this generality. – BaronVT Nov 21 '14 at 20:11
  • 1
    @BaronVT sorry, there were typos. Original function does not have $n$ but $\pi$ – b2850624 Nov 21 '14 at 23:18
  • http://math.stackexchange.com/questions/247669/is-it-possible-for-cosine-functions-to-have-fourier-sine-series-expressions-or-s?rq=1 – JohnD Nov 22 '14 at 00:18

2 Answers2

1

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$)

JohnD
  • 14,392
0

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$.

David
  • 1,100