Search

Search papers and lessons

Boundary Condition

Level 3 · 11 min read

A boundary condition fixes what a solution must do at the edges of its region, such as the ends of a rod, so that a differential equation has one answer instead of a whole family.

On this page

  • Colour = topic mix
  • Calculus
  • Discrete math
  • Sign in to see your progress

TL;DR

A differential equation describes how a quantity changes from point to point, but on its own it has many solutions. A boundary condition fixes what the solution must do at the edges of its region, such as the two ends of a rod or the walls of a room. With the right number of conditions the problem usually has exactly one answer.

Where you'll see it: in the steady temperature along a heated rod, in the shape of a guitar string held fixed at both ends, and in every computer simulation of heat or fluid flow inside a box.

Intuition

A rule with a family of answers

Take a rod of length 1 and ask for its temperature profile u(x)u(x), where xx runs from 0 at one end to 1 at the other. Suppose the rule is that the profile has no bend anywhere, so its second derivative u′′(x)u''(x), the rate at which the slope itself changes, is zero. Which profiles obey that rule? Straight lines, u(x)=ax+bu(x) = ax + b. Every slope and every starting value gives a valid answer.

00.20.40.60.81−101234xu(x)
  • a = 2, b = 0
  • a = 2, b = 1
  • a = -1, b = 3
Each straight line has zero second derivative, so each satisfies the rule. The rule alone cannot choose among them.

The rule is not enough. We also need facts about the ends, such as "the left end is held at 20 degrees and the right end at 100 degrees." Those facts are boundary conditions. Pinning both ends selects exactly one line.

Why the edges decide

Heat moves through the rod from one place to the next. Its temperature in the middle depends on what is happening at the ends, because heat keeps flowing in from the outside there. The equation describes how neighbouring points influence each other, and the boundary says what the outside world is doing.

flowchart LR
  E[Differential equation: many solutions] --> C[Boundary conditions at the edges]
  C --> S[One solution]

Two kinds of edge information

There are two common ways to describe the edge. One fixes the value: the end is held at 20 degrees. The other fixes the slope, which for heat means how fast heat is leaving or entering: the end is insulated, so nothing flows through it. A third type, called Robin, mixes the two. The rest of this lesson uses these three types, named after the mathematicians who studied them.

The math

Let u(x)u(x) be defined on the interval 0≤x≤L0 \le x \le L. Three standard boundary conditions at an end point x=ax = a are:

Definition: Boundary condition

A boundary condition is a requirement that a solution must meet on the edge of its domain. The standard types are:

  • Dirichlet: the value is prescribed, u(a)=gu(a) = g.
  • Neumann: the outward rate of change is prescribed, u′(a)=hu'(a) = h with the sign set by the direction pointing out of the region. For an insulated end, h=0h = 0.
  • Robin: a mix, α u(a)+β u′(a)=r\alpha\,u(a) + \beta\,u'(a) = r.

Here u′(a)u'(a) is the first derivative, the slope of uu at the point aa. For a function of one variable, the Neumann condition is the slope; for a region in several dimensions it is the rate of change perpendicular to the wall.

Counting conditions

An ordinary differential equation of order nn has a general solution with nn free constants, and each boundary condition fixes one of them. The equation u′′(x)=0u''(x) = 0 is second order. Its general solution is u=ax+bu = ax + b, with two constants. Two conditions are needed. For example, u(0)=αu(0) = \alpha gives b=αb = \alpha, and u(L)=βu(L) = \beta gives aL+α=βaL + \alpha = \beta, so a=(β−α)/La = (\beta - \alpha)/L. The solution is unique whenever L≠0L \ne 0.

A source inside the rod

Suppose the rod generates heat uniformly, at rate qq per unit length, and both ends are held at zero. The steady temperature satisfies u′′(x)=−qu''(x) = -q. Integrating twice gives

u(x)=−q2x2+c1x+c0.u(x) = -\frac{q}{2}x^2 + c_1 x + c_0.

Check by differentiating: u′=−qx+c1u' = -qx + c_1 and u′′=−qu'' = -q. The condition u(0)=0u(0) = 0 gives c0=0c_0 = 0. The condition u(L)=0u(L) = 0 gives −q2L2+c1L=0-\frac{q}{2}L^2 + c_1 L = 0, so c1=qL2c_1 = \frac{qL}{2}. Therefore

u(x)=q2 x (L−x).u(x) = \frac{q}{2}\,x\,(L - x).

