TITLE: Non-negativity of the Fourier series
QUESTION [7 upvotes]: Let there be a decomposition $φ(x)=\displaystyle\sum_{n=1}^\infty c_n\sin{nx}$ on the segment $[0,π]$, and on our segment $φ(x)≥0$. How do I prove that the series $\displaystyle\sum_{n=1}^\infty c_ne^{-n^2} \sin{nx}$ converges to a non-negative function on $[0, π]$?
Let me give a solution for the case of a continuous piecewise smooth function $φ(x)$. Consider a boundary value problem:
$$u_t=u_{xx},\,0\lt x \lt \pi, \, t\gt 0$$
$$u(x,0)=φ(x)$$
$$u(0,t)=u(\pi,t)=0.$$
According to the maximum principle for the heat equation, the continuous solution $u(x,t)$ reaches its maximum and minimum values only at the boundary of the considered region, i.e. or at $x=0$, or at $x=π$, or at $t=0$.
It remains to write down the solution to the problem by the method of separation of variables(due to the conditions on $φ(x)$, this solution will be continuous): $u(x,t)=\displaystyle\sum_{n=1}^\infty c_ne^{-n^2t} \sin{nx}$, where $\displaystyle\sum_{n=1}^\infty c_n\sin{nx}=φ(x)$ and substitute $t=1$.
The task seemed to me beautiful. It was not possible to find any "direct" solution (even in the class of continuous functions). If someone suggests one, I will accept it as an answer.

REPLY [2 votes]: Here a probabilistic take on the question.
Let $(B_t)_{t\ge 0}$ be standard Brownian motion on $[0,\pi]$, with both endpoints absorbing barriers. Let $T:=\inf\{t>0: B_t \in\{0,\pi\}\}$. Using a little martingale theory you can show that
$$
e^{-n^2t/2}\sin(nx)=E^x[\sin(nB_t); t<T], \qquad 0\le x\le\pi, t>0, n=1,2,\ldots.
$$
(The notation $E^x$ indicates expectation under the condition that $B_0=x$.)
Multiply by $c_n$, sum over $n\ge 1$, and specialize to $t=2$. We can bring the summation inside the expectation on the right because $\sin$ is bounded and $e^{-n^2}$ decays rapidly. There results
$$
\sum_{n=1}^\infty e^{-n^2}c_n\sin(nx)=E^x\left[\sum_{n=1}^\infty c_n\sin(nB_2); 2<T\right]=E^x[\varphi(B_2); 2<T].
$$
Because $\varphi\ge 0$ by hypothesis, the sum on the left is also non-negative. (N.B. The function $(x,t)\mapsto E^x[\varphi(B_t); t<T]$ is the solution to a modified form of your your boundary value problem — replace $u_{xx}$ with ${1\over 2}u_{xx}$.)
It may be worth noting that the second expectation on the right in the last display is a smooth function of $x\in(0,\pi)$ for any bounded measurable $\varphi$.