# Fourier series of delta function seems to blow up

Say I have a cosine series defined on 0 to $L$:

$$P(x) = \sum_{n=0}^\infty A(n)\cos \left ( \frac{n \pi x}{2L} \right ) = \delta(x)$$

Getting the coefficients:

$$A(n) = \frac{2}{L} \int_0^{L} \delta(x) \cos \left ( \frac{n \pi x}{2L} \right ) = \frac{2}{L}.$$

So

$$P(x) = \frac{2}{L} \sum_{n=0}^\infty \cos \left( \frac{n \pi x }{2L} \right )$$

I would expect the integral here to be 1 (like the original delta function), but here I get:

\begin{align} \int_0^L P(x) dx &= \frac{2}{L} \sum_{n=0}^\infty \int_0^L \cos \left(\frac{n \pi x}{2L} \right) dx\\ &= \frac{2}{L} \sum_{n=0}^\infty \frac{2L}{n \pi} \sin \left( \frac{n \pi}{2} \right) \\ &= \frac{4}{\pi} \sum_{n=0}^\infty \frac{1}{2n+1}, \end{align}

which diverges.

Have I gone wrong somewhere?

• So many divergent series without the word "distribution" and "convergence in the sense of distributions". You won't go far this way. – reuns Dec 2 '17 at 4:46

The final line should read $$\frac{4}{\pi} \sum_{n=0}^{\infty} \frac{(-1)^n}{2n+1}$$ which is indeed $1$. You forgot to let $\sin(n\pi / 2)$ take negative values.
Well $$\sin\left( \frac{n\pi}{2} \right) = \left\{ \begin{matrix} 0, & n \text{ even}, \\ 1, & n \equiv 1 (\text{mod }4), \\ -1, & n \equiv 3 (\text{mod } 4), \end{matrix} \right.$$ so you should have arrived at $$\int^L_0 P(x) dx = \frac{4}{\pi} \sum^\infty_{n=0} \frac{(-1)^n}{2n+1} = 1.$$