Solve the Cauchy problem for diffusion equation $$u_t=u_{xx}, t\ge0,x\in\mathbb R,\\ u(x,0)=\begin{cases}x^2, x\in [0,1]\\0,x\not\in [0,1] \end{cases}$$
Give the solution in terms of $erf(x)=\sqrt{2/\pi}\int_0^xe^{-u^2/2}du$.
We have that the solution is given by $u(x,t) = \frac{1}{\sqrt{4\pi kt}}\int_{0}^1 e^{-(x-y)^2/4kt} y^2 dy$ .
Let $p=\frac{x-y}{\sqrt{4kt}}.$ Then $u(x,t)=\frac{-\sqrt{4kt}}{\sqrt{4\pi kt}}\int_{\frac{x}{\sqrt{4kt}}}^{\frac{x-1}{\sqrt{4kt}}}e^{-p^2}(-\sqrt{4kt}p+x)^2dp$.
From here should I expand the square term $(-\sqrt{4kt}p+x)^2$ and then multiply by $e^{-p^2}$ and then separate the integrals so I would end up having 3 integrals and then solve each of them?
Or what should I do ?
All that I said above sound (and it is in fact) really tedious, maybe I am missing a shortcut to get the solution in term of erf function.
Could someone help please?
One possible way to solve the problem (if it is presented as a show that) is to write $$\eta=\frac1{\sqrt{4\pi kt}},\,\xi=\frac x{\sqrt{4kt}}$$and then look for a separable solution. $$\frac{\partial}{\partial x}=\eta\sqrt\pi\frac{\partial}{\partial\xi}\\\frac{\partial^2}{\partial x^2}=\frac{\partial}{\partial x}\left(\eta\sqrt\pi\frac{\partial}{\partial\xi}\right)=\pi\eta^2\frac{\partial^2}{\partial\xi^2}\\\frac{\partial}{\partial t}=-2\pi k\eta^3\frac{\partial}{\partial\eta}-2k\pi\eta^2\xi\frac{\partial}{\partial \xi}=-2\pi k\eta^2\left(\eta\frac{\partial}{\partial \eta}+\xi\frac{\partial}{\partial\xi}\right)$$ Substituting this in,
$$u_t-u_{xx}=-2\pi k\eta^2(\eta u_\eta+\xi u_\xi)-\pi\eta^2u_{\xi\xi}=0\\\implies2k\eta u_\eta+2k\xi u_\xi+u_{\xi\xi}=0$$Write $u(\xi,\eta)=X(\xi)T(\eta)$.
$$2k\eta XT'+2k\xi X'T+X''T=0\\\implies 2k\xi\frac{X'}X+\frac{X''}X=-2k\eta\frac{T'}T=\text{constant}=c_1$$
Solve for $T$ and $X$, then use the initial condition to get rid of any constants of integration.
E.g., for $T$ you'd get $$\ln T=-\frac {c_1}{2k}\ln\eta+c_2\implies T=c_2\eta^{-c_1/2k}$$
One can also solve $$X''+2k\xi X'-c_1 X=0$$for $X$.
The solution is then $u=X\times T$