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 , where 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 , the rate at which the slope itself changes, is zero. Which profiles obey that rule? Straight lines, . Every slope and every starting value gives a valid answer.
- a = 2, b = 0
- a = 2, b = 1
- a = -1, b = 3
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 be defined on the interval . Three standard boundary conditions at an end point are:
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, .
- Neumann: the outward rate of change is prescribed, with the sign set by the direction pointing out of the region. For an insulated end, .
- Robin: a mix, .
Here is the first derivative, the slope of at the point . 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 has a general solution with free constants, and each boundary condition fixes one of them. The equation is second order. Its general solution is , with two constants. Two conditions are needed. For example, gives , and gives , so . The solution is unique whenever .
A source inside the rod
Suppose the rod generates heat uniformly, at rate per unit length, and both ends are held at zero. The steady temperature satisfies . Integrating twice gives
Check by differentiating: and . The condition gives . The condition gives , so . Therefore
The two boundary conditions were needed to pick out and . Without them the profile would be any member of the family.
Time-dependent problems
If also depends on time , the partial differential equation is written with partial derivatives. The heat equation in one dimension is
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 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
A rod of length 1 has its left end held at 20 degrees and its right end at 100 degrees. The steady profile satisfies , and .
- The general solution of is .
- Apply the left condition: .
- Apply the right condition: , so .
- The profile is .
- At the midpoint, 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.
Now the left end is held at 20 degrees, but the right end is insulated, so its slope is zero. Consider the interval with , and .
- The general solution is , so everywhere.
- The Neumann condition gives .
- The Dirichlet condition gives .
- The profile is the constant .
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 .
A metal rod of length 1 metre generates heat evenly, with units per metre. Both ends are held at zero degrees. The steady profile satisfies , and .
- Use the formula from the math section with and : .
- Check the ends: and .
- Check the equation: , so and .
- The maximum is at the midpoint: .
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.
- u(x) = 4x(1 - x)
Let satisfy the heat equation on , with and for all times, and initial condition . Claim: .
- Check the initial condition: at , , so . This matches.
- Check the boundary conditions: and , so is zero at both ends for every .
- Compute the time derivative: .
- Compute the second space derivative: .
- The two agree, so the heat equation holds.
- Evaluate at and : .
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.
| Situation | What goes wrong | Better choice |
|---|---|---|
| Too few conditions | Many solutions; the answer is not determined | Add the missing information at the edge |
| Too many conditions | Generally no solution exists | Drop one condition, or use a weaker form |
| Condition does not match the physics, such as fixing a temperature where heat is actually leaving | The solution is unphysical or fails to match measurements | Choose the type the physical setup supplies |
| Boundary data are noisy | Small changes in data can cause large changes in the solution | Regularize the problem or restate it |
| Irregular geometry | No closed-form solution | Use 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 . 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 on with and . What is ?Show answer
The general solution is . The condition gives . The condition gives , so . The solution is , and . The check 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.