= Solution
Set $T(x,t)=X(x)G(t)$ in the <heat equation>. <Separation of variables> gives $G'/(c^2G)=X''/X=-\lambda$. Zero endpoint temperatures impose <Dirichlet boundary conditions> $X(0)=X(\pi)=0$, selecting $\lambda=n^2$ for $n\geq1$. The separated factors can therefore be chosen as
$$
\boxed{F_n(x)=\sin nx,\qquad G_n(t)=e^{-c^2n^2t}.}
$$
Zero and negative separation eigenvalues give only the zero spatial solution under these boundary conditions.
The initial profile is continuous and triangular, with midpoint height $\pi/2$. Its <Fourier sine series> coefficients are
$$
a_n=\frac2\pi\left[\int_0^{\pi/2}x\sin nx\,dx+\int_{\pi/2}^\pi(\pi-x)\sin nx\,dx\right]=\boxed{\frac4{\pi n^2}\sin\frac{n\pi}2}.
$$
Consequently the <heat flow from a triangular initial temperature> is
$$
\boxed{T(x,t)=\frac4\pi\sum_{m=0}^\infty\frac{(-1)^m}{(2m+1)^2}e^{-c^2(2m+1)^2t}\sin((2m+1)x).}
$$
For $t\geq0$, each summand has magnitude at most $4/[\pi(2m+1)^2]$. The <Weierstrass M-test> proves absolute and <uniform convergence>. The initial <Fourier sine series> equals the continuous piecewise smooth profile, and for $t>0$ the exponential factors justify termwise spatial and time differentiation on every time interval bounded away from zero.
\Image[/past-exam-of-the-mathematics-course-of-the-year-2-of-the-natural-sciences-course-of-the-university-of-cambridge/2005/paper-1-triangular-heat-flow.png]
{title=Cooling of a bar with a triangular initial temperature profile}
{description=Original normalized solution snapshots, with horizontal coordinate $x/\pi$, temperature divided by its initial maximum $\pi/2$, and time $\tau=c^2t$. Both endpoints remain at zero while the midpoint corner is smoothed.}
Back to article page