1. Feb 17, 2015

### bznm

1. The problem statement, all variables and given/known data
I have solved the following exercise, but I have obtained the half of the correct result! I can't understand where is the problem...

$f(x)=\begin {cases} 0, x \in[-\pi, 0]\\cos x, x \in[0, \pi]\end{cases}$

1) Find the Fourier Series (base: ${\frac{1}{\sqrt{2 \pi}}, \frac{1}{\sqrt{\pi}} \cos nx, \frac{1}{\sqrt \pi}\sin nx}$
2) Evaluate the Fourier Series in $x=\pi/4$ to prove $\sum_{k=1}^{\infty} \frac {k sin (k \pi/2)}{4k^2-1}=\frac{\pi}{8}cos \frac{\pi}{4}$

I know that the result that I have to obtain has to be the result that I have just written (so I have to exclude a typo), because the second part of the exercise says that I have to consider only the part of the function in $[0, \pi]$ and do an odd extension. Then, find the new Fourier Series and use it to re-find the relation in point 2). And, for this part of the exercise, I obtain the correct result!

2. Relevant equations
$\displaystyle P(x)=\frac{a_0}{\sqrt{2 \pi}}+ \sum_{n=1}^{\infty} \frac{a_n}{\sqrt{\pi}} cos nx+\sum_{n=1}^{\infty}\frac{b_n}{\sqrt \pi} sin nx$

$\displaystyle a_0=\frac{1}{\sqrt{2\pi}} \int_{-\pi}^{\pi} f(x) dx$
$\displaystyle a_n=\frac{1}{\sqrt\pi} \int_{-\pi}{\pi} f(x) cos nx dx$
$\displaystyle b_n=\frac{1}{\sqrt\pi} \int_{-\pi}{\pi} f(x) sin nx dx$

3. The attempt at a solution
Considering this particular function, I have:

$\displaystyle a_0= \frac{1}{\sqrt{2\pi}} \int_{0}^{\pi}cosx dx=\frac{1}{\sqrt{2\pi}} [sinx]_{0}^{\pi}=0$

$a_n=\frac{1}{\sqrt\pi} \int_{0}^{\pi} \cos nx \cdot \cos x dx=0$ (I don't post the proceeding, it's to long to write in latex code) (http://www.wolframalpha.com/input/?i=cos+nx*cos+x+dx+from+0+to+pi)

$\displaystyle b_n=\frac {1}{\sqrt \pi} \int_{0}{\pi} \cos n \cdot \sin nx dx=\frac {1}{\sqrt \pi} \frac {((-1)^n+1)n}{n^2-1}=$ (http://www.wolframalpha.com/input/?i=sin+nx*cos+x+dx+from+0+to+pi)

Considering only even $n$, I obtain:

$P(x)=\displaystyle \sum_{k=1}^{\infty} \frac{1}{\pi}\frac{4k}{4k^2-1} sin (2kx)$

If $x=\pi/4$: $\displaystyle \sum_{k=1}^{\infty}\frac{k}{4k^2-1} sin (k\pi/2)= \frac{\pi}{4}cos{\pi/4}$ :(

Many thanks for the help!

2. Feb 17, 2015

### vela

Staff Emeritus
One problem I see is with your calculation of $a_n$. What happens when $n=1$? The integral clearly doesn't vanish.

You have a similar problem with $b_n$. Your expression isn't defined for $n=1$.

3. Feb 17, 2015

### bznm

oh, wonderful! you're right! Thanks a lot!!! :)

($b_n$ for n=1 is 0)