# Calculate the sum using Fourier series $\big|\cos(\frac{x}{2})\big|$.

I have been given task to evaluate the sum $\frac{(-1)^{n-1}}{4n^2-1}$ using Fourier series for function $|\cos{\frac{x}{2}}|$. I used the interval $(-\pi, +\pi)$ for evaluation of the sum and I noticed that $|\cos{\frac{x}{2}}|$ = $\cos{\frac{x}{2}}$ on this interval which made my life a lot easier :), and also that $a_n$ does not exist in this Fourier series (except $a_0$), but when i calculate $b_n$ i get $\frac{1}{\pi} \cdot (-1)^{n-1} \cdot \frac{2}{1-n^2}$ which can't help me very much with this task.

Can somebody give me some advice how to solve this, and generally how to find an interval of integration to find some sum.

-
You must have miscalculated. $\lvert\cos \frac x2\rvert$ is an even function, so all the sine coefficients vanish. It's not constant, so $a_0$ cannot be the only non-vanishing cosine coefficient. –  Daniel Fischer Dec 24 '13 at 11:26
Just a note: your interval of integration if always one period. Often it's interesting to make it centered at $0$, since symmetry of the function will lead to simplification. Here since your function is even, you can halve the interval and it's what I do in the fourth equation line of my answer. –  Jean-Claude Arbaut Dec 24 '13 at 12:12
Of course, I noticed that all sine coefficients vanish, but I wrote this for unknown reasons :) Thank you all for your answers :) –  Petar Vukmirovic Dec 24 '13 at 12:18

This is a classic application of Fourier series to computation of series.

First, cosine is $2\pi$-periodic, thus $f(x)=|\cos x/2|$ is $2\pi$-periodic. Since it's even, the sine coefficient will vanish, I will only consider the cosine coefficients.

With $T=2\pi$, you have (I write $S(x)$ for the series, not $f$ since you have also to prove $S=f$, but it follows from the fact that $f$ is continuous and piecewise $C^1$, and Dirichlet theorem).

$$S(x)=\frac{a_0}2+\sum_{n=1}^\infty a_n \cos \left(\frac{2\pi}{T}nx\right)$$

$$a_n=\frac 2T\int_{-T/2}^{T/2} f(x) \cos \left(\frac{2\pi}{T}nx \right)\mathrm{d}x$$

Since $\cos (x/2)\geq 0$ for $x\in[-\pi,\pi]$,

$$a_n=\frac 1{\pi}\int_{-\pi}^{\pi} \cos\left(\frac x2\right) \cos \left(nx \right)\mathrm{d}x$$ $$a_n=\frac{2}{\pi}\int_0^{\pi} \cos\left(\frac x2\right) \cos \left(\frac{2nx}2 \right)\mathrm{d}x$$

And since $2\cos a\cos b=\cos(a+b)+\cos(a-b)$, $$a_n=\frac{1}{\pi}\int_0^{\pi} \cos\left(\frac {2n+1}2x\right) +\cos\left(\frac {2n-1}2x\right)\mathrm{d}x$$ $$a_n=\frac{1}{\pi}\left[\frac 2{2n+1}\sin \left(\frac {2n+1}2x\right) + \frac 2{2n-1}\sin \left(\frac {2n-1}2x\right)\right]_0^\pi$$

$$a_n=\frac{1}{\pi} \left(\frac 2{2n+1}\sin \left(\frac {2n+1}2\pi\right) + \frac 2{2n-1}\sin \left(\frac {2n-1}2\pi\right)\right)$$

And $\sin \left(\frac {2n+1}2\pi\right)=\sin \left(n\pi+\frac {\pi} 2\right)=(-1)^n$, so

$$a_n=\frac{1}{\pi} \left(\frac 2{2n+1}(-1)^n - \frac 2{2n-1}(-1)^n\right)$$

$$a_n=\frac{2(-1)^n}{\pi}\left(\frac 1{2n+1} - \frac 1{2n-1}\right)=\frac{2(-1)^n}{\pi}\frac{-2}{4n^2-1}$$

$$a_n=\frac{4}{\pi}\frac{(-1)^{n-1}}{4n^2-1}$$

And $a_0=\frac 4{\pi}$

Now, your function is continuous and piecewise $C^1$, so $f=S$ and

$$\left|\cos \frac x2\right|=\frac{2}{\pi}+\frac{4}{\pi}\sum_{n=1}^\infty \frac{(-1)^{n-1}}{4n^2-1} \cos nx$$

And for $x=0$,

$$1=\frac{2}{\pi}+\frac{4}{\pi}\sum_{n=1}^\infty \frac{(-1)^{n-1}}{4n^2-1}$$

And finally,

$$\sum_{n=1}^\infty \frac{(-1)^{n-1}}{4n^2-1}=\frac {\pi}4-\frac{1}{2}$$

-
$\lvert \cos \frac{x}{2}\rvert$ has primitive period $2\pi$, not $\pi/2$. –  Daniel Fischer Dec 24 '13 at 11:35
Thank you very much :) –  Petar Vukmirovic Dec 24 '13 at 12:18