Consider the function $$ f: [- \pi, \pi) \to \mathbb{R} : x \mapsto \begin{cases} -1 & x \in [-\pi, 0) \\ 1 & x \in [0, \pi) \end{cases}. $$ This function can be made $2\pi$-periodic. The Fourier coefficients are $$ \hat{f} (n) = \begin{cases} \frac{1}{\pi i n} (1 - (-1)^n) & n \neq 0 \\ 0 & n = 0 \end{cases}. $$
Now, I need to use Dirichlet theorem, see here, to prove that $$\sum_{n=0}^{\infty} (-1)^n \frac{1}{2n+1} = \frac{\pi}{4} .$$
I have $$s_n(x) = \sum_{k=-n}^{n} \hat{f}(k) e^{ikx} = \sum_{k=-n}^{n} \frac{1}{\pi i k} (1 - (-1)^k) e^{ikx}. $$ This $n$th partial sum will be zero when $k$ is even. So we must assume $k$ is odd. So I let $k = 2m+1$, with $m$ an integer. Then $$s_n(x) = \frac{2}{\pi i} \sum_{2m+1 = -n}^{n} \frac{1}{2m+1} e^{i(2m+1)x}. $$ Now I plug in here $x = \pi/2$. Then the cosine is zero, and the sine will be $1$ or $-1$. So we get $$s_n(\pi/2 ) = \frac{2}{\pi} \sum_{2m+1=-n}^{n} \frac{1}{2m+1} (-1)^m. $$ The theorem of Dirichlet says the sum will converge to $f(\pi/2) = 1$ if I let $n \to \infty$. But how can I conclude from this that $$\sum_{n=0}^{\infty} (-1)^n \frac{1}{2n+1} = \frac{\pi}{4} $$ ? I think I need to manipulate the sum in my expression, to make it run from $0$ to $n$, but I'm not sure how.
Help is appreciated!
Hint : For positive odd k, and negative odd k, the coefficients will differ by a negative sign. Use that along with exponential to cancel out cosine terms and get $2i.sin(kx)$. That way you could run the summation from $0$ to $n$ and get the missing value $2$