Heat equation, separation of variables and Fourier transform I have a question about the heat equation $\frac{\partial \varphi}{\partial t} = \frac{\partial^2 \varphi}{\partial x^2}$ with the conditions that $\varphi(x,t=0) = f_0(x)$ and $\lim_{x \rightarrow\pm \infty}\varphi(x,t) = 0$ for every $t \in \mathbb{R}$. The usual way of solving this equation is by separation of variables, i.e., $\varphi(x,t) = A(x)B(t)$. Then one gets the two ordinary differential equations
\begin{equation}
\frac{1}{B}\frac{dB}{dt} = \frac{1}{A}\frac{d^2A}{dx^2} = -\gamma \mbox{,}
\end{equation}
where $\gamma > 0$ in order that the condition $\lim_{x \rightarrow\pm \infty}\varphi(x,t) = 0$ is satisfied. The thing is that I can also Fourier
transform the solution: $\widehat{\varphi}(k,t) = \widehat{A}(k)B(t)$, i.e., the Fourier transformed solution is also a product of a function only of $k$ and one only of $t$. However, when I Fourier transform the equation ($\partial/\partial x \leftrightarrow ik$) I get $\frac{\partial\widehat{\varphi}}{\partial t} = -k^2 \widehat{\varphi}(k,t)$, which can be readily solved as $\widehat{\varphi}(k,t) = \widehat{f_0}(k)e^{-k^2 t}$. But this solution in Fourier space cannot be represented as a product of two functions - one only of $k$ and the other one only of $t$ although it should. I oversee something. Can someone help me?
 A: You should not mix up the two methods (a) separation of variables and (b) Fourier transform. 
