The heat equation
The question
You set the temperatures along an 8 cm rod. Which point will cool fastest when heat starts to move?
Draw the starting profile, then make a choice before the rates appear.
- 1 SeeDraw a profile; choose a cooling point.
- 2 TryChange the clock and reach a target.
- 3 ProveCheck an exact solution, line by line.
- 4 ApplyProblems to check yourself.
Before you start · 3 quick checks on partial derivatives, second derivatives and rates
Two ideas before you start
2 ideasA profile is a snapshot along the rod
A temperature curve over position. Change the height with the buttons.
Position runs across the picture; temperature runs up it. This is the shape of a temperature profile, not the physical shape of the rod.
Exact definition
Write \(u(x,t)\) for temperature at position \(x\) and time \(t\). Holding \(t\) fixed gives a spatial profile. Holding \(x\) fixed gives one thermometer's record over time. The partial derivative \(u_t\) measures the rate at that thermometer; \(u_x\) measures the spatial slope at one instant. The second spatial derivative is \(u_{xx}\).
These are the two kinds of slice in partial derivatives, now with position and time as the independent variables. A graph rising to the right need not mean that its temperature is rising over time.
The ends are part of the problem
Two possible initial profiles with the same endpoint temperatures.
End temperatures alone do not specify the starting interior. Choose the initial profile as well.
Exact definition
An initial condition gives \(u(x,0)=f(x)\) along the whole rod. A fixed-temperature boundary condition gives \(u(0,t)=B\) and \(u(L,t)=B\) at all times, where \(L\) is the rod's length and \(B\) the maintained end temperature. Our initial profiles agree with these conditions at the ends.
We model a thin, homogeneous rod with constant positive thermal diffusivity \(\kappa\), uniform temperature across each cross section, insulated sides, and no internal heat sources. External reservoirs maintain the end temperatures. Position is measured in cm, time in seconds, temperature in °C, and \(\kappa\) in cm²/s.
From a time equation to a space-and-time equation
In slope fields, an ordinary differential equation prescribes the slope of one unknown function of time. Here the unknown is a whole profile at each time. Neighboring positions interact, so a single starting temperature is insufficient. The data must include a starting profile and a rule for both ends.
Draw, choose, then test
- Drag the interior handles vertically, or focus one and use the arrow keys. The endpoints stay fixed.
- Choose a position below the graph as your guess for fastest initial cooling. Any tied position counts.
- Press Check my point to reveal the initial rates, then move time forward. Edit profile clears the result.
Each cell shows a position and the sign of its initial grid rate. Cooling uses the negative sign; warming uses the positive sign. The table gives the rates.
| x (cm) | u (°C) | Rate (°C/s) |
|---|
Under the rod assumptions above, the rate of temperature change at a point is \(\kappa\) times the second spatial derivative there. Where \(u_{xx}\lt0\) (the profile is concave down at that point), the temperature is falling at that instant; where \(u_{xx}\gt0\), it is rising; where \(u_{xx}=0\), it is momentarily unchanged. A flat tangent only says \(u_x=0\), so it cannot decide the rate. A high temperature alone cannot decide it either.
The second derivative compares a point with its neighbors. If \(u\) has a continuous second derivative in \(x\), Taylor's theorem gives, for small \(h\gt0\),
\[\begin{aligned}&\frac{u(x-h,t)+u(x+h,t)}{2}-u(x,t)\\&\quad=\tfrac{h^2}{2}u_{xx}(x,t)+o(h^2),\end{aligned}\]where \(o(h^2)/h^2\to0\) as \(h\to0\). So if \(u_{xx}(x,t)\lt0\), then for every small enough \(h\) the point is hotter than the average of its two neighbors at distance \(h\), and it is cooling. If \(u_{xx}(x,t)\gt0\), it is colder than that average and warming.
Our grid uses this comparison at the sample spacing \(h\). With \(U_i\) the sample at position \(ih\), its initial rate is
\[\begin{aligned}R_i&=\kappa\frac{U_{i-1}-2U_i+U_{i+1}}{h^2}\\&=\frac{2\kappa}{h^2}\Big(\frac{U_{i-1}+U_{i+1}}{2}-U_i\Big).\end{aligned}\]This is exact for the chosen system of grid equations. It approximates the continuous equation when samples resolve a smooth profile. The smallest negative rate identifies fastest initial cooling among the interior samples, not necessarily between them or at later times.
What the numerical evolution computes
Why the second derivative enters: a heat-flow refresher
Let \(J(x,t)\) be the heat flow per unit time through a unit of cross-sectional area, positive to the right, and let \(K\gt0\) be the thermal conductivity. Fourier's law is \(J=-K u_x\): heat flows toward lower temperature, at a rate proportional to the temperature slope. This is a physical assumption about the material. (Some texts measure heat in units that absorb the heat capacity and write the flow as \(-\kappa u_x\); the resulting equation is the same.)
Assume a one-dimensional rod: constant cross-section, insulated sides so no heat leaves through them, no internal heat sources, and a constant heat capacity per unit volume \(c_v\gt0\). Take a short piece from \(x\) to \(x+\Delta x\). Conservation of energy says the heat stored in the piece changes at the rate of flow in at the left end minus flow out at the right end:
\[\begin{aligned}&\frac{d}{dt}\int_x^{x+\Delta x}c_v\,u(s,t)\,ds\\&\quad=J(x,t)-J(x+\Delta x,t).\end{aligned}\]For a smooth \(u\), divide by \(\Delta x\) and let \(\Delta x\to0\): \(c_v u_t=-J_x\). With constant \(K\), \(J_x=-K u_{xx}\), so \(c_v u_t=K u_{xx}\). This is the heat equation with \(\kappa=K/c_v\gt0\). If the conductivity varied with position, \((K u_x)_x=K u_{xx}+K'u_x\) would add a term, and the constant-coefficient equation here would no longer apply.
A linear temperature profile has equal flow through neighboring cross sections. It can conduct heat without changing temperature locally: inflow and outflow balance. In our equal-end-temperature setup, the only linear profile meeting both ends is the constant one.
Change the clock
Use the local rule you found above. Keep the rod, the boundary values and the initial profile the same while changing the material's diffusivity.
Reach a target temperature
Only the excess above the boundary temperature shrinks by an exponential factor. The absolute temperature includes a constant baseline. Confusing these two quantities would give the wrong waiting time for a thermometer reading.
On an infinite line with no ends, the same equation with the same \(\kappa\) spreads a single point pulse into a normal-shaped profile with variance \(2\kappa t\). The heat kernel lesson follows that case.
Connect the grid to Taylor expansion
Fix a time and assume the spatial profile has four continuous derivatives near \(x\). The Taylor expansion at the neighboring points is
\[\begin{aligned}u(x\pm h,t)&\\&=u(x,t)\pm h u_x(x,t)\\&\quad+\tfrac{h^2}{2}u_{xx}(x,t)\\&\quad\pm\tfrac{h^3}{6}u_{xxx}(x,t)+O(h^4).\end{aligned}\]The notation \(O(h^4)\) means a remainder bounded in magnitude by a constant times \(h^4\) for sufficiently small positive \(h\). Adding the expansions cancels the odd powers. Subtracting twice the center value and dividing by \(h^2\) leaves \(u_{xx}(x,t)+O(h^2)\). This explains both the neighbor formula and its spatial error for smooth profiles. At the corners of a drawn broken line, a classical second derivative is not defined; the grid still has a well-defined rate.
Check an exact solution
Let \(L,\kappa,A\gt0\), \(B\) be real, \(q=\pi/L\), and \(\lambda=\kappa q^2\). For \(t\ge0\), define
\[\begin{aligned}a(t)&=Ae^{-\lambda t},\\u(x,t)&=B+a(t)\sin(qx).\end{aligned}\]Then \(u\) solves \(u_t=\kappa u_{xx}\) for \(0\lt x\lt L\), has the fixed boundary temperatures \(B\), and starts at \(B+A\sin(qx)\). At every interior point it decreases strictly toward \(B\) as time increases.
We verify a candidate solution by differentiation. This proof does not establish existence for every initial profile or prove uniqueness of a general boundary value problem. The positive amplitude and the open spatial interval matter for the strict signs in the choices.
Use the local rule and the exact solution
Each problem has hints and a worked solution. Enter a decimal without units. The accepted error is an absolute tolerance in the stated unit.
Further reading
- Walter A. Strauss, Partial Differential Equations: An Introduction, chapter 2, “Waves and Diffusions.”
- Richard Haberman, Applied Partial Differential Equations, chapter 1, “Heat Equation.”