We consider the linear partial differential equation governing heat diffusion in one dimension:
$$\frac{\partial \phi}{\partial t} = 4 \frac{\partial^2 \phi}{\partial x^2}, \quad 0 < x < 1, \quad t > 0$$Subject to the homogeneous Dirichlet boundary conditions:
$$\phi(0, t) = 0, \quad \phi(1, t) = 0, \quad \text{for all } t > 0$$And the initial condition:
$$\phi(x, 0) = \sin(3\pi x), \quad 0 \le x \le 1$$Assume the solution is of the form $\phi(x,t) = X(x)T(t)$. Substituting into the PDE gives:
$$X(x) T'(t) = 4 X''(x) T(t)$$Rearranging to seperate the variables gives:
$$\frac{T'(t)}{4 T(t)} = \frac{X''(x)}{X(x)} = -\lambda$$where $\lambda$ is a constant separation parameter.
The spatial equation and boundary conditions $X(0)=0$ and $X(1)=0$ form the eigenvalue problem:
$$X''(x) + \lambda X(x) = 0$$For non-trivial solutions under zero boundary conditions, $\lambda$ must be positive ($\lambda = \beta^2$):
$$X(x) = C_1 \cos(\beta x) + C_2 \sin(\beta x)$$Applying $X(0) = 0 \implies C_1 = 0$.
Applying $X(1) = 0 \implies C_2 \sin(\beta) = 0 \implies \beta = n\pi$ for $n = 1, 2, 3, \dots$
Thus, the eigenvalues and corresponding eigenfunctions are:
$$\lambda_n = (n\pi)^2 = n^2\pi^2, \quad X_n(x) = \sin(n\pi x)$$Using $\lambda_n = n^2\pi^2$, the time equation becomes:
$$T_n'(t) + 4 n^2 \pi^2 T_n(t) = 0$$Solving this first-order ordinary differential equation gives:
$$T_n(t) = e^{-4 n^2 \pi^2 t}$$Taking a superposition of $X_n(x)$ and $T_n(t)$, the general solution is:
$$\phi(x, t) = \sum_{n=1}^{\infty} B_n \sin(n\pi x) e^{-4 n^2 \pi^2 t}$$At $t = 0$, we substitute the initial distribution $\phi(x, 0) = \sin(3\pi x)$:
$$\phi(x, 0) = \sum_{n=1}^{\infty} B_n \sin(n\pi x) = \sin(3\pi x)$$Equating Fourier sine coefficients on both sides:
Substituting $B_3 = 1$ back into the series yield the final exact solution:
$$\phi(x, t) = \sin(3\pi x) e^{-36 \pi^2 t}$$