I don't quite understand what I am supposed to do with the last given condition $u(x,0)$.
I solved for all the different cases of $λ$ and got that $$u(x,t) = e^{-3n^2π^2t}(Bsin(nπx)) $$
where $B≠0$
From here I get confused. In our answer key it simply says:
I would appreciate it if someone could explain what is done in the last step. Thank you!


According to my calculation,
$u(x,t) = \sum^{\infty}_{n=1}a_n cos(n\pi x)e^{-3(n\pi)^2t}$
Using the given initial condition, we can know that
When $n = 3 \rightarrow a_3 = 2$ and $n=5 \rightarrow a_5 = 4$. and $a_n = 0$ otherwise.
Therefore, $u(x,t) = 2\cos(3\pi x)e^{-3(9\pi^2)t} \ + 4\cos(5\pi x)e^{-3(25 \pi^2)t}$