inhomogeneous pdes by separation of variables This is the problem:
$u_t=c^2 u_{xx}+g(x,t),0<x<l,\text{ and } t>0$
$u(0,t)=0=u(l,t)$, $t\ge 0$
$u(x,0)=f(x)$
I have trouble passing this problem to homogeneous form

Solve
$$
v_t-v_{xx}=0,\quad v(0,t)=v(\ell,t)=0,\quad v(x,0)=f(x)
$$
and
$$
w_t-w_{xx}=g(x,t),\quad w(0,t)=w(\ell,t)=0,\quad w(x,0)=0.
$$
The $u=v+w$. Standard separation of variables gives $v$ in the form
$$
v(x,t)=\sum_{n=1}^\infty a_n\,e^{-\bigl(\tfrac{k\,\pi}{\ell}\bigr)^2\,t}\,\sin\frac{k\,\pi\,x}{\ell}.
$$
To find $w$ develop $g$ in a Fourier series with coefficients depending on $t$:
$$
g(x,t)=\sum_{n=1}^\infty g_n(t)\sin\frac{k\,\pi\,x}{\ell}
$$
and look for $w$ of the form
$$
w(x,t)=\sum_{n=1}^\infty w_n(t)\sin\frac{k\,\pi\,x}{\ell}.
$$
This leads to the first order ordinary linear differential equation for $w_n$
$$
w_n'+\Bigl(\frac{k\,\pi}{\ell}\Bigr)^2\,w_n=g_n,\quad w_n(0)=0.
$$
