solution to heat equation in a particular case $$\frac{\partial u}{\partial t}(t,x)-\frac{1}{2}\frac{\partial^2 u}{\partial x^2}(t,x)=0,\ \  t>0, x\in\mathbb{R}$$
$$u(0,x)=\max(x,0)$$
$$\frac{\partial v}{\partial t}(t,x)-\frac{1}{2}\frac{\partial^2 v}{\partial x^2}(t,x)=0,\ \  t>0, x>-K$$
$$v(0,x)=\max(x,0), \ \ v(t,-K)=0$$
Could someone give the explict solution to these two problems? Thanks a lot!
 A: We consider the more general problem
$\left\{
  \begin{array}{l l}
    \frac{\partial u}{\partial t}-\frac{1}{2}\frac{\partial^2 u}{\partial x^2}=0,\,\,x\in\mathbb{R},\,\,t>0\\
    u(x,0)=g(x)
  \end{array} \right.$
and take the Fourier transform of the PDE with respect to $x$:
$$\mathcal{F}_x\left(\frac{\partial u}{\partial t}-\frac{1}{2}\frac{\partial^2 u}{\partial x^2}\right)=\mathcal{F}_x(0) \implies \int_\mathbb{R}\frac{\partial u}{\partial t}e^{-ix\xi}\,\mathrm{d}x-\frac{1}{2}\int_\mathbb{R}\frac{\partial^2 u}{\partial x^2}e^{-ix\xi}\,\mathrm{d}x=0$$
$$\hat{u}(\xi,t):=\mathcal{F}_x(u)=\int_\mathbb{R}u(x,t)\,e^{-ix\xi}\,\mathrm{d}x \implies \underbrace{\frac{\partial \hat{u}}{\partial t}(\xi,t)-\frac{1}{2}(i\xi)^2\hat{u}(\xi,t)}_{\frac{\partial \hat{u}}{\partial t}+\frac{1}{2}\xi^2\hat{u}}=0$$
The general solution to the above ODE is $\hat{u}(\xi,t)=c(\xi)e^{-\frac{1}{2}\xi^2t}$. But
$$c(\xi)=\hat{u}(\xi,0)=\int_\mathbb{R}u(x,0)\,e^{-ix\xi}\,\mathrm{d}x=\int_\mathbb{R}g(x)\,e^{-ix\xi}\,\mathrm{d}x=:\hat{g}(\xi),$$
so $\hat{u}(\xi,t)=\hat{g}(\xi)e^{-\frac{1}{2}\xi^2t}=:\hat{g}(\xi)\hat{G}(\xi,t)$.
Now, let us find the inverse Fourier transform of $\hat{u}(\xi,t)$. Since $\mathcal{F}_x^{-1}\left(\sqrt{\pi}e^{-\xi^2/4}\right)=e^{-x^2}$, it follows that
$$\mathcal{F}_x^{-1}(\hat{G})=\mathcal{F}_x^{-1}\left(e^{-\frac{1}{2}t\xi^2}\right)=\frac{1}{\sqrt{\pi}}\frac{1}{\sqrt{4\cdot\frac{1}{2}t}}e^{-x^2/\left(4\cdot\frac{1}{2}t\right)}=\frac{1}{\sqrt{2\pi t}}e^{-x^2/2t}=:G(x,t)$$
Furthermore, since $\hat{u}(\xi,t)=\hat{g}(\xi)\cdot\hat{G}(\xi,t)$, the convolution theorem tells us that
$$u(x,t)=(g*G)(x,t)=\frac{1}{\sqrt{2\pi t}}\int_\mathbb{R}g(\alpha)\,e^{-(x-\alpha)^2/2t}\,\mathrm{d}\alpha$$
The function $G(x,t)$ is a so called Green's function, but that is not indispensable to know here.
Now, we choose $g(x)=max(x,0)=x\theta(x)$ and obtain
$$u(x,t)=\frac{1}{\sqrt{2\pi t}}\int_\mathbb{R}\alpha\,\theta(\alpha)\,e^{-(x-\alpha)^2/2t}\,\mathrm{d}\alpha=\frac{1}{\sqrt{2\pi t}}\int_0^\infty\alpha\,e^{-(x-\alpha)^2/2t}\,\mathrm{d}\alpha$$
Unfortunately, this integral looks to be non-elementary.
As for the second problem, perhaps you could use the superposition principle?