The two boundary conditions were needed to pick out c0c_0 and c1c_1. Without them the profile would be any member of the family.

Time-dependent problems

If uu also depends on time tt, the partial differential equation is written with partial derivatives. The heat equation in one dimension is

∂u∂t=∂2u∂x2,\frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x^2},

read as "the rate at which temperature changes over time equals its curvature in space". Such a problem needs boundary conditions at every time, plus an initial condition u(x,0)=f(x)u(x, 0) = f(x) that says where the temperature starts. The initial condition is a kind of condition too, but it refers to one instant rather than to an edge.

Worked examples

Example
A rod held at two temperatures

A rod of length 1 has its left end held at 20 degrees and its right end at 100 degrees. The steady profile satisfies u′′(x)=0u''(x) = 0, u(0)=20u(0) = 20 and u(1)=100u(1) = 100.

  1. The general solution of u′′=0u'' = 0 is u(x)=ax+bu(x) = ax + b.
  2. Apply the left condition: u(0)=b=20u(0) = b = 20.
  3. Apply the right condition: u(1)=a+b=100u(1) = a + b = 100, so a=80a = 80.
  4. The profile is u(x)=20+80xu(x) = 20 + 80x.
  5. At the midpoint, u(0.5)=20+40=60u(0.5) = 20 + 40 = 60 degrees.

Interpretation: the temperature rises evenly from 20 to 100 degrees, and the midpoint sits halfway between the two fixed values. Changing either end changes the whole line, because the two ends are the only information the problem contains.

Example
Fixed value at one end, insulated at the other

Now the left end is held at 20 degrees, but the right end is insulated, so its slope is zero. Consider the interval 0≤x≤20 \le x \le 2 with u′′(x)=0u''(x) = 0, u(0)=20u(0) = 20 and u′(2)=0u'(2) = 0.

  1. The general solution is u(x)=ax+bu(x) = ax + b, so u′(x)=au'(x) = a everywhere.
  2. The Neumann condition gives u′(2)=a=0u'(2) = a = 0.
  3. The Dirichlet condition gives u(0)=b=20u(0) = b = 20.
  4. The profile is the constant u(x)=20u(x) = 20.

Interpretation: with no heat leaving the right end, nothing drives the temperature up or down, so the rod settles to the value at its fixed end. If the right end were instead held at 30 degrees, the answer would be the line from 20 to 30 over the interval, with slope 10/2=510/2 = 5.

Example
A heated rod with both ends at zero

A metal rod of length 1 metre generates heat evenly, with q=8q = 8 units per metre. Both ends are held at zero degrees. The steady profile satisfies u′′(x)=−8u''(x) = -8, u(0)=0u(0) = 0 and u(1)=0u(1) = 0.

  1. Use the formula from the math section with L=1L = 1 and q=8q = 8: u(x)=4 x (1−x)u(x) = 4\,x\,(1 - x).
  2. Check the ends: u(0)=0u(0) = 0 and u(1)=0u(1) = 0.
  3. Check the equation: u(x)=4x−4x2u(x) = 4x - 4x^2, so u′(x)=4−8xu'(x) = 4 - 8x and u′′(x)=−8u''(x) = -8.
  4. The maximum is at the midpoint: u(0.5)=4×0.5×0.5=1u(0.5) = 4 \times 0.5 \times 0.5 = 1.

Interpretation: the rod is warmest in the middle, one degree above the ends, because heat is produced everywhere but can only leave through the fixed ends. The plot shows the arch.

00.20.40.60.8100.20.40.60.811.2xu(x)
  • u(x) = 4x(1 - x)
Steady temperature of a uniformly heated rod with both ends at zero. The marked point is the peak at the midpoint.
Example
Heat in a rod, checked by substitution

