Fourier cosine series and sum help I have been having some problems with the following problem:
Find the Fourier cosine series of the function $\vert\sin x\vert$ in the interval $(-\pi, \pi)$. Use it to find the sums
$$ \sum_{n\: =\: 1}^{\infty}\:\ \frac{1}{4n^2-1}$$  and $$ \sum_{n\: =\: 1}^{\infty}\:\ \frac{(-1)^n}{4n^2-1}$$
Any help is appreciated, thank you.
edit:I have gotten as far as working out the Fourier cosine series using the equations for cosine series 
$$\phi (X) = 1/2 A_0 +  \sum_{n\: =\: 1}^{\infty}\:\ A_n \cos\left(\frac{n\pi x}{l}\right)$$ and 
$$A_m = \frac{2}{l} \int_{0}^{l} \phi (X) \cos\left(\frac{m\pi x}{l}\right) dx $$
I have found $$A_0 = \frac{4}{l}$$ but the rest of the question is a mess on my end and then I don't know how to relate the rest of it back to those sums.
 A: $f(x) = |\sin(x)| \quad \Rightarrow\quad f(x) = \left\{ 
  \begin{array}{l l}
    -\sin(x) & \quad \forall x \in [- \pi, 0\space]\\
   \sin(x) & \quad \forall x \in [\space 0,\pi\space ]\\
  \end{array} \right.$
The Fourier coefficients associated are 
$$a_n= \frac{1}{\pi}\int_{-\pi}^\pi f(x) \cos(nx)\, dx = \frac{1}{\pi} \left[\int_{-\pi}^0 -\sin (x) \cos(nx)\, dx + \int_{0}^\pi \sin(x) \cos(nx)\, dx\right], \quad n \ge 0$$
$$b_n= \frac{1}{\pi}\int_{-\pi}^\pi f(x) \sin(nx)\, dx = \frac{1}{\pi} \left[\int_{-\pi}^0 -\sin (x) \sin(nx)\, dx + \int_{0}^\pi \sin(x) \sin(nx)\, dx\right], \quad n \ge 1$$
All functions are integrable so we can go on and compute the expressions for $a_n$ and $b_n$.
$$a_n  = \cfrac{2 (\cos(\pi n)+1)}{\pi(1-n^2)}$$
$$b_n = 0$$
The $b_n = 0$ can be deemed obvious since the function $f(x) = |\sin(x)|$ is an even function. and $a_n$ could have been calculated as $\displaystyle a_n= \frac{2}{\pi}\int_{0}^\pi f(x) \cos(nx)\, dx $ only because the function is even.
The Fourier Series is $$\cfrac {a_0}{2} + \sum^{\infty}_{n=1}\left [ a_n \cos(nx) + b_n \sin (nx) \right ]$$
$$= \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{(\cos(\pi n)+1)}{(1-n^2)}\cos(nx)\right )$$
$$= \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{((-1)^n+1)}{(1-n^2)}\cos(nx)\right )$$
$$= \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{2}{(1-4n^2)}\cos(2nx)\right )$$
Since for an odd $n$, $((-1)^n+1) = 0$ and for an even $n$, $((-1)^n+1) = 2$
At this point we can't just assume the function is equal to its Fourier Series, it has to satisfy certain conditions. See Convergence of Fourier series.
Without wasting time, (you still have to prove that it satisfies those conditions) we assume the Fourier Series converges to our function i.e
$$f(x) = |\sin(x)| = \cfrac {2}{\pi}\left ( 1 + \sum^{\infty}_{n=1} \cfrac{2}{(1-4n^2)}\cos(2nx)\right )$$
Note that $x=0$ gives $\cos(2nx) = 1$ then 
$$f(0) = |\sin(0)| = \cfrac {2}{\pi}\left ( 1 + 2\sum^{\infty}_{n=1} \cfrac{1}{(1-4n^2)}\right ) =0$$ which implies that
$$\sum^{\infty}_{n=1} \cfrac{1}{(1-4n^2)} = \cfrac {-1}{2}$$ and $$\boxed {\displaystyle\sum^{\infty}_{n=1} \cfrac{1}{(4n^2 -1)}= -\sum^{\infty}_{n=1} \cfrac{1}{(1-4n^2)} = \cfrac {1}{2}}$$
Observe again that when $x = \cfrac \pi 2$, $\cos (2nx) = cos(n \pi) = (-1)^n$, thus
$$f \left (\cfrac \pi 2 \right) = \left |\sin \left (\cfrac \pi 2\right )\right | = \cfrac {2}{\pi}\left ( 1 + 2\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(1-4n^2)}\right ) =1$$ which implies that
$$\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(1-4n^2)} = \cfrac {1}{4}(\pi -2)$$ and $$\boxed {\displaystyle\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(4n^2 -1)}= -\sum^{\infty}_{n=1} \cfrac{(-1)^n}{(1-4n^2)} = \cfrac {1}{4}(2-\pi)}$$
A: There is an alternative way to calculating the Fourier series as follows. The Fourier series for a periodic function $f(x)$ of period $2\pi$ (written $f(x) \sim \sum a_ne^{inx}$) is the sum
$$\sum a_n e^{inx}$$
where the Fourier coefficients $a_n$ are defined by $a_n = \frac{1}{2\pi}\int_{-\pi}^\pi f(x)e^{-inx} dx$. Now in your case, you can split the integral up into
$$\frac{1}{2\pi} \left(\int_{-\pi}^0 -\sin x e^{-inx} dx + \int_0^\pi \sin x e^{-inx} dx\right).$$
Now recall that $\sin x = \frac{e^{inx} - e^{-inx}}{2i}$ and chuck this into the integral to get the Fourier coefficient $a_n$ and hence you will obtain your Fourier series. You should get (I'm not spoiling anything because you can just chuck it into mathematica) that
$$f(x) \sim \sum_{n \in \Bbb{Z}} \frac{(1 + (-1)^n)e^{inx}}{\pi (1- n^2)} $$ Now to complete your problem in evaluating that sum, I suggest the following: The fourier series of $f(x)$ is absolutely convergent so we can say that 
$$f(x) = \sum_{n \in \Bbb{Z}} \frac{(1 + (-1)^n)e^{inx}}{\pi (1- n^2)}. $$
For $n$ odd, the sum is zero so actually you can write
$$f(x) = \sum_{n \in \Bbb{Z}}  \frac{2e^{2inx}}{\pi (1- (2n)^2)}.$$
Now put $x = \pi$ so that $f(\pi) =0.$ Then we get that
$$\begin{eqnarray*} 0 = \sum_{n \in \Bbb{Z}}  \frac{2e^{2in\pi}}{\pi (1- (2n)^2)} &=& \sum_{n\in\Bbb{Z}} \frac{2}{\pi (1- (2n)^2)} \\
&=&\frac{2}{\pi} + \sum_{n\in\Bbb{Z}, n \geq 1}\frac{4}{\pi (1- (2n)^2)} \\
\implies \sum_{n\in\Bbb{Z}, n \geq 1}\frac{1}{4n^2 - 1} &=& \frac{2}{\pi}\cdot \frac{\pi}{4}\\
&=& \frac{1}{2}.
\end{eqnarray*}$$
The evaluation of the second sum is similar except that instead of substituting in $x = \pi$ you substitute in $x = \pi/2$.
A: Hint:
To find the Fourier coefficients of $|\sin(x)|$ note that
$$
\int_{-\pi}^\pi|\sin(x)|\cos(kx)\;\mathrm{d}x=2\int_0^\pi\sin(x)\cos(kx)\;\mathrm{d}x
$$
then use the trig identity $2\sin(x)\cos(y)=\sin(x+y)+\sin(x-y)$.
Once you get the Fourier coefficients you will probably see how to continue.  If not, append your work and say what is causing you difficulty.