The final solution of your problem will not be a product of two functions, but a superposition of such products. You use separation of variables in order to determine a sufficient supply of basis functions that can be used for the superposition.
Fourier transform with respect to the variable $x$ gives you immediately the Fourier transform $\hat\phi(k,t)$ of the final solution. Now you have to transform back. By the rules of Fourier transform the product in Fourier space will be transformed into a convolution.
A: First of all, the only solution of $A''+\gamma\,A=0$ such that $\lim_{x\to\pm\infty}A(x)=0$ is $A(x)\equiv0$. If $\gamma>0$ you get the bounded solutions of the heat equation:
$$
e^{-\gamma\, t}\cos(\sqrt\gamma\, x),\quad e^{-\gamma\, t}\sin(\sqrt\gamma \,x).
$$
Separation of variables does not give all solutions: only solutions that can be written as product of a function of $x$ and a function of $t$. For instance,
$$
e^{- t}\cos(x)+e^{-4\,t}\sin(2\,x)
$$
is a solution of the heat equation that cannot be written as $B(t)\,A(x)$.
A: Case $1$: $t\geq0$
Let $\varphi(x,t)=X(x)T(t)$ ,
Then $X(x)T'(t)=X''(x)T(t)$
$\dfrac{T'(t)}{T(t)}=\dfrac{X''(x)}{X(x)}=-s^2$
$\begin{cases}\dfrac{T'(t)}{T(t)}=-s^2\\X''(x)+s^2X(x)=0\end{cases}$
$\begin{cases}T(t)=c_3(s)e^{-ts^2}\\X(x)=\begin{cases}c_1(s)\sin xs+c_2(s)\cos xs&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$
$\therefore\varphi(x,t)=\int_0^\infty C_1(s)e^{-ts^2}\sin xs~ds+\int_0^\infty C_2(s)e^{-ts^2}\cos xs~ds$
Case $2$: $t\leq0$
Let $\varphi(x,t)=X(x)T(t)$ ,
Then $X(x)T'(t)=X''(x)T(t)$
$\dfrac{T'(t)}{T(t)}=\dfrac{X''(x)}{X(x)}=s^2$
$\begin{cases}\dfrac{T'(t)}{T(t)}=s^2\\X''(x)-s^2X(x)=0\end{cases}$
$\begin{cases}T(t)=c_3(s)e^{ts^2}\\X(x)=\begin{cases}c_1(s)\sinh xs+c_2(s)\cosh xs&\text{when}~s\neq0\\c_1x+c_2&\text{when}~s=0\end{cases}\end{cases}$
$\therefore\varphi(x,t)=\int_0^\infty C_1(s)e^{ts^2}\sinh xs~ds+\int_0^\infty C_2(s)e^{ts^2}\cosh xs~ds$
Hence $\varphi(x,t)=\begin{cases}\int_0^\infty C_1(s)e^{-ts^2}\sin xs~ds+\int_0^\infty C_2(s)e^{-ts^2}\cos xs~ds&\text{when}~t\geq0\\\int_0^\infty C_1(s)e^{ts^2}\sinh xs~ds+\int_0^\infty C_2(s)e^{ts^2}\cosh xs~ds&\text{when}~t\leq0\end{cases}$
Note that in this question we only care about $x\in\mathbb{R}$ . Since $\sin xs=-\sin(-xs)$ , $\cos xs=\cos(-xs)$ , $\sinh xs=-\sinh(-xs)$ and $\cosh xs=\cosh(-xs)$ , $\varphi(x,t)$ has alternative form of the solution:
$\varphi(x,t)=\begin{cases}\int_0^\infty C_1(s)e^{-ts^2}\sin|x|s~ds+\int_0^\infty C_2(s)e^{-ts^2}\cos|x|s~ds&\text{when}~t\geq0\\\int_0^\infty C_1(s)e^{ts^2}\sinh|x|s~ds+\int_0^\infty C_2(s)e^{ts^2}\cosh |x|s~ds&\text{when}~t\leq0\end{cases}$
Since $\lim\limits_{x\to\pm\infty}\sin|x|s$ , $\lim\limits_{x\to\pm\infty}\cos|x|s$ , $\lim\limits_{x\to\pm\infty}\sinh|x|s$ and $\lim\limits_{x\to\pm\infty}\cosh|x|s$ do not exist, we cannot determine directly whether $\lim\limits_{x\to\pm\infty}\varphi(x,t)=0$ holds or not.
However, when we do some change of variables:
$\varphi(x,t)=\begin{cases}\int_0^\infty C_1\biggl(\dfrac{s}{|x|}\biggr)e^{-t\left(\frac{s}{|x|}\right)^2}\sin s~d\biggl(\dfrac{s}{|x|}\biggr)+\int_0^\infty C_2\biggl(\dfrac{s}{|x|}\biggr)e^{-t\left(\frac{s}{|x|}\right)^2}\cos s~d\biggl(\dfrac{s}{|x|}\biggr)&\text{when}~t\geq0\\\int_0^\infty C_1\biggl(\dfrac{s}{|x|}\biggr)e^{t\left(\frac{s}{|x|}\right)^2}\sinh s~d\biggl(\dfrac{s}{|x|}\biggr)+\int_0^\infty C_2\biggl(\dfrac{s}{|x|}\biggr)e^{t\left(\frac{s}{|x|}\right)^2}\cosh s~d\biggl(\dfrac{s}{|x|}\biggr)&\text{when}~t\leq0\end{cases}$
$\varphi(x,t)=\begin{cases}\int_0^\infty C_1\biggl(\dfrac{s}{|x|}\biggr)\dfrac{e^{-\frac{ts^2}{x^2}}\sin s}{|x|}ds+\int_0^\infty C_2\biggl(\dfrac{s}{|x|}\biggr)\dfrac{e^{-\frac{ts^2}{x^2}}\cos s}{|x|}ds&\text{when}~t\geq0\\\int_0^\infty C_1\biggl(\dfrac{s}{|x|}\biggr)\dfrac{e^{\frac{ts^2}{x^2}}\sinh s}{|x|}ds+\int_0^\infty C_2\biggl(\dfrac{s}{|x|}\biggr)\dfrac{e^{\frac{ts^2}{x^2}}\cosh s}{|x|}ds&\text{when}~t\leq0\end{cases}$
Since $\lim\limits_{x\to\pm\infty}\dfrac{e^{-\frac{ts^2}{x^2}}}{|x|}=0$ and $\lim\limits_{x\to\pm\infty}\dfrac{e^{\frac{ts^2}{x^2}}}{|x|}=0$ ,
$\therefore\varphi(x,t)=\begin{cases}\int_0^\infty C_1(s)e^{-ts^2}\sin|x|s~ds+\int_0^\infty C_2(s)e^{-ts^2}\cos|x|s~ds&\text{when}~t\geq0\\\int_0^\infty C_1(s)e^{ts^2}\sinh|x|s~ds+\int_0^\infty C_2(s)e^{ts^2}\cosh |x|s~ds&\text{when}~t\leq0\end{cases}$ automatically satisflies $\lim\limits_{x\to\pm\infty}\varphi(x,t)=0$ .
The remaining problem is how to substitute $\varphi(x,0)=f_0(x)$ to eliminate nicely on some of the $C_1(s)$ and $C_2(s)$ .
