<s>[INST] Calculate the sum using Fourier series of $\big|\cos(\frac{x}{2})\big|$. I have been given task to evaluate the sum $\dfrac{(-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 $\dfrac{1}{\pi} \cdot (-1)^{n-1} \cdot \dfrac{2}{1-n^2}$ which doesn't help me very much with this task. 
Can somebody give me some advice how to solve this, and more generally how to find an interval of integration to find some sum?
Thanks in advance.
 [/INST] 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}$$
</s>