# Show that $|x|=\frac{\pi}{2} - \frac{4}{\pi}\sum\limits_{k=0}^\infty\frac{\cos\left((2k+1)x\right)}{(2k+1)^2}$

The objective is to find the Fourier series for $|x|$ in the range $-\pi \le x \lt \pi$ so I started by finding the Fourier coefficients:

$$a_0=\frac{1}{\pi}\int_{x=-\pi}^{\pi}|x|\mathrm{d}x=\frac{2}{\pi}\int_{x=0}^{\pi}x\mathrm{d}x=\pi$$

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

Then using the general Fourier series expansion: $$f(x)=\frac{a_0}{2}+ \sum_{n=1}^{n=\infty}\left(a_n\cos\left(\frac{2\pi n x}{L}\right)+b_n\sin\left(\frac{2\pi n x}{L}\right)\right) \tag{1}$$ where $2L$ is the period of the function and noting that $f(x)=|x|$ is even so $b_n=0$ such that only the cosine terms contribute to the sum. Insertion of $a_0$ and $a_n$ into $(1)$ yields $$f(x) = |x| =\frac{\pi}{2}+\frac{2}{\pi}\sum_{n=1}^{\infty}\frac{\left((-1)^n-1\right)\cos(nx)}{n^2}\tag{A}$$ I can tell you from this that $(\mathrm{A})$ is correct and I just need to show it is equal to $$\frac{\pi}{2} - \frac{4}{\pi}\sum\limits_{k=0}^\infty\frac{\cos\left((2k+1)x\right)}{(2k+1)^2}\tag{B}$$ where $k$ is an integer, but I don't know how to. The calculation here doesn't show the steps to get from $(\mathrm{A})$ to $(\mathrm{B})$. Could someone please show me these steps to complete the proof?

Thank you.

• You might consider replacing every \cfrac by \frac. – Did Sep 24 '15 at 10:08
• @Did I'm sorry I don't follow your logic – BLAZE Sep 24 '15 at 10:24
• @Did Okay it's done – BLAZE Sep 24 '15 at 10:33

• Thanks for your answer, I understood everything you wrote apart from the part where you changed from $\cfrac{\cos((2n-1)x)}{(2n-1)^2}$ to $\cfrac{\cos((2n+1)x)}{(2n+1)^2}$. In other words, why did $2n-1$ change to $2n+1$? – BLAZE Sep 25 '15 at 1:48
• This is a change of variable. In general $\sum_{n=1}^{\infty}g(n)=\sum_{n'=0}^{\infty}g(n')$ where $n'=n-1$. For example $\sum_{n=1}^{10}(n-1)^2=0^2+1^2+2^2+...+9^2=\sum_{n=0}^{9}n^2$. I hope this made the issue clear. – Math-fun Sep 25 '15 at 9:05
Hint: What is $(-1)^n-1$ when $n$ is even?