# Diffusion equation with dirichlet condition by seperation of variables

The problem is this: $$\begin{cases} U_t = 3U_{xx}, \quad 0 < x < 2\pi, \\ U(0,t) = U(2\pi,t) = 0, & \\ U(x,0) = 2 \sin x + 5 \sin 3x \end{cases}$$ I want to express this as an infinite series but I'm not sure how to express the coefficient. It seems that given its form I shouldn't be too complicated.

-
Looks like there's a typo: $2 \sin x + 5 \sin x = 7\sin x$? – gt6989b Oct 22 '12 at 20:49
Fixed it. Thanks – rmh52 Oct 22 '12 at 20:56

$$U(x,t) = \sum_{n=1}^{\infty}f_n(t) \sin(n x)$$ This gives us $$\sum_{n=1}^{\infty}f_n'(t) \sin(n x) = -3 \sum_{n=1}^{\infty}n^2 f_n(t) \sin(n x)$$ Hence, $$f_n'(t) + 3n^2 f_n(t) = 0 \implies f_n(t) = f_n(0) \exp(-3n^2t)$$ $$f_n(0) = \begin{cases}2 & n=1\\ 5 & n=3 \\ 0 & \text{otherwise}\end{cases}$$ Hence, $$U(x,t) = 2 \exp(-3t) \sin(x) + 5 \exp(-27t) \sin(3x)$$

-
Perfect. This is what I got as well – rmh52 Oct 22 '12 at 21:06