Fourier Series Solutions of Boundary Value Problems
How do you turn a single separated solution into one that matches an arbitrary initial temperature distribution? This question is left open by Separation of Variables for the Heat Equation. That article produces infinitely many building-block solutions un(x,t)=sin(nπx/L)e−λnt. But no single one of them fits a generic initial condition f(x). The resolution is to superpose all of them. We choose the coefficients so the infinite sum matches f(x) at t=0. This is possible precisely because the eigenfunctions sin(nπx/L) are mutually orthogonal. That orthogonality turns an intractable-looking matching problem into a simple projection computation. This orthogonality trick is one of the most consequential ideas in applied mathematics. It converts a boundary value problem for a PDE into a completely explicit formula for coefficients, via an integral. The same mechanism recurs whenever a differential operator with boundary conditions produces an orthogonal family of eigenfunctions. Examples include sines, cosines, Legendre polynomials, and Bessel functions. It is the seed from which the general theory of Eigenfunction Expansions grows. The big picture is this: separation of variables reduces a PDE to two ODEs. One of these is a boundary value problem whose solutions, the eigenfunctions, form a countable orthogonal set. Any reasonable function f on the domain can then be written as an infinite linear combination of these eigenfunctions. This is called a generalized Fourier series. The coefficients are computed by taking inner products. This works exactly as one finds vector components in Rn using an orthonormal basis. This article makes that computation rigorous. We state the orthogonality relations for sines and cosines on a finite interval. We prove them from scratch using only elementary calculus. We then use them to derive the coefficient formulas for Fourier sine and cosine series. We apply the results to solve concrete heat conduction problems with genuinely asymmetric initial data. This ensures no cancellation or symmetry masks an error in the method.
Key takeaways
Separation of variables yields eigenfunctions sin(nπx/L) or cos(nπx/L); a general solution is an infinite superposition of these.
The eigenfunctions are pairwise orthogonal on [0,L] under the integral inner product ⟨f,g⟩=∫0Lfgdx.
Orthogonality lets you extract each coefficient cn from f(x)=∑cnϕn(x) by integrating fϕn against a normalizing constant.
Dirichlet conditions force a sine series; Neumann conditions force a cosine series; the boundary conditions of the PDE dictate which family appears.
The coefficient formulas are the same Euler–Fourier formulas used for periodic Fourier series, restricted to a half-period.
Key idea: orthogonality of eigenfunctions turns "match the initial data" into a single explicit integral for each coefficient.
Where this lives today
The orthogonality-and-projection technique developed here is not confined to the heat equation. In acoustics and structural engineering, the same sine and cosine eigenfunctions describe vibration modes of strings and beams, and their coefficients determine how a given pluck or impact excites each mode. In electrical engineering and signal processing, Fourier series and their discrete analogues (the DFT and FFT) decompose periodic signals into frequency components, using exactly the same orthogonality of sinusoids over a period. In quantum mechanics, the coefficient-extraction idea generalizes directly: wavefunctions are expanded in eigenfunctions of the Hamiltonian, and the "Fourier coefficients" become probability amplitudes for measuring definite energy states. In numerical analysis, truncated Fourier expansions underlie spectral methods for solving PDEs, prized for their rapid convergence on smooth periodic data. In statistics and cryptography, orthogonal function expansions and their discrete cousins appear in signal reconstruction, compressed sensing, and the algebraic structure exploited by number-theoretic transforms.
Ask the tutor: How does this coefficient-extraction method generalize when the boundary value problem produces eigenfunctions that are not sines or cosines, such as Bessel functions or Legendre polynomials?
:::definition[Fourier Sine and Cosine Series on [0,L]] Let f:[0,L]→R be piecewise continuous. Define the Fourier sine series of f as
These are, respectively, the ordinary Fourier series of the odd and even2L-periodic extensions of f from [0,L] to R. The symbol ∼ denotes formal correspondence; conditions under which the series converges pointwise to f are addressed separately (see Convergence of Fourier Series Solutions).
Intuition
Think of piecewise continuous functions on [0,L] as vectors in an infinite-dimensional space, equipped with the inner product ⟨f,g⟩=∫0Lf(x)g(x)dx. In ordinary Euclidean space Rn, if {e1,…,en} is an orthogonal basis, any vector v decomposes as v=∑ciei with ci=⟨v,ei⟩/⟨ei,ei⟩ — you find each component by projecting onto the corresponding axis, and the other axes contribute nothing because they are perpendicular. The functions sin(nπx/L) for n=1,2,3,… play the role of orthogonal axes in this function space. When you "dot" f with sin(mπx/L), every term in the series except the m-th integrates to zero, and the m-th term integrates to a computable nonzero number. That is the entire mechanism: orthogonality annihilates cross terms and isolates one coefficient at a time. The reason sines (rather than cosines, or some other family) appear is dictated by the boundary conditions of the physical problem. A rod with both ends held at zero temperature (Dirichlet conditions u(0,t)=u(L,t)=0) forces the spatial eigenfunctions to vanish at x=0,L, which only sin(nπx/L) does among {sin,cos}. A rod with insulated ends (Neumann conditions ux(0,t)=ux(L,t)=0) forces zero slope at the ends, which selects cos(nπx/L) instead (including the constant function, n=0).
:::svg[Orthogonal sine eigenfunctions on [0,L] and their role as "axes"]
Setting up the problem
Consider the standard heat conduction boundary value problem on a rod of length L with fixed zero end temperatures:
ut=α2uxx,0<x<L,t>0,
u(0,t)=0,u(L,t)=0,t>0,
u(x,0)=f(x),0<x<L.
Separation of variables (assumed known) produces the elementary product solutions
un(x,t)=sin(Lnπx)e−α2(nπ/L)2t,n=1,2,3,…,
each of which satisfies the PDE and both boundary conditions. Because the PDE and boundary conditions are linear and homogeneous, any finite linear combination of the un is again a solution, and — accepting termwise differentiability of the infinite sum, a technical point addressed in the study of convergence — so is the infinite superposition
u(x,t)=n=1∑∞bnsin(Lnπx)e−α2(nπ/L)2t.
The only remaining requirement is the initial condition:
u(x,0)=n=1∑∞bnsin(Lnπx)=f(x),0<x<L.
This is exactly a Fourier sine series matching problem. The theorem below shows how orthogonality determines the bn uniquely.
:::theorem[Orthogonality of the Sine and Cosine Eigenfunctions on [0,L]] Let L>0 and let m,n be positive integers. Then
need not vanish in general (sine and cosine bases are not mutually compared here; each family is used separately, so this mixed integral plays no role in what follows).
Proof
We use the product-to-sum trigonometric identities, which follow from the angle-addition formulas
Since m=n, m−n is a nonzero integer, so its cosine term integrates to 0 by the computation above. If m,n are not both zero then m+n>0 is a nonzero integer and that term also integrates to 0 (if m=n=0 is excluded from this case by hypothesis m=n, so m+n≥1>0 automatically). Hence the whole integral is 0.
Case m=n=0, cosine-cosine. Then cos(0)cos(0)=1, so ∫0L1dx=L.
Case m=n≥1, cosine-cosine. Then m−n=0 gives cos(0)=1 and m+n=2n=0 gives a vanishing integral, so
All cases are proved by direct antiderivative computation; no circularity is involved since only the angle-addition formulas and the fundamental theorem of calculus were used. ■
∎
CorollaryCoefficient Formulas via Orthogonality
Suppose f(x)=∑n=1∞bnsin(nπx/L) for x∈(0,L), where the series converges and may be integrated term by term after multiplying by sin(mπx/L). Then for every positive integer m,
bm=L2∫0Lf(x)sin(Lmπx)dx.
Similarly, if f(x)=2a0+∑n=1∞ancos(nπx/L) with term-by-term integration valid, then for every integer m≥0,
am=L2∫0Lf(x)cos(Lmπx)dx.
Proof
Multiply the sine series by sin(mπx/L) and integrate over [0,L], interchanging sum and integral by the stated hypothesis:
By Orthogonality of the Sine and Cosine Eigenfunctions (the theorem above), every term on the right with n=m vanishes, and the n=m term equals bm⋅L/2. Hence
The cosine case is identical: multiply by cos(mπx/L), integrate term by term, and use the cosine orthogonality relations. For m=0, note ∫0Lcos(0)cos(0)dx=L, and the constant term in the series is written as a0/2 precisely so that the same formula am=L2∫0Lfcos(mπx/L)dx holds uniformly for m=0 as well as m≥1; this is a bookkeeping convention, verified by direct substitution m=0 into the derivation above. ■
∎
Worked examples
Example 1 — Dirichlet rod with an asymmetric initial temperature. Solve
ut=4uxx,0<x<3,t>0,u(0,t)=u(3,t)=0,
u(x,0)=f(x)={x,23−x,0≤x≤1,1<x≤3.
Here α2=4, L=3. Note f is deliberately asymmetric (a triangular pulse skewed to one side, not centered at x=L/2), and its two pieces have different slopes (1 and −21), so no shortcut from symmetry is available. By separation of variables, the solution has the form
u(x,t)=n=1∑∞bnsin(3nπx)e−4(nπ/3)2t,
and matching t=0 requires f(x)=∑bnsin(nπx/3) on (0,3). By the Corollary,
As a sanity check, take n=3: sin(π)=0, so b3=0; take n=1: sin(π/3)=23, so b1=4π2153≈39.4825.98≈0.658, a sensible magnitude comparable to the peak value f(1)=1. The full solution is
Example 2 — Neumann (insulated) rod with an asymmetric initial temperature. Solve
ut=uxx,0<x<2,t>0,ux(0,t)=ux(2,t)=0,
u(x,0)=f(x)=x2,0≤x≤2.
Insulated ends (α2=1, L=2) force the spatial eigenfunctions to satisfy X′(0)=X′(2)=0, which selects cos(nπx/2), n=0,1,2,…, so the solution has the form
u(x,t)=2a0+n=1∑∞ancos(2nπx)e−(nπ/2)2t.
Matching t=0 requires f(x)=x2=2a0+∑n≥1ancos(nπx/2) on (0,2), an asymmetric (non-even-about-midpoint, genuinely quadratic) target function. Computing a0.
a0=22∫02x2dx=[3x3]02=38.
So the constant term is a0/2=4/3, the average value of x2 over [0,2] — a useful sanity check since 21∫02x2dx=21⋅38=34. Computing an for n≥1. With k=nπ/2,
an=∫02x2cos(kx)dx.
Integrate by parts twice. First, ∫x2cos(kx)dx=kx2sin(kx)+k22xcos(kx)−k32sin(kx) (differentiate to check: dxd of this expression is
As a check, n=1 gives a1=−16/π2≈−1.621, a plausible-sized correction to the mean value 4/3≈1.333; n=2 gives a2=16/(4π2)=4/π2≈0.405. The full solution is
u(x,t)=34+n=1∑∞n2π216(−1)ncos(2nπx)e−n2π2t/4.
Note that as t→∞, u(x,t)→4/3, the spatial average of the initial data — exactly as expected physically for an insulated rod with no heat loss, where total thermal energy is conserved and temperature equilibrates to the mean.
CounterexampleDropping orthogonality: mismatched boundary conditions break the coefficient formula
The coefficient formulas in the Corollary rely entirely on the orthogonality relations of the Theorem, which in turn depend on using eigenfunctions that actually satisfy the stated boundary conditions. Suppose one mistakenly tries to expand a function on [0,L] using the family ϕn(x)=sin(Lnπx+4π) — sines shifted by a fixed nonzero phase, which do not vanish at x=0 and hence are not eigenfunctions of the Dirichlet problem at all. These functions are not orthogonal on [0,L] in general. For instance, with L=π, direct computation using the product-to-sum identity gives
which, upon evaluating (using cos(A−B)−cos(A+B) with A=x+π/4,B=2x+π/4, so A−B=−x, A+B=3x+π/2), reduces to
21∫0πcos(−x)dx−21∫0πcos(3x+2π)dx=21[sinx]0π⋅(−1)sign from cos(−x)=cosx−21[3sin(3x+π/2)]0π.
Concretely: ∫0πcos(x)dx=[sinx]0π=0, but ∫0πcos(3x+π/2)dx=31[sin(3x+π/2)]0π=31(sin(3π+π/2)−sin(π/2))=31(−1−1)=−32. So the integral equals 21(0)−21(−32)=31=0. Since ϕ1 and ϕ2 are not orthogonal, attempting to write f=∑cnϕn and extract c1 via c1=π2∫0πfϕ1dx produces contamination from every other coefficient cn (n=1), because the cross terms ∫ϕnϕ1dx do not vanish. The resulting "coefficients" do not reproduce f when resummed, and worse, ϕn(0)=sin(π/4)=22=0, so these functions do not even satisfy the Dirichlet boundary condition the physical problem demands. This shows both why the eigenfunctions must be chosen to match the actual boundary conditions, and why orthogonality — not just "some infinite family of oscillating functions" — is the load-bearing hypothesis behind the coefficient formula.
Scope, edge cases & common traps
Situation
Correct choice
Common trap
u(0,t)=u(L,t)=0 (Dirichlet)
Fourier sine series, sin(nπx/L)
Using a cosine series, which cannot vanish at both ends unless f≡ const
ux(0,t)=ux(L,t)=0 (Neumann)
Fourier cosine series, including n=0 term
Forgetting the constant term a0/2, which encodes the average value
Mixed conditions (e.g. u(0,t)=0,ux(L,t)=0)
Neither pure sine nor pure cosine; eigenfunctions are sin((2n−1)πx/2L)
Applying the plain sine/cosine coefficient formulas verbatim
Assuming the series equals f exactly at every point
Term-by-term integration to derive coefficients
Valid once uniform convergence (or at least justified interchange) is established
Treating the derivation as fully rigorous without addressing convergence of the assumed expansion
The mathematician behind it
Origins · 1 minJean-Baptiste Joseph Fourier and how this was discovered
JJ
Jean-Baptiste Joseph Fourier
1768–1830 · Napoleonic-era France, École Polytechnique and the Prefecture of Isère
Fourier developed his trigonometric series while studying the analytic theory of heat conduction, presenting the core ideas to the Institut de France in 1807. His claim — that an arbitrary function could be represented as an infinite sum of sines and cosines — was met with skepticism by contemporaries including Lagrange and Laplace, since it seemed to contradict the intuition that a sum of smooth periodic functions should itself be smooth and periodic in a simple sense. Fourier's physical motivation was concrete: modeling how heat diffuses through a solid body given an arbitrary initial temperature distribution, exactly the boundary value problem this article treats.
History
- 1807: Fourier submits his memoir on heat propagation to the Institut de France, introducing trigonometric series expansions.
- 1822: Fourier publishes Théorie analytique de la chaleur, the definitive treatment of the heat equation and its series solutions.
- 1829: Dirichlet gives the first rigorous sufficient conditions for pointwise convergence of Fourier series.
- 1837: Sturm and Liouville generalize the orthogonality mechanism to a broad class of eigenvalue problems, the ancestor of general Eigenfunction Expansions.
- 1966: Carleson proves that Fourier series of square-integrable functions converge almost everywhere, closing a century-and-a-half-old convergence question.
Why do Dirichlet boundary conditions force a sine series rather than a cosine series?
The spatial eigenfunctions X(x) from separation of variables must satisfy the same homogeneous boundary conditions as u. For u(0,t)=u(L,t)=0, this forces X(0)=X(L)=0. Among the general solution X(x)=Acos(nπx/L)+Bsin(nπx/L) to the resulting ODE eigenvalue problem, requiring X(0)=0 forces A=0, leaving only sine terms, and requiring X(L)=0 then quantizes n to a positive integer. Cosines cannot satisfy X(0)=0 unless they vanish identically, so they are excluded entirely from a pure Dirichlet problem.
What if the initial data f is discontinuous — does the Fourier series still make sense?
The coefficient formulas bn=L2∫0Lfsin(nπx/L)dx only require f to be integrable (piecewise continuous suffices), so the coefficients are always well-defined regardless of continuity. What changes is the behavior of the resulting series: at a jump discontinuity, the series converges to the average of the left- and right-hand limits, not to f itself at that exact point. This subtlety, along with rates of convergence and the Gibbs phenomenon near jumps, is developed fully in Convergence of Fourier Series Solutions.
Can I use a cosine series even when the boundary conditions are Dirichlet, just as a different valid expansion?
No — a cosine series would not satisfy the boundary conditions of the PDE. If you set u(x,t)=∑ancos(nπx/L)e−λnt and try to impose u(0,t)=0, you get ∑ane−λnt=0 for all t, forcing every an=0 (except in trivial cases), collapsing the solution to zero. The eigenfunctions must be chosen to satisfy the actual homogeneous boundary conditions of the specific problem; sine and cosine series are not interchangeable tools but are tied to Dirichlet and Neumann conditions respectively.
Does this method work if the boundary conditions are inhomogeneous, like u(0,t)=T1=0?
Not directly — the superposition argument requires each term un to individually satisfy homogeneous boundary conditions so that linear combinations still do. For inhomogeneous boundary data, the standard technique is to first subtract off a steady-state (time-independent) solution v(x) solving the same boundary values, reducing the problem to one with homogeneous boundary conditions for w=u−v, which is then solved by the Fourier series method described here.
How is choosing Fourier coefficients here similar to finding components of a vector?
The analogy is exact under the right framework. Treat piecewise continuous functions on [0,L] as vectors in an inner product space with ⟨f,g⟩=∫0Lfgdx. The functions sin(nπx/L) play the role of an orthogonal basis, just like {e1,…,en} in Rn. Just as v=∑i⟨ei,ei⟩⟨v,ei⟩ei in finite dimensions, here f=∑n⟨sin(nπx/L),sin(nπx/L)⟩⟨f,sin(nπx/L)⟩sin(nπx/L), which is exactly the coefficient formula derived above, with ⟨sin(nπx/L),sin(nπx/L)⟩=L/2.
Why does the coefficient formula involve 2/L rather than 1/L?
This factor comes directly from the normalization constant ∫0Lsin2(nπx/L)dx=L/2 computed in the orthogonality theorem. Since bm=⟨f,sin(mπx/L)⟩/⟨sin(mπx/L),sin(mπx/L)⟩, and the denominator equals L/2, dividing by L/2 is the same as multiplying by 2/L. The factor of 2 is not arbitrary — it precisely compensates for the fact that sin(nπx/L) has "length-squared" L/2 rather than L over the interval.
What happens for boundary conditions that are neither pure Dirichlet nor pure Neumann, such as one fixed end and one insulated end?
The separation-of-variables eigenvalue problem changes, and the eigenfunctions are no longer plain sines or cosines of nπx/L. For X(0)=0 and X′(L)=0, solving the ODE and applying both conditions gives eigenfunctions sin((2n−1)πx/(2L)) for n=1,2,3,… — odd multiples of a quarter-period frequency. These still form an orthogonal family on [0,L] by an analogous product-to-sum argument, and the same projection technique applies, but with different eigenvalues and a different normalization constant in the coefficient formula.