I am trying to express the solution of$$\frac{\partial u}{\partial t}=k\frac{\partial^2 u}{\partial x^2}+S(x,t) \tag{1}$$ for $-\infty< x<\infty$ with initial condition $u(x,0)=0$ as an integral involving the source term $S(x,t)$.
Taking the Fourier transform of $(1)$ w.r.t $x$ reduced the PDE to the ODE $$\frac{d}{dt}\hat{u}(w,t)+kw^2\hat{u}(w,t)=\hat{S}(w,t), \tag{2}$$ where I have defined $\hat{u}(w,t)=\mathcal{F}_x(u(x,t))$ (where $\mathcal{F}_x$ denotes the Fourier transform w.r.t $x$). Using the integrating factor $e^{kw^2t}$, the solution to $(2)$ is, $$\hat{u}(w,t)=\int_{0}^{t} e^{kw^2(t'-t)}\hat{S}(w,t') \ dt'.$$ But I am unsure of how to find $u(x,t)$ . I was thinking of simplifying the following $$u(x,t)=\frac{1}{\sqrt{2\pi}}\int_{-\infty}^{\infty}\left(\int_{0}^{t} e^{kw^2(t'-t)}\hat{S}(w,t') \ dt'\right) e^{iwx} \ dw.$$
Note the answer is $$u(x,t)=\frac{1}{\sqrt{2\pi}}\int_{0}^{t}\left(\int_{-\infty}^{\infty}\frac{\exp(-(x-x')^2/(4k(t-t')))}{\sqrt{2k(t-t')}}S(x',t') \ dx'\right) \ dt$$