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).

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.