Solve the pde $u_t(x,t)=u_{xx}(x,t)-bu(x,t)+q(t)$ for $u(x,t)$ I have the example pde $u_t(x,t)=u_{xx}(x,t)-b(t)u(x,t)+q_0$, where $b(t)$ is a function of only $t$ and $q_0$ is a constant, $0<x<\pi$, $t>0$. The subscripts denote derivatives. I also have some boundary conditions: $u(x,0)=0$ and $u(0,t)=0=u(\pi,t)$. The problem solution using variation of parameters is $$u(x,t)=\frac{4q_0}{\pi a(t)}\sum\limits_{n=1}^\infty \frac{\sin((2n-1)x)}{2n-1}\int\limits_0^t e^{-(2n-1)^2(t-\tau)}a(\tau)d\tau$$ where $$a(t)=e^{\int\limits_0^t b(\sigma)d\sigma}.$$
The problem I'm working on is slightly different. It gives the pde $u_t(x,t)=u_{xx}(x,t)-bu(x,t)+q(t)$ where $b$ is a constant and $q(t)$ is a function of only $t$, $0<x<\pi$, $t>0$. The solution should be very similar to that of the example.
I don't know where to start. I'm using the textbook "Fourier Series and Boundary Value Problems" by Churchill and Brown, 7th edition, if anyone's interested. The "example" is problem 10 page 117 of that book.
Any help/hints would be greatly appreciated. Thanks!
 A: Let $u(x,t)=\sum\limits_{n=1}^\infty C(n,t)\sin nx$ so that it automatically satisfies $u(0,t)=u(\pi,t)=0$ ,
Then $\sum\limits_{n=1}^\infty C_t(n,t)\sin nx=-\sum\limits_{n=1}^\infty n^2C(n,t)\sin nx-b\sum\limits_{n=1}^\infty C(n,t)\sin nx+q(t)$
$\sum\limits_{n=1}^\infty(C_t(n,t)+(n^2+b)C(n,t))\sin nx=\sum\limits_{n=1}^\infty2q(t)\int_0^\pi\sin nx~dx~\sin nx$ , where $0<x<\pi$
$\sum\limits_{n=1}^\infty(C_t(n,t)+(n^2+b)C(n,t))\sin nx=\sum\limits_{n=1}^\infty2q(t)\left[-\dfrac{\cos nx}{n}\right]_0^\pi\sin nx$ , where $0<x<\pi$
$\sum\limits_{n=1}^\infty(C_t(n,t)+(n^2+b)C(n,t))\sin nx=\sum\limits_{n=1}^\infty\dfrac{2(1-(-1)^n)q(t)\sin nx}{n}$ , where $0<x<\pi$
$\therefore C_t(n,t)+(n^2+b)C(n,t)=\dfrac{2(1-(-1)^n)q(t)}{n}$
$(e^{(n^2+b)t}C(n,t))_t=\dfrac{2(1-(-1)^n)q(t)e^{(n^2+b)t}}{n}$
$e^{(n^2+b)t}C(n,t)=\dfrac{2(1-(-1)^n)}{n}\int q(t)e^{(n^2+b)t}~dt$
$e^{(n^2+b)t}C(n,t)=A(n)+\dfrac{2(1-(-1)^n)}{n}\int_0^tq(t)e^{(n^2+b)t}~dt$
$C(n,t)=A(n)e^{-(n^2+b)t}+\dfrac{2(1-(-1)^n)e^{-(n^2+b)t}}{n}\int_0^tq(t)e^{(n^2+b)t}~dt$
$\therefore u(x,t)=\sum\limits_{n=1}^\infty\left(A(n)e^{-(n^2+b)t}+\dfrac{2(1-(-1)^n)e^{-(n^2+b)t}}{n}\int_0^tq(t)e^{(n^2+b)t}~dt\right)\sin nx$
$u(x,0)=0$ :
$\sum\limits_{n=1}^\infty A(n)\sin nx=0$
$A(n)=0$
$\therefore u(x,t)=\sum\limits_{n=1}^\infty\dfrac{2(1-(-1)^n)e^{-(n^2+b)t}}{n}\int_0^tq(t)e^{(n^2+b)t}~dt~\sin nx=\sum\limits_{n=1}^\infty\dfrac{2e^{-((2n-1)^2+b)t}}{2n-1}\int_0^tq(t)e^{((2n-1)^2+b)t}~dt~\sin((2n-1)x)~,~\text{where}~0<x<\pi$
A: It would be helpful to transform the problem with:
$$ u(x,t)=e^{-bt}w(x,t)$$ to get
$$ w_{t}=w_{xx}+e^{bt}q(t). $$ This nicely gets rid of the $u(x,t)$ term. The BCs become $w(x,0)=w(0,t)=w(\pi,t)=0.$ I think there are at least a couple ways of proceding with this nonhomogenious equation with homogenious BCs; Laplace Transform or the method of eigenfunction expansions might be a couple of candidates. 
Hope this helps,
Paul Safier
