"Bad" Fourier Series derivation Let $f(\theta)$ $2\pi$-periodic such that $f(\theta)=e^{\theta}$ for $-\pi<0<\pi$, and $$e^{\theta}=\sum_{n=-\infty}^{\infty}c_{n}e^{in\theta}\,\,\, \mathrm{for}\,\, |\theta|<\pi $$
it's  Fourier series. If we formally differentiate this equation, we obtain
$$e^{\theta}=\sum_{n=-\infty}^{\infty}inc_{n}e^{in\theta}. $$
But this implies  $c_{n}=inc_{n}$ or $(1-in)c_{n}=0$, so, $c_{n}=0\,\forall n\in\mathbb{Z}$. This is obviously wrong.
Where is the mistake?
The only thing that I could contest is the derivative of $f$. I know a theorem saying that a sufficient condition is $f$ continuous and piecewise smooth, and $f$ is not continous. But it don't implies that I can't derivate term by term.
 A: You have to think in terms of distributional derivatives, because in this sense you can switch series and derivative. Think $f$ as defined on the 1-torus. Then the distributional derivative of $f$ it is not $f$ itself, but $f-(e^\pi-e^{-\pi})\delta_{[\pi]}$, where $\delta_{[\pi]}$ is the delta Dirac in the point $[\pi]$ of the 1-torus. So, in distributional sense: $$\sum_{n=-\infty}^\infty inc_ne_n = f'=f-(e^\pi-e^{-\pi})\delta_{[\pi]}=\sum_{n=-\infty}^\infty c_ne_n - (e^\pi-e^{-\pi})\delta_{[\pi]}$$
i.e.:
$$\sum_{n=-\infty}^\infty (in-1)c_ne_n=-(e^\pi-e^{-\pi})\delta_{[\pi]}=-(e^\pi-e^{-\pi})\sum_{n=-\infty}^\infty e^{in\pi}e_n \\ = -(e^\pi-e^{-\pi})\sum_{n=-\infty}^\infty \frac{(-1)^n}{2\pi}e_n.$$
Then:
$$\forall n\in \mathbb{Z}, (in-1)c_n=-\frac{(-1)^{n}}{2\pi}(e^\pi-e^{-\pi})$$
i.e.:
$$\forall n\in\mathbb{Z}, c_n=\frac{(-1)^{n}(e^\pi-e^{-\pi})}{2\pi(1-in)}.$$
A: Note that $c_n=\frac{\sinh(\pi)}{\pi}\frac{(-1)^n}{1-in}$ and the Fourier series for $e^\theta$ on $-\pi<\theta<\pi$ is
$$e^\theta =\frac{\sinh(\pi)}{\pi}\sum_{-\infty}^\infty \frac{(-1)^n}{1-in}\,e^{in\theta}$$
Clearly, the series $\sum_{n=-\infty}^\infty inc_ne^{in\theta}=\frac{\sinh(\pi)}{\pi}\sum_{-\infty}^\infty \frac{(-1)^n\,in}{1-in}\,e^{in\theta}$, which is obtained by formal differentiation under the summation, is divergent.  Hence, differentiation under the summation is illegitimate and does not lead to a Fourier series representation of $e^\theta$ for $-\pi<\theta<\pi$.


EDIT:
We may derive the derivative of the Fourier series representation of $e^{\theta}$ for $\theta\in (-\pi,\pi)$.  Proceeding we have
$$\begin{align}
\sum_{n=-\infty}^\infty \frac{(-1)^n}{1-in}e^{in\theta}&=1+\sum_{n\ne0}\frac{(-1)^n}{1-in}e^{in\theta}\\\\
&=1+\sum_{n\ne0}\frac{(-1)^n(in-1+1)}{(1-in)(in)}e^{in\theta}\\\\
&=1+\sum_{n\ne0}\frac{(-1)^n}{in}e^{in\theta}+\sum_{n\ne0}\frac{(-1)^n}{(1-in)(in)}e^{in\theta}
\end{align}$$
We may differentiate the second series under the summation to obtain
$$\begin{align}
\frac{d}{d\theta}\sum_{n=-\infty}^\infty \frac{(-1)^n}{1-in}e^{in\theta}
&=\underbrace{\frac{d}{d\theta}\sum_{n\ne0}\frac{(-1)^n}{in}e^{in\theta}}_{=1}+\sum_{n\ne0}\frac{(-1)^n}{(1-in)}e^{in\theta}\\\\
&=\sum_{n=-\infty}^\infty \frac{(-1)^n}{1-in}e^{in\theta}
\end{align}$$
So, we have shown that the derivative of the Fourier series $\sum_{n=-\infty}^\infty \frac{(-1)^n}{1-in}e^{in\theta}$ for $\theta\in(-\pi,\pi)$ is in fact itself.  This is no surprise since $\frac{d}{d\theta}e^\theta=e^\theta$.
