I am trying to find the even extension of $e^x$ in the following way:
$$e^x=a_0+\sum_\limits{n=1}^\infty a_n\cos\left(\frac{n\pi x}L\right)$$ Since the extension is piecewise smooth and $f(L)=f(-L)$ we can differentiate term-by-term: $$e^x=-\sum_\limits{n=1}^\infty \left(\frac{n\pi }L\right) a_n\sin\left(\frac{n\pi x}L\right)$$ and differentiating once more $$e^x=-\sum_\limits{n=1}^\infty \left(\frac{n\pi }L\right)^2 a_n\cos\left(\frac{n\pi x}L\right)$$ Now comparing with the second derivative obtained with the original, one can see that $$a_0=0,\qquad -\left(\frac{n\pi }L\right)^2a_n =a_n$$ But what is wrong with this? How can I find $a_n$
Disclaimer: This is a partial answer, and does not find a value for $a_n$.
I think the problem with the above approach is that $$e^x=-\sum_\limits{n=1}^\infty \left(\frac{n\pi }L\right) a_n\sin\left(\frac{n\pi x}L\right)$$
is the Fourier series for the odd extension of $e^x$, which cannot be differentiated term-by-term because the odd extension of $e^x$ has a discontinuity at $x=0$ (we also no longer have $f(L)=f(-L)$):