PDEs Diffusion eq dirichlet BC I want to find the $2l$ periodic solution of the diffusion equation: 
$u_t = u_{xx}$,  $∀x∈ (0, l), ∀t ∈ ℝ$ 
with initial condition $u(x,0) = x$ 
and the Dirichlet boundary condition $u(0,t) = 0$ and $u(l,t) = 0$
First I know I need solutions of the form $u(x,t)=X(x)T(t)$ then subbing into the eq:
$X(x)T'(t) = X''(x)T(t)$ and dividing through get $\frac{T'(t)}{T(t)} = \frac{X''(x)}{X(x)}$
Then what do I do? I know I need to let it equal some constant λ but don't really understand it. How do I get to the final answer? Thanks to anyone who can help :)
 A: Note that since the R.H.S. is only a function of $x$ and the L.H.S. is only a function of $t$ and since these are independent variables, e.g. one could change while the other remains constant, the only way to achieve the equality for them is to be equal to a constant. Then, as you have noted $${{T'(t)} \over {T(t)}} = \lambda $$ and $${{X''(x)} \over {X(x)}} = \lambda $$The first equation could be easily solved to yield $$T(t) = {C_1}{e^{\lambda t}}$$ for any constant ${C_1}$ the other equation is $$\left\{ \matrix{
  X''(x) - \lambda X(x) = 0 \cr 
  X(0) = 0 \cr 
  X(l) = 0 \cr}  \right.$$ Note that the first equation (about the time dependence) enforces us that if we are discussing a real function, $\lambda $ should be real. Now we consider three distinct cases. The first case If $\lambda $ is a positive number, then $$X(x) = {C_2}{e^{\sqrt \lambda  x}} + {C_3}{e^{ - \sqrt \lambda  x}}$$For the B.C.s to be satisfied, we should have $$\eqalign{
  & {C_2} + {C_3} = 0  \cr 
  & {C_2}{e^{\sqrt \lambda  l}} + {C_3}{e^{ - \sqrt \lambda  l}} = 0 \cr} $$that gives $$\left| {\begin{array}{*{20}{c}}1&1\\{{e^{\sqrt \lambda  l}}}&{{e^{ - \sqrt \lambda  l}}}\end{array}} \right| = 0$$, which obviously gives no solution. The second case is for the eigenvalue to be zero. This case is not able to satisfy the B.C.s either. The third case is for $\lambda $ to be negative. This case leads to solutions of the form $$X(x) = {C_2}\cos (\sqrt { - \lambda } x) + {C_3}\sin (\sqrt { - \lambda } x)$$Now, the B.C.s imply $$\left| {\begin{array}{*{20}{c}}1&0\\{\cos (\sqrt { - \lambda } l)}&{\sin (\sqrt { - \lambda } l)}\end{array}} \right| = 0$$ which leads to $$\sin (\sqrt { - \lambda } l) = 0 \to \lambda  =  - {\left( {\frac{{n\pi }}{l}} \right)^2}$$ for $$n \in \left\{ {1,2,3,...} \right\}$$ (note that negative $n$s give duplicate eigenvalues and eigenfunctions, hence should not be considered)In this case $$X(x) = {C_3}\sin (\frac{{n\pi }}{l}x)$$ so summarizing (and by noting that the superposition holds for this linear equation), we get $$u(x,t) = \sum\limits_{n = 1}^\infty  {{c_n}\sin (\frac{{n\pi }}{l}x){e^{ - {{\left( {\frac{{n\pi }}{l}} \right)}^2}t}}} $$Now, the initial condition reads as $$x = \sum\limits_{n = 1}^\infty  {{c_n}\sin (\frac{{n\pi }}{l}x)}$$ The hint in finding the unknowns (${{c_n}}$s) in this equation is the eigenfunctions orthogonality, i.e. $$n \ne m \to \int\limits_0^l {\sin (\frac{{n\pi }}{l}x)\sin (\frac{{m\pi }}{l}x)dx}  = 0$$We use this property by multiplying both sides of our I.C. equation by ${\sin (\frac{{m\pi }}{l}x)}$. This leads to $${c_m} = \frac{{\int\limits_0^l {x\sin (\frac{{m\pi }}{l}x)dx} }}{{\int\limits_0^l {{{\sin }^2}(\frac{{m\pi }}{l}x)dx} }} =  - \frac{{2{{( - 1)}^m}{l^2}}}{{m\pi }}$$So that finally $$u(x,t) =  - \frac{{2{l^2}}}{\pi }\sum\limits_{n = 1}^\infty  {\frac{{{{( - 1)}^n}}}{n}\sin (\frac{{n\pi }}{l}x){e^{ - {{\left( {\frac{{n\pi }}{l}} \right)}^2}t}}} $$
