I've worked out the following Fourier series for exp(x) (valid between -pi and pi) and would now like to be able to derive the sum of 1/(1-n^2).

$\displaystyle e^x = \frac{1}{\pi} sinh(\pi) + \sum_{1}^{\infty} \frac{2sinh(\pi)}{\pi(1+n^2)} (-1)^n(cos(nx)-nsin(nx)) $

This would work perfectly if I could substitute pi or -pi into the series, but unfortunately it is not valid for these values so gives the wrong result. Subbing in 0 works but this gives the alternating series (-1)^n/(1-n^2).

Can anyone give me a push in the right direction? I've tried differentiating/integrating the series but this does not seem to be helpful.

Thanks in advance.