$\renewcommand{\Re}{\operatorname{Re}}$ $\renewcommand{\Im}{\operatorname{Im}}$ $\newcommand{\erf}{\operatorname{erf}}$ $\newcommand{\dag}{\dagger}$ $\newcommand{\const}{\mathrm{const}}$ $\newcommand{\arcsinh}{\operatorname{arcsinh}}$
In this Chapter we consider 1-dimensional heat equation (also known as diffusion equation). Instead of more standard Fourier transform method (which we will postpone a bit) we will use the method of self-similar solutions.
Heat equation which is in its simplest form \begin{equation} u_t = ku_{xx} \label{eq-3.1.1} \end{equation} is another classical equation of mathematical physics and it is very different from wave equation. This equation describes also a diffusion, so we sometimes will refer to it as diffusion equation. See Subsection 1.4.2.
It also describes random walks (see Project "Random walks").
We want to solve IVP for equation (\ref{eq-3.1.1}) with $t>0$, $-\infty< x < \infty$. Let us plug \begin{equation} u_{\alpha,\beta,\gamma}(x,t):=\gamma u(\alpha x, \beta t). \label{eq-3.1.2} \end{equation}
Proposition 1. If $u$ satisfy equation (\ref{eq-3.1.1}) then $u_{\alpha,\beta,\gamma}$ also satisfies this equation provided $\beta =\alpha^2$.
Proof is just by calculation. Note that $\beta=\alpha^2$ because one derivative with respect to $t$ is "worth" of two derivatives with respect to $x$.
We impose another assumption:
Condition 1. Total heat energy \begin{equation} I(t):=\int_{-\infty}^\infty u(x,t)\, dx \label{eq-3.1.3} \end{equation} is finite and does not depend on $t$.
The second part is due to the first one. Really (not rigorous) integrating (\ref{eq-3.1.1}) by $x$ from $-\infty$ to $+\infty$ and assuming that $u_x (\pm \infty)=0$ we see that $\partial_t I(t)=0$.
Note that $\int_{-\infty}^\infty u_{\alpha,\beta,\gamma} \,dx = \gamma |\alpha|^{-1} \int_{-\infty}^\infty u\,dx$ and to have them equal we should take $\gamma=|\alpha|$ (actually we restrict ourselves by $\alpha>0$). So (\ref{eq-3.1.2}) becomes \begin{equation} u_{\alpha}(x,t)=\alpha u(\alpha x, \alpha^2 t). \label{eq-3.1.4} \end{equation} This is transformation of similarity. Now we are looking for a self-similar solution of (\ref{eq-3.1.1}) i.e. solution such that $u_{\alpha}(x,t)=u(x,t)$ for all $\alpha>0, x, t>0$. So we want \begin{equation} u(x,t)=\alpha u(\alpha x, \alpha^2 t)\qquad \forall \alpha>0, t>0, x. \label{eq-3.1.5} \end{equation} We want to get rid off one of variables; so taking $\alpha = t^{-\frac{1}{2}}$ we get \begin{equation} u(x,t)=t^{-\frac{1}{2}} u(t^{-\frac{1}{2}} x, 1) = t^{-\frac{1}{2}} \phi (t^{-\frac{1}{2}} x) \label{eq-3.1.6} \end{equation} with $\phi (\xi ):= u(\xi, 1)$. Equality (\ref{eq-3.1.6}) is equivalent to (\ref{eq-3.1.5}).
Now we need to plug $u(x,t)=t^{-\frac{1}{2}} \phi (t^{-\frac{1}{2}} x)$ into equation (\ref{eq-3.1.1}). Note that \begin{multline*} u_t = -\frac{1}{2} t^{-\frac{3}{2}}\phi (t^{-\frac{1}{2}}x) + t^{-\frac{1}{2}}\phi '(t^{-\frac{1}{2}}x)\times \bigl(-\frac{1}{2}t^{-\frac{3}{2}}x\bigr)= \\ -\frac{1}{2} t^{-\frac{3}{2}} \bigl( \phi (t^{-\frac{1}{2}}x) + t^{-\frac{1}{2}}x \phi' (t^{-\frac{1}{2}}x)\bigr) \end{multline*} and \begin{equation*} u_x = t^{-1}\phi ' (t^{-\frac{1}{2}}x), \qquad u_{xx} = t^{-\frac{3}{2}}\phi '' (t^{-\frac{1}{2}}x). \end{equation*}
Multiplying by $t^{\frac{3}{2}}$ and plugging $t^{-\frac{1}{2}}x=\xi$ we arrive to \begin{equation} -\frac{1}{2} \bigl( \phi (\xi) + \xi \phi '(\xi )\bigr)= k\phi '' (\xi). \label{eq-3.1.7} \end{equation} Good news: it is ODE. Really good news: $\phi (\xi) + \xi \phi '(\xi )= \bigl( \xi\phi(\xi)\bigr)'$. Then integrating we get \begin{equation} -\frac{1}{2} \xi \phi (\xi)= k\phi ' (\xi). \label{eq-3.1.8} \end{equation}
Remark 1. Sure there should be $+C$ but we are looking for a solution fast decaying with its derivatives at $\infty$ and it implies that $C=0$.
Separating in (\ref{eq-3.1.8}) variables and integrating we get \begin{equation*} \frac{d\phi}{\phi}= -\frac{1}{2k}\xi d\xi \implies \log \phi = -\frac{1}{4k}\xi^2+\log c\implies \phi(\xi)= ce^{-\frac{1}{4k}\xi^2} \end{equation*} and plugging into (\ref{eq-3.1.6}) we arrive to \begin{equation} u(x,t)= \frac{1}{2\sqrt {\pi kt}} e^{-\frac{x^2}{4kt}}. \label{eq-3.1.9} \end{equation}
Remark 2. We took $c=\frac{1}{2\sqrt {\pi k}}$ to satisfy $I(t)=1$. Really, \begin{equation*} I(t)=c\int_{-\infty}^{+\infty} t^{-\frac{1}{2}} e^{-\frac{x^2}{4kt}}\,dx = c\sqrt{4k}\int_{-\infty}^{+\infty} e^{-z^2}\,dz= 2c\sqrt{k\pi} \end{equation*} where we changed variable $x=z/\sqrt{2kt}$ and used the equality \begin{equation} J= \int_{-\infty}^{+\infty} e^{-x^2}\,dx=\sqrt{\pi}. \label{eq-3.1.10} \end{equation} To prove (\ref{eq-3.1.10}) just note that \begin{equation*} J^2= \int_{-\infty}^{+\infty} \int_{-\infty}^{+\infty}\ e^{-x^2}\times e^{-y^2}\,dxdy= \int_0^{2\pi} d\theta \int_0^\infty e^{-r^2}rdr =\pi \end{equation*} where we used polar coordinates; since $J>0$ we get (\ref{eq-3.1.10}).
Remark 3. Solution which we got is a very important one. However we have a problem understanding what is $u|_{t=0^+}$ as $u(x,t)\to 0$ as $t\to 0^+$ and $x\ne 0$ but $u(x,t)\to \infty$ as $t\to 0^+$ and $x= 0$ and $\int_{-\infty}^\infty u(x,t)\,dx=1$.
In fact $u|_{t=0^+}=\delta(x)$ which is Dirac $\delta$-function which actually is not an ordinary function but a distribution (see Section 11.1). Distributions play important role in the modern Analysis and applications, in particular, to physics.
To work around this problem we consider \begin{equation} U(x,t)=\int_{-\infty}^x u(x,t)\,dx. \label{eq-3.1.11} \end{equation}
We claim that
Proposition 2.
Proof. Plugging $u=U_x$ into (\ref{eq-3.1.1}) we see that $(U_t-kU_{xx})_x=0$ and then $(U_t-kU_{xx})=\Phi(t)$. However one can see easily that as $x\to -\infty\ $ $U$ is fast decaying with all its derivatives and therefore $\Phi(t)=0$ and [1] is proven.
Note that \begin{equation} U(x,t)=\frac{1}{\sqrt{\pi }} \int_{-\infty}^{\frac{x}{\sqrt{4kt}}} e^{- z^2}\,dz=: \frac{1}{2}+\frac{1}{2}\erf \bigl(\frac{x}{\sqrt{4kt}}\bigr) \label{eq-3.1.12} \end{equation} with \begin{equation} \erf(z):= \frac{2}{\sqrt{\pi}}\int_0^z e^{-z^2}\,dz \label{Erf}\tag{erf} \end{equation} and that an upper limit in integral tends to $\mp \infty$ as $t\to 0^+$ and $x\lessgtr 0$. Then since an integrand is very fast decaying at $\mp \infty$ we using (\ref{eq-3.1.10}) arrive to [2].
Remark 4.
Consider now a smooth function $g(x)$, $g(-\infty)=0$ and note that \begin{equation} g(x)=\int _{-\infty}^\infty \theta (x-y) g'(y)\,dy. \label{eq-3.1.13} \end{equation} Really, the r.h.e. is $\int_{-\infty}^x g'(y)\,dy=g(x)-g(-\infty)$.
Also note that $U(x-y,t)$ solves the IVP with initial condition $U(x-y,0^+)=\theta (x-y)$. Therefore $u(x,t)=\int _{-\infty}^\infty U (x-y,t) g'(y)\,dy$ solves the IVP with initial condition $u(x,0^+)=g(y)$.
Integrating by parts with respect to $y$ we arrive to \begin{gather} u(x,t)= \int _{-\infty}^\infty G(x-y,t) g(y)\,dy \label{eq-3.1.14} \end{gather} with \begin{gather} G(x-y,t):= \frac{1}{2\sqrt{k\pi t}} e^{-\frac{(x-y)^2}{4kt}} . \label{eq-3.1.15} \end{gather}
So we have proven:
Theorem 3. Formulae (\ref{eq-3.1.14})--(\ref{eq-3.1.15}) give us a solution of \begin{align} &u_t = ku_{xx}\qquad &&-\infty <x< \infty, t>0, \label{eq-3.1.16}\\ &u|_{t=0}=g(x). \label{eq-3.1.17} \end{align}
Remark 5. We will recreate the same formulae in Section 5.3 using Fourier transform.
Example 1. Find the solution $u(x,t)$ to \begin{align*} &u_t=4u_{xx} && -\infty<x<\infty, \ t>0,\\[2pt] &u|_{t=0}=\left\{\begin{aligned} &1-|x| &&|x|<1,\\ &0 &&|x|\ge 1, \end{aligned}\right. \\ &\max |u|<\infty. \end{align*}
Solution. \begin{align*} u(x,t)=&\frac{1}{\sqrt{16\pi t}} \int_{-\infty}^\infty e^{-\frac{1}{16t} (x-y)^2}g(y)\,dy\\ =& \frac{1}{\sqrt{16\pi t}} \Bigl(\int_{-1}^0 e^{-\frac{1}{16t} (x-y)^2}(1+y)\,dy + \int_0^1 e^{-\frac{1}{16t} (x-y)^2}(1-y)\,dy \Bigr). \end{align*}
Plugging $y= x+4z\sqrt{t}$ and changing limits \begin{multline*} u(x,t)=\frac{1}{\sqrt{\pi }} \Bigl(\int_{-(x+1)/4\sqrt{t}}^{-x/4\sqrt{t}} e^{-z^2} \bigl(1+ x+4z\sqrt{t}\bigr)\,dz \\ + \int_{-x/4\sqrt{t}}^{-(x-1)/4\sqrt{t}} e^{-z^2}\bigl(1- x-4z\sqrt{t}\bigr)\,dz \Bigr) \end{multline*} we evaluate integrals of the terms without factor $z$ as $\erf$ functions and terms with factor $z$ we simply integrate resulting in
\begin{multline*} u(x,t)=\frac{1}{2} (1+x) \Bigl(\erf(\frac{x+1}{4\sqrt{t}})-\erf(\frac{x}{4\sqrt{t}})\Bigr)\\ + \frac{1}{2} (1-x) \Bigl(\erf(\frac{x}{4\sqrt{t}})-\erf(\frac{x-1}{4\sqrt{t}})\Bigr) \ +\frac{2\sqrt{t}}{\sqrt{\pi}}\Bigl( e^{-z^2}\Bigl|_{z=x/4\sqrt{t}} ^{z=(x+1)/4\sqrt{t}}+e^{-z^2}\Bigl|_{z=x/4\sqrt{t}} ^{z=(x-1)/4\sqrt{t}}\Bigr). \end{multline*}
Consider instead problem with the right-hand expression \begin{align} &u_t = ku_{xx}+f(x,t) \qquad &&-\infty < x\ < \infty,\ t>0, \label{eq-3.1.18}\\ &u|_{t=0}=g(x). \tag{17} \end{align}
By Duhamel principle the contribution of this right-hand expression is \begin{equation} \int_0^t \int G(x-y,t-\tau) f(y,\tau)\,dyd\tau \label{eq-3.1.19} \end{equation} Indeed, Duhamel integral (2.5.8) remains except now auxiliary function $U(x,t;\tau)$ satisfies heat equation (\ref{eq-3.1.6}) with initial condition $U_t|_{t=\tau}=f(x,\tau)$. One can prove it exactly as in Subsection 2.5.2. Therefore we arrive to
Theorem 4. Solution of problem (\ref{eq-3.1.18})-(\ref{eq-3.1.17}) is given by \begin{equation} u(x,t)= \int_0^t \int_{-\infty}^\infty G(x-y,t-\tau) f(y,\tau)\,dyd\tau+ \int _{-\infty}^\infty G(x-y,t) g(y)\,dy. \label{eq-3.1.20} \end{equation}
Theorem 5. Let $u$ satisfy (\ref{eq-3.1.18}) in domain $\Omega\subset \mathbb{R}_t\times \mathbb{R}_x$ with $f\in C^\infty(\Omega)$. Then $u\in C^\infty(\Omega)$.
We will prove it later.
Remark 6.
$\erf(x)$ and its derivative $\erf'(x)$ original and scaled.