# Finding the value of a series using a known Fourier series

We are given the function $$f(x)=\begin{cases}1&\text{for }-\dfrac{\pi}{2}<x<\dfrac{\pi}{2}\\ 0&\text{for }\dfrac{\pi}{2}<x<\dfrac{3\pi}{2}\end{cases}$$ which I have found to have the Fourier series representation, $$f(x)=\frac{1}{2}+\frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{(2k-1)}\cos[(2k-1)x]$$ and using this series, I'm asked to show that $$\frac{\pi}{4}=\sum_{k=1}^\infty\frac{(-1)^{k-1}}{(2k-1)}$$ I know that for $-\dfrac{\pi}{2}<x<\dfrac{\pi}{2}$, I have $f(x)=1$, so over this interval, $$1=\frac{1}{2}+\frac{2}{\pi}\sum_{k=1}^\infty \frac{(-1)^{k-1}}{(2k-1)}\cos[(2k-1)x]$$ which gives $$\frac{\pi}{4}=\sum_{k=1}^\infty \frac{(-1)^{k-1}}{(2k-1)}\cos[(2k-1)x]$$ How do I deal with the cosine term in the series? If I were to fix $x=0$, which does lie in the first interval, I can guarantee that the cosine term is 1, but is this legal?

Yes, the key to the proof is to choose $x=0$ for which the expression simplifies (the cosines drop out).