# Inhomogeneous heat equation on finite interval

My question is, how to solve an inhomogeneous heat equation on finite interval. The problem is $$u_{t} - ku_{xx} = f(x, t)$$ on finite interval with homogeneous Dirichlet boundary condition $$u(0, t) = u(L, t) = 0$$ and initial condition $$u(x, 0) = \phi(x)$$ in $$0 < x < L$$. My approach is using extended function that, solving $$u_x - ku_{xx} = f_{ext}(x, t)$$ with homogeneous DC and initial condition $$u(x, 0) = \phi_{ext}(x)$$ where $$f_{ext} = \begin{cases} f(x, t) & \mbox{if } 0 and $$\phi_{ext}$$ defined likely. I think that the solution is, $$u (x, t) = \int_{-\infty}^{\infty} S(x-y, t) \phi_{ext}(y) \, dy \, + \int_0^t \!\! \int_{-\infty}^{\infty} S(x-y, t-s) f_{ext}(y, s) \, dy \,ds.$$ $$S(x, t) = \frac{1}{\sqrt{4\pi kt}} \exp(-\frac{x^2}{4kt})$$ is heat kernel. I think that this solution satisfies boundary condition, since two extended functions are odd-symmetric to $$x = 0$$ and $$x = L$$. I wonder that whether this argument is valid. Further, can this method be applied for Neumann boundary and Robin boundary condition?

Summary

• How to solve 1-D inhomogeneous heat equation in finite interval?
• Is the method above valid?
• If it is valid, can it be applied for other boundary conditions?