Let u(x,t)u(x, t) satisfy the heat equation on 0≤x≤10 \le x \le 1, with u(0,t)=0u(0, t) = 0 and u(1,t)=0u(1, t) = 0 for all times, and initial condition u(x,0)=sin⁡(πx)u(x, 0) = \sin(\pi x). Claim: u(x,t)=sin⁡(πx) e−π2tu(x, t) = \sin(\pi x)\, e^{-\pi^2 t}.

  1. Check the initial condition: at t=0t = 0, e0=1e^0 = 1, so u(x,0)=sin⁡(πx)u(x, 0) = \sin(\pi x). This matches.
  2. Check the boundary conditions: sin⁡(0)=0\sin(0) = 0 and sin⁡(π)=0\sin(\pi) = 0, so uu is zero at both ends for every tt.
  3. Compute the time derivative: ∂u/∂t=−π2sin⁡(πx) e−π2t\partial u/\partial t = -\pi^2 \sin(\pi x)\, e^{-\pi^2 t}.
  4. Compute the second space derivative: ∂2u/∂x2=−π2sin⁡(πx) e−π2t\partial^2 u/\partial x^2 = -\pi^2 \sin(\pi x)\, e^{-\pi^2 t}.
  5. The two agree, so the heat equation holds.
  6. Evaluate at x=0.5x = 0.5 and t=0.1t = 0.1: u=sin⁡(π/2) e−0.987≈0.373u = \sin(\pi/2)\, e^{-0.987} \approx 0.373.

Interpretation: the initial hump decays smoothly, and the boundary conditions keep the ends at zero throughout. Without the boundary conditions, the same formula would not be the only answer.

Tradeoffs and failure modes

A problem is well-posed, in the sense of Hadamard, when a solution exists, is unique, and changes only slightly when the data change slightly. Boundary conditions decide most of this.

SituationWhat goes wrongBetter choice
Too few conditionsMany solutions; the answer is not determinedAdd the missing information at the edge
Too many conditionsGenerally no solution existsDrop one condition, or use a weaker form
Condition does not match the physics, such as fixing a temperature where heat is actually leavingThe solution is unphysical or fails to match measurementsChoose the type the physical setup supplies
Boundary data are noisySmall changes in data can cause large changes in the solutionRegularize the problem or restate it
Irregular geometryNo closed-form solutionUse a numerical method such as Finite Difference Method, which imposes the same conditions on a grid

A practical point: in simulations, the choice of boundary condition often matters more than the choice of numerical scheme. A poor boundary can make a correct solver produce a wrong answer.

History

Joseph Fourier's Théorie analytique de la chaleur (1822) solved heat conduction in a bar whose ends were held at fixed temperatures, and his series solutions made boundary conditions central to the subject. In the nineteenth century the two standard types were named after Peter Gustav Lejeune Dirichlet and Carl Neumann, who studied them in potential theory. In the early twentieth century Jacques Hadamard formulated the idea of a well-posed problem, which explains why only some combinations of equation and condition are worth solving.

Recap

A differential equation alone describes a family of solutions. Boundary conditions choose among them: fixed values (Dirichlet), fixed slopes (Neumann) or a mix (Robin). For time-dependent problems, an initial condition also pins the starting state. The number of conditions should match the order of the equation. Numerical solvers, such as Finite Difference Method, apply the same conditions on a grid.

Check yourself

QuestionRecall: what does a Dirichlet condition specify, and how does it differ from a Neumann condition?Show answer

A Dirichlet condition fixes the value of the solution at the boundary, for example u(0)=20u(0) = 20. A Neumann condition fixes the rate of change at the boundary, the slope in one dimension or the outward flow through a wall in several. An insulated end is a Neumann condition with zero rate of change.

QuestionComputation: solve u′′(x)=0u''(x) = 0 on 0≤x≤40 \le x \le 4 with u(0)=3u(0) = 3 and u(4)=11u(4) = 11. What is u(2)u(2)?Show answer

The general solution is u=ax+bu = ax + b. The condition u(0)=3u(0) = 3 gives b=3b = 3. The condition u(4)=11u(4) = 11 gives 4a+3=114a + 3 = 11, so a=2a = 2. The solution is u(x)=3+2xu(x) = 3 + 2x, and u(2)=7u(2) = 7. The check u(4)=3+8=11u(4) = 3 + 8 = 11 confirms it.

QuestionWhy: why does a second-order ordinary differential equation need two boundary conditions, and not one or three?Show answer

A second-order equation has a general solution with two free constants, because integrating twice introduces two. Each boundary condition fixes one constant. One condition leaves a one-parameter family of answers. Three conditions usually have no common solution, since the two constants can satisfy only two of them in general.

QuestionApplied: a model of a room has its walls held at a fixed temperature in one simulation and as perfect insulators in another. Which boundary condition types apply, and why do the results differ?Show answer

The fixed-temperature walls are a Dirichlet condition, since the value is prescribed. The insulated walls are a Neumann condition with zero outward rate of change, since no heat crosses them. The two set-ups impose different information at the walls, so the interior temperatures differ: a fixed wall drains or supplies heat, while an insulated wall keeps it inside the room.

Sources