How to solve this diffusion equation? I need to solve this equation:
$$\frac{\partial C}{\partial t}= D \frac{\partial ^2C}{\partial x^2} +\lambda C $$
with :$ \frac{\partial C(0,t)}{\partial x} =0$ and $C(L,t)=0$  and $C(x,0)=\cos(\pi x/2L)$ 
I'm confused beceause if I try to solve it with seperation of variables , I still have the problem with the factor $\lambda$. 
I don't know how to solve it. 
 A: The separation of variable $ C=T(t)X(x) $ gives
$$ \frac{T'}{T}=D\frac{X''}{X}+\lambda=A=constant. $$
The boundary condition implies $ X'(0)=0 $ and $ X(L)=0 $, so we first solve for $ X(x) $:
$$ X''+\frac{\lambda-A}{D}X=0 ,$$
so $ \frac{\lambda-A}{D}>0 $ and 
$$ X(x)=\cos(\frac{(n+1/2)\pi}{L}),\quad n=0,1,2,\cdots ;$$
$$ A=\lambda-\frac{(n+1/2)^2\pi^2}{L^2}=\frac{T'}{T} ;$$
and the last equation solves for $ T(t) $.
A: Hint: you can hide $\lambda$ in the calculation by using the transformation $U=e^{-\lambda t}C$, then the equation becomes $\dfrac{\partial U}{\partial t}=D\dfrac{\partial ^2 U}{\partial x^2}$.
A: Using the Laplace transform
$$
s C(s,x)-C_0(x) = D C_{xx}(s,x)+\lambda C(s,x)
$$
or
$$
(s - \lambda)C(s,x) - D C_{xx}(s,x)=-\cos\left(\frac{\pi x}{2L}\right)
$$
solving for $x$ with the boundary conditions we get
$$
C(s,x) = \frac{4 L^2 \cos \left(\frac{\pi  x}{2 L}\right)}{\pi ^2 D+4 L^2 (s-\lambda )}
$$
and after inversion
$$
C(t,x) = \cos \left(\frac{\pi  x}{2 L}\right) e^{-\frac{t \left(\pi ^2 D-4 L^2 \lambda \right)}{4 L^2}}
$$
