Use Fourier series of odd function to evaluate $1-\frac15+\frac17-\frac1{11}+\cdots$ 
Show that the Fourier series expansion for $f(x)$ is
  $$\frac2{\sqrt3}\left(\cos x-\frac{\cos5x}5+\frac{\cos7x}7-\frac{\cos11x}{11}+\cdots\right)$$
  where
  $$f(x)=\begin{cases}\dfrac\pi3&\text{for }x\in\left[0,\dfrac\pi3\right)\\[1ex]0&\text{for }x\in\left[\dfrac\pi3,\dfrac{2\pi}3\right)\\[1ex]-\dfrac\pi3&\text{for }x\in\left[\dfrac{2\pi}3,\pi\right)\end{cases}$$
  and $f(x)=f(x+\pi)$ for all $x\in\mathbb R$.

Attempt:
$$f(x)=\frac{a_0}2+\sum_{n\ge1}(a_n\cos2nx+b_n\sin2nx)$$
where
$$a_0=\frac2\pi\int_0^\pi f(x)\,\mathrm dx$$
$$a_n=\frac2\pi\int_0^\pi f(x)\cos2nx\,\mathrm dx$$
$$b_n=\frac2\pi\int_0^\pi f(x)\sin2nx\,\mathrm dx$$
I know that $f(x)$ is odd, so $a_0=0$ and $a_n=0$ for all $n\in\mathbb N$. For the sine series, I end up with, among several equivalent expressions,
$$b_n=\frac1{3n}\left(2-\cos\frac{2n\pi}3-\cos\frac{4n\pi}3\right)$$
$$b_n=\frac2{3n}\left(\sin^2\frac{2n\pi}3+\sin^2\frac{4n\pi}3\right)$$
which gives me (using $g$ to distinguish my result from the expected $f$)
$$g(x)=\sum_{n\ge1}\frac{c_n\sin2nx}n=\sin2x+\frac{\sin4x}2+\frac{\sin8x}4+\frac{\sin10x}5+\frac{\sin14x}7+\cdots$$
where $c_n=1$ if $n$ is not a multiple of $3$, and $0$ otherwise. Plotting the first few partial sums suggests that this answer is just as valid as the suggested one.
Is there some manipulation I can do to my result in order to get the solution to match? Or is there another way of finding the series expansion to arrive at the cosine series directly?
There is also a second part to the problem, which is to 

Show that
  $$\frac\pi{2\sqrt3}=1-\frac15+\frac17-\frac1{11}+\cdots$$

which I can easily get from evaluating $f(x)$ and the given expansion at $x=0$:
$$\frac\pi3=\frac2{\sqrt3}\left(1-\frac15+\frac17-\frac1{11}+\frac1{13}-\frac1{17}+\frac1{19}-\frac1{23}+\cdots\right)$$
but I don't immediately see a way to use $g(x)$. At first glance, choosing $x=\dfrac\pi4$ seems to be the right thing to do, but this yields
$$\frac\pi3=1+\frac15-\frac17-\frac1{11}+\frac1{13}+\frac1{17}-\frac1{19}-\frac1{23}+\cdots$$
 A: You need to make an even $2\pi$-periodic extension of the function $f$, that is, define $\tilde{f}$ such that
$$
\tilde{f}(-x) = \tilde{f}(x)
$$
and
$$
\tilde{f}(x) = f(x) ~~~\mbox{for}~~ 0 < x < \pi 
$$
Since $\tilde{f}$ is periodic, the only Fourier coefficients that are not trivially zero are
$$
a_n = \frac{1}{2\pi}\int_{-\pi}^{\pi}{\rm d}x~\tilde{f}(x)\cos n x
$$
After evaluating the integral you get $a_0 = 0$ and
$$
a_{n} = \frac{2}{3n}\left[\sin \frac{n\pi}{3} + \sin\frac{2n\pi}{3} -\sin n\pi \right] ~~~ n \ge 1
$$
Here's a reconstruction of the function with the 60 lowest modes $n \le 60$
$$
\tilde{f}(x) = \sum_{n\ge 1} a_n \cos nx
$$

With this you can solve the second problem
$$
f(0) = \frac{\pi}{3} = \sum_{n\ge 1} a_n = \frac{2}{\sqrt{3}}\left[ 1 - \frac{1}{5} + \frac{1}{7} \cdots \right]
$$
or equivalently
$$
\frac{\pi}{2\sqrt{3}} = 1 -\frac{1}{5} + \frac{1}{7} \cdots
$$
A: It's illuminating to plot the two series that you've come up with. For the sum of the first 10 terms in the Fourier cosine series $f(x)$, we obtain

Plot[(2/Sqrt[3]) Sum[
 Cos[(6 n + 1) x]/(6 n + 1) - Cos[(6 n + 5) x]/(6 n + 5), {n, 0,  9}],
 {x, -\[Pi], 2 \[Pi]}, PlotPoints -> 30]

By contrast, the first ten terms of in the Fourier sine series $g(x)$ yields

 Plot[Sum[Boole[Not[Divisible[n, 3]]] Sin[2 n x]/n, {n, 1, 15}], {x, -\[Pi], 2 \[Pi]}]

Setting aside the differing rates of convergence, what's immediately apparent is that the two series agree only for $x\in[0,\pi)$; for $x\in [-\pi,0)$ one has $f(-x)=f(x)$ but $g(x)=-g(x)$. A further consequence is that, of the two series, only the sine series $g(x)$ has the appropriate $x\to x+\pi$ periodicity. The Fourier cosine series in fact satisfies $f(x+\pi)=-f(x)$ i.e. $f(x)$ is $\pi$-antiperiodic. Hence the Fourier cosine series given does not actually satisfy the periodicity condition it asks for.
