Solve $$u_t=ku_{xx}\\u(x,0)=g(x)$$ for $t\ge 0, -\infty<x<\infty$, where $g(x) = e^{-2x}$.
We have that the solution is given by $u(x,t) = \frac{1}{\sqrt{4\pi kt}}\int_{-\infty}^\infty e^{-(x-y)^2/4kt} \cdot e^{-2y} dy$ .
I'd like to apply the change of variable $-p^2=-2y-\frac{(x-y)^2}{4kt}$ to arrive to something like $\int e^{-p^2}$ and then to write the answer in terms of Erf(z) function, but I'm having difficulties trying to find the limits of the integral after the change of variable.
The problem is the infinity symbol, because I get $p=-2(\infty+\frac{(x-y)^2}{8ky})$ which I don't know how to interpret.
What to do in this case?
Your change of variables won't work because you will still have $y$ in the integral. To show this, take the infinitesimal change of $p$ $$dp=\left(2y+\frac{(x-y)^2}{4kt}\right)^{-1/2}\left(1+\frac{y-x}{4kt}\right)dy$$ Instead, you should expand $(x-y)^2$ and attempt to reduce the problem to a version of the previous question you asked here. $$\begin{align} 2y+\frac{(x-y)^2}{4kt} &= 2y + \frac{1}{4kt}\left(x^2-2xy+y^2\right) = \frac{x^2}{4kt} + y\left(2-\frac{x}{2kt}\right)+\frac{y^2}{4kt}\\ &= \frac{x^2}{4kt}+y\left(\frac{8kt}{4kt}-\frac{2x}{4kt}\right)+\frac{y^2}{4kt}\\ &= \frac{1}{4kt}\left[x^2-(x-4kt)^2+(x-4kt)^2-2y(x-4kt)+y^2\right]\\ &= \frac{1}{4kt}\left[x^2-(x-4kt)^2+(x-4kt-y)^2\right]\\ &= 2x-4kt+\frac{(x-4kt-y)^2}{4kt} \end{align}$$ Let's plug this in and take a look at what the integral looks like now $$u(x,t)=\frac{1}{\sqrt{4\pi kt}}\int_{-\infty}^\infty e^{-\frac{(x-y)^2}{4kt}}e^{-2y}dy=\frac{e^{-2x+4kt}}{\sqrt{4\pi kt}}\int_{-\infty}^\infty e^{-\frac{(x-4kt-y)^2}{4kt}}dy$$ Now this looks like the problem that was linked above and we can use the same procedure. Take the variable change to be $p=\frac{x-4kt-y}{\sqrt{4kt}}$. Choosing the new limits of integration is as simple as plugging in the old limits of integration into $p$ and we find that $y\to\infty\implies p\to-\infty$ and $y\to-\infty\implies p\to\infty$. Applying the change of variables yields $$u(x,y)=-\frac{e^{-2x+4kt}}{\sqrt{\pi}}\int_\infty^{-\infty}e^{-p^2}dp=\frac{e^{-2x+4kt}}{\sqrt{\pi}}\int_{-\infty}^\infty e^{-p^2}dp$$ Luckily for us, we do not need to write this in terms of the error function as this integral is known to be equal to $\sqrt{\pi}$. We now find a simple representation of the solution $$\boxed{u(x,t)=e^{-2x+4kt}}$$ Plugging this into the original PDE confirms the solution. May the Fourth be with you.