Problem: Use the method of stretching to derive the fundamental solution of the heat equation$$u(x,t) = \frac 1{2 \sqrt{\pi Dt}} e^{-\frac {x^2}{4Dt}}$$
My attempt:
$$\frac{\partial u}{\partial t} = D\frac{\partial^{2}u}{\partial x^{2}}$$
with boundary condition $u(x,0) = n_{0}\delta(x)$, $\lim_{x \rightarrow \pm \infty}{u(x,t)} = 0$.
Let $u = \epsilon^{c}U,t = \epsilon^{b}T,x = \epsilon^{a}X$, we have
$$\epsilon^{c - b}\frac{\partial U}{\partial T} = \epsilon^{c - 2a}D\frac{\partial^{2}U}{\partial X^{2}}$$
For the heat equation to be invariant,
$$b = 2a$$
So let $z = \frac{x}{t^{\frac{1}{2}}},u = t^{\frac{c}{b}}v(z)$, then
$$\frac{\partial u(x,t)}{\partial t} = \frac{\partial u}{\partial t} + \frac{\partial z}{\partial t}\frac{\partial u}{\partial z} = \frac{c}{b}t^{\frac{c}{b} - 1}v - \frac{1}{2}xt^{\frac{c}{b} - \frac{3}{2}}v' = \frac{c}{b}t^{\frac{c}{b} - 1}v - \frac{1}{2}zt^{\frac{c}{b} - 1}v'$$
$$\frac{\partial u(x,t)}{\partial x} = \frac{\partial z}{\partial x}\frac{\partial u}{\partial z} = \frac{1}{t^{\frac{1}{2}}}t^{\frac{c}{b}}\frac{dv}{dz} = t^{\frac{c}{b} - \frac{1}{2}}\frac{dv}{dz}$$
$$\frac{\partial^{2}u(x,t)}{\partial x^{2}} = \frac{\partial z}{\partial x}\frac{\partial}{\partial z}\left( t^{\frac{c}{b} - \frac{1}{2}}\frac{dv}{dz} \right) = t^{\frac{c}{b} - 1}\frac{d^{2}v}{dz^{2}}$$
Therefore,
$$Dt^{\frac{c}{b} - 1}v'' + \frac{1}{2}zt^{\frac{c}{b} - 1}v' - \frac{c}{b}t^{\frac{c}{b} - 1}v = 0$$
To be convenient, choose $c = 0$
$$Dv'' + \frac{1}{2}zv' = 0$$
$$v' = Ae^{- \frac{1}{4D}z^{2}}$$
Therefore,
$$v = A\int_{- \infty}^{z}{e^{- \frac{1}{4D}s^{2}}ds} + B$$
$$u(z) = A\int_{- \infty}^{z}{e^{- \frac{1}{4D}t^{2}}dt} + B$$
However I don't know how to make $u(z)$ to satisfy the initial and boundary conditions.
Update: Let's not specify the value of $c$ first. Let's reduce the ODE by the transformation $v(z)=p(z)w(z)$, then the ODE is $$Dpv''+(2Dp'+\frac12 z p)v'+(p''+\frac12 zp'-\frac cb p)v=0$$ The first order term can be eliminated by letting $p(z)=e^{-\frac {z^2}{8D}}$. However I don't know how to solve the resulting ODE either since the $v$ term involves $z$.
Update: I just found a note online showing examples of this method to solve the heat equation. But the boundary conditions are different. I still don't know how to adjust that to fit the boundary conditions here.
This answer is inspired by @Gonçalo.
Let $y = \frac{1}{2\sqrt{D}}z$, then
$$v^{'}(z) = \frac{1}{2\sqrt{D}}v'(y)$$
$$v''(z) = \frac{1}{4D}v''(y)$$
The ODE is transformed into
$$v^{''} + 2yv^{'} - \frac{4c}{b}v = 0$$
Let $w(y) = e^{y^{2}}v(y)$, then
$$v^{'} = ( - 2yw + w)e^{y^{2}}$$
$$v^{''} = \left( w^{''} - 4yw^{'} + \left( 4y^{2} - 2 \right)w \right)e^{y^{2}}$$
The ODE is transformed into
$$w^{''} - 2yw^{'} + 2\lambda w = 0$$
where $\lambda = - 1 - \frac{2c}{b}$.
Choose $\frac{c}{b} = - \frac{1}{2}$, the above ODE is a Hermite differential equation with $\lambda = 0$. To satisfy the boundary conditions
$$\lim_{y \rightarrow \pm \infty}{w(y)} = 0$$
The solution for $w(y)$ is a constant. Let's say $w(y) = A$, the solution $u(x,t)$ is
$$u(x,t) = \frac{A}{\sqrt{t}}e^{- \frac{x^{2}}{4Dt}}$$
For $u(x,t)$ to satisfy the initial condition $\lim_{t \rightarrow 0^{+}}{u(x,t)} = n_{0}\delta(x)$, it must be that
$$A = \frac{n_{0}}{2\sqrt{D\pi}}$$
Finally,
$$u(x,t) = \frac{n_{0}}{2\sqrt{\pi Dt}}e^{- \frac{x^{2}}{4Dt}}$$