I have a problem that I've partially worked but don't understand the next part/have made a mistake?
$f(x)=0$ for $-\pi< x<0$ and $f(x)=x$ for $0≤x≤\pi$
I have $a_0=\dfrac \pi 4$ and $a_n=0$ and $b_n=0$ if n is even and $b_n=\dfrac 2 n$ if $n$ is odd
so.... $$f(x)= \frac π 4 + \sum_{n=0}^{\infty} (\frac{2}{2n+1}) \sin[(2n+1) π x]$$
Now I need to show $$\frac π 4 = 1 - 1/3 + 1/5 \dots$$ using suitable values of $x$. How would I go about doing this?
$$a_n=\frac 1 \pi \int_{-\pi}^\pi f(x)\cos(nx)dx$$ $$\frac 1 \pi \int_{0}^\pi x\cos(nx)dx=\frac{\cos\pi n -1}{\pi n^2}$$ So: $$\sum_{n=0}^{\infty}\frac{\cos\pi n -1}{\pi n^2} \cos(nx)=\sum_{n=0}^{\infty}\frac{\cos[\pi (2n+1)] -1}{\pi (2n+1)^2}\cos[(2n+1)x]$$ $$-\sum_{n=0}^{\infty}\frac{2}{\pi (2n+1)^2}\cos[(2n+1)x]$$
Similarly: $$b_n=-\frac{\pi\cos(n\pi)}{n}=-\frac{\pi(-1)^n}{n}$$
Finally $$f(x)=\frac \pi 4 -\sum_{n=0}^{\infty}\frac{2}{\pi (2n+1)^2}\cos[(2n+1)x] -\sum_{n=1}^{\infty}\frac{(-1)^n}{n}\sin(nx) $$
Let $x= \pi /2$ this way we'll cancel out the terms containing cosine. In addition, the right-most sum will be null if $n$ is even so we're left with: $$\frac \pi 2=\frac \pi 4 + \sum_{n=1}^{\infty}\frac{1}{2n+1}\sin[(2n+1) \frac \pi 2]$$ etc.