Derive the solution $u(x,t)=\frac{x}{\sqrt{4 \pi}} \int_{0}^{t} \frac{1}{(t-s)^{3/2}}e^{\frac{-x^2}{4(t-s)}}g(s) \, ds$ for the heat equation

Given $g: [0,\infty) \rightarrow \R$, with $g(0)=0$, derive the formula
\[u(x,t)=\frac{x}{\sqrt{4 \pi}} \int_{0}^{t} \frac{1}{(t-s)^{3/2}}e^{\frac{-x^2}{4(t-s)}}g(s) \, ds\] for a solutions of the initial/boundary-value problem
\[\begin{aligned} u_t - u_{xx} &= 0 &\qquad& \text{in } \R_+ \times (0,\infty) \\ u&=0 && \text{on } \R_+ \times \{t=0\}, \\ u&=g && \text{on } \{x=0\} \times [0,\infty). \end{aligned}\]
(Hint: Let $v(x,t) := u(x,t) - g(t)$  and extend $v$ to $\{x<0\}$ by odd reflection.)

Answer

Define
$$v(x,t)= \begin{cases} u(x,t)-g(t) & x>0,\\ -u(-x,t) +g(t) & x \leq 0. \end{cases} \hspace{0.5cm} \Rightarrow \hspace{0.5cm} v(x,0)= 0 \ \ \forall x\in \mathbb{R}^n.$$

Then it is easy to check that
$$v_t(x,t)-\Delta v(x,t)= \begin{cases} -g'(t) & x>0,\\ g'(t) & x \leq 0. \end{cases}$$ 
By representation formula for the solution to the nonhomogenous heat equation
$$u(x,t)=\int_0^t \int_{\R} \varphi (x-y, t-s) f(y,s) \, dy \, ds,$$ which gives

$$v(x,t) = -\int_0^t \int_0^\infty \varphi (x-y, t-s) g'(s) \, dy \, ds + \int_0^t \int_{-\infty}^0 \varphi (x-y, t-s) g'(s) \, dy \, ds$$ 
$$=-\int_0^t \int_{-\infty}^\infty \varphi (x-y, t-s) g'(s) \, dy \, ds + 2\int_0^t \int_{-\infty}^0 \varphi (x-y, t-s) g'(s) \, dy \, ds$$
$$= -\int_0^t g'(s) \, ds + 2\int_0^t \int_{-\infty}^0 \varphi (x-y, t-s) g'(s) \, dy \, ds. \ \ \ \ (1)$$
We define $f(s) := \int_{-\infty}^{0} \varphi (x-y,t-s) \, dy$  and $z := \frac{x-y}{\sqrt{4 (t-s)}}$ . Then
$$f(s) = \int_{-\infty}^{0} \frac{1}{(4 \pi(t-s))^{1/2}} e^{- \frac{(x-y)^2}{4(t-s)}} \, dy = \frac{1}{\sqrt{\pi}} \int_{\frac{x}{\sqrt{4(t-s)}}}^{\infty} e^{-z^2} \, dz, $$ and
$$f'(s) = - \frac{x}{4 \sqrt{\pi}(t-s)^{3/2}} e^{- \frac{x^2}{4(t-s)}}.$$
We continue simplifying (1) using integration by parts,
$$v(x,t)=-g(t) + 2 \left[ f(s)g(s) \right]_0^t -2\int_{0}^{t} g(s) f'(s) \, ds =-g(t)+ \frac{x}{\sqrt{4\pi}} \int_{0}^{t} \frac{1}{(t-s)^{3/2}} e^{-\frac{x^2}{4(t-s)}} g(s) \, ds.$$
This leaves us with
$$(2)      u(x,t)=v(x,t)+g(t)=\frac{x}{\sqrt{4\pi}} \int_{0}^{t} \frac{1}{(t-s)^{3/2}} e^{-\frac{x^2}{4(t-s)}} g(s) \, ds. $$
Also since $v$ is smooth and odd with respect to $x$, we have $v(0,t)=0.$ Thus it follows from (2) that $$u(0,t)=g(t), \ \ \forall t>0.$$  

The answer is accepted.