Existence of the solution by separation of variables
Statement
For the heat equation ut=αuxx on 0<x<L with boundary conditions u(0,t)=u(L,t)=0 and initial condition u(x,0)=f(x) where f is piecewise continuous, the series u(x,t)=n=1∑∞bnsin(Lnπx)e−α(nπ/L)2t with coefficients bn=L2∫0Lf(x)sin(Lnπx)dx converges (for t>0) to a solution satisfying all three conditions.
Why is it true?
Sine functions with these particular frequencies are exactly the shapes that keep zero temperature at both ends while decaying independently in time; since every reasonable initial shape can be written as a sum of such sine waves (a Fourier sine series), the same decomposition immediately produces the solution at all later times.
Proof sketch
Seek a solution of the separated form u(x,t)=X(x)T(t). Substituting into ut=αuxx gives X(x)T′(t)=αX′′(x)T(t), and dividing by αX(x)T(t) separates the variables: αT(t)T′(t)=X(x)X′′(x)=−λ, where λ must be a constant because the left side depends only on t and the right side only on x.
The boundary conditions u(0,t)=u(L,t)=0 force X(0)=X(L)=0. The eigenvalue problem X′′+λX=0 with these boundary conditions has nontrivial solutions only for λn=(nπ/L)2, n=1,2,3,…, with eigenfunctions sin(Lnπx); any other value of λ forces X≡0. Solving T′(t)=−αλnT(t) then gives Tn(t)=e−α(nπ/L)2t.
Each product un(x,t)=sin(Lnπx)e−α(nπ/L)2t solves the equation and boundary conditions. By linearity, so does any finite or (under mild convergence conditions) infinite sum u(x,t)=n=1∑∞bnsin(Lnπx)e−α(nπ/L)2t. Setting t=0 and using the orthogonality relation ∫0Lsin(Lnπx)sin(Lmπx)dx=0 for n=m (and =L/2 for n=m) to project f(x) onto each mode yields exactly the coefficients bn=L2∫0Lf(x)sin(Lnπx)dx, so the initial condition u(x,0)=f(x) is matched termwise.