# Nonhomogeneous Diffusion Equation with Nonhomogeneous Dirichlet Boundary Condition

How to solve:

\begin{cases} u_t - ku_{xx} = g(x,t) \hspace{2cm} k>0, x>0, t>0 \\ u(0,t) = f(t) \hspace{3cm} t>0 \\ u(x,0) = h(x) \hspace{2.8cm} x>0 \end{cases}

I know how to solve the homogenous problem with $g(x,t) = 0$ and $f(t)=0$ and the hint is to make a change of variables to have a problem with Dirichlet boundary condition $f(t) = 0$.

I have tried $u(x,t) = v(x,t)+f(t)$ but I don't know how to have the same problem with $g(x,t) = 0$ so I can solve it the same way I solved the homogenous one.

Any help?

First, split it into two separate problems. Let $u = u_1 + u_2$ and let $$u_{1t} - k u_{1xx} = 0; u_1(0,t) = f(t); u_1(x,0) = h(x)$$ and $$u_{2t} - k u_{2xx} = g(x,t); u_2(0,t) = 0; u(x,0) = 0$$
Note that you can transform the first problem into the form of the second one by considering $v(x,t) = u_1(x,t) - f(t)$. In order to solve the second form, you just need to consider the Eigen-expansion of the non-homogenous term $g(x,t)$ and equate coefficients appropriately.