
I've been studying the heat equation and separation of variables and came accross this practise question - I wanted to know if I use the same method I use usually is correct i.e. choose a constant and equate to three different cases k^2, -k^2 and k=o.
please correct if me I am wrong, thank you
Hint. Look for a solution of the form: $$ u(x,t)=f(t)\sin\frac{\pi x}{2a}+g(t)\sin\frac{7\pi x}{2a}, $$ which if you plug into the equation you get $$ u_{t}-Du_{xx}=\left(f'(t)+D\frac{\pi^2}{4a^2}f(t)\right)\sin\frac{\pi x}{2a}+\left(g'(t)+D\frac{49 \pi^2}{4a^2}g(t)\right)\sin\frac{7\pi x}{2a}=0, $$ which provides the following to ordinary differential equations $$ f'(t)+D\frac{\pi^2}{4a^2}f(t)=0, $$ and $$ g'(t)+D\frac{49 \pi^2}{4a^2}g(t)=0. $$ Then
$f(t)=f(0)\,\mathrm{e}^{-tD\pi^2/4a^2}=10\,\mathrm{e}^{-tD\pi^2/4a^2}$,
$g(t)=g(0)\,\mathrm{e}^{-49tD\pi^2/4a^2}=20\,\mathrm{e}^{-49tD\pi^2/4a^2}$.
Note that
$$ u(x,t)=10\,\mathrm{e}^{-tD\pi^2/4a^2}\sin\frac{\pi x}{2a}+20\,\mathrm{e}^{-49tD\pi^2/4a^2} \sin\frac{7\pi x}{2a}, $$ satisfies the PDE and all the conditions: initial & boundary.