<s>[INST] Solving $u_t=4u_{xx}$ How do we solve the folllowing diffusion problem?
$u_t=4u_{xx}$
$u(0,t)=0$
$u(3,t) = 0$
$u(x,0)=\sin(2\pi x/3)-2\sin(\pi x)+7\sin(5\pi x/3)$
 [/INST] Let $u(x,t)=\sum\limits_{n=1}^\infty C(n,t)\sin\dfrac{n\pi x}{3}$ so that it automatically satisfies $u(0,t)=u(3,t)=0$, Then:
$$\sum\limits_{n=1}^\infty C_t(n,t)\sin\dfrac{n\pi x}{3}=-\dfrac{4n^2\pi^2}{9}\sum\limits_{n=1}^\infty C(n,t)\sin\dfrac{n\pi x}{3}$$
$$\therefore C_t(n,t)=-\dfrac{4n^2\pi^2}{9}C(n,t)$$
And:
$$\dfrac{C_t(n,t)}{C(n,t)}=-\dfrac{4n^2\pi^2}{9}\rightarrow\int\dfrac{C_t(n,t)}{C(n,t)}dt=\int-\dfrac{4n^2\pi^2}{9}dt$$
$$\ln C(n,t)=-\dfrac{4n^2\pi^2t}{9}+f(n)\rightarrow C(n,t)=F(n)e^{-\frac{4n^2\pi^2t}{9}}$$
$$\therefore u(x,t)=\sum\limits_{n=1}^\infty F(n)e^{-\frac{4n^2\pi^2t}{9}}\sin\dfrac{n\pi x}{3}$$
Given that:
$$u(x,0)=\sin\dfrac{2\pi x}{3}-2\sin\pi x+7\sin\dfrac{5\pi x}{3}$$
We can derive:
$$\sum\limits_{n=1}^\infty F(n)\sin\dfrac{n\pi x}{3}=\sin\dfrac{2\pi x}{3}-2\sin\pi x+7\sin\dfrac{5\pi x}{3}$$
$$F(n)=\begin{cases}1&\text{when}~n=2\\-2&\text{when}~n=3\\7&\text{when}~n=5\\0&\text{otherwise}\end{cases}$$
$$\therefore u(x,t)=e^{-\frac{16\pi^2t}{9}}\sin\dfrac{2\pi x}{3}-2e^{-4\pi^2t}\sin\pi x+7e^{-\frac{100\pi^2t}{9}}\sin\dfrac{5\pi x}{3}$$
Note that this solution suitable for $x,t\in\mathbb{C}$ .
</s>