Cubic splines and variational characterization
Build a natural cubic interpolant and prove why it minimizes squared curvature under fixed interpolation constraints.
On this page
The question for today
What you’ll understand
- State interpolation, continuity, and natural endpoint conditions.
- Derive the tridiagonal equations for nodal second derivatives.
- Prove the minimum-bending-energy property without confusing it with denoising.
A spline uses low-degree pieces rather than one global high-degree polynomial. Matching derivatives across knots prevents visible seams, while endpoint conditions complete the specification. Natural cubic splines have an additional meaning: among all sufficiently regular functions through the same data, they minimize an integrated measure of bending. The constraints must remain fixed when making that comparison; simply shrinking a curve does not prove the variational claim.
Low-degree pieces with global compatibility
Let be distinct knots with , and prescribe real values y at them. A cubic spline is polynomial of degree at most three on each interval and has two continuous derivatives across the interior knots. The natural interpolant also satisfies zero second derivative at both endpoints. These conditions determine a unique spline. Natural does not mean the endpoint slopes vanish, and it does not require the data themselves to arise from a function with zero endpoint curvature.
Denote the interval lengths by h and the nodal second derivatives by M. On an interval, the spline's second derivative is the line connecting the two endpoint second derivatives. Integrate twice and impose the two endpoint values to determine that cubic piece. Requiring neighboring first derivatives to agree then yields a tridiagonal linear system for the interior M values. Positive interval lengths make this natural system strictly diagonally dominant, so it is nonsingular; large variations in knot spacing still deserve numerical attention.
Why the natural spline bends least
Compare the natural spline s with any real function u in having the same nodal values. In one dimension these functions have representatives with continuous first derivatives, so nodal constraints and the following integration by parts are meaningful. Put v=u−s, which vanishes at every knot. On each interval, integrate the cross term involving s'' and v'' twice. The fourth derivative of each cubic piece vanishes, so only boundary terms remain.
Terms involving v vanish at knots because v is zero there. Interior terms involving v' cancel because s'' is continuous, and endpoint terms vanish by the natural zero-curvature conditions. Thus the cross term is zero, giving the energy identity below. Equality of energies forces v'' to vanish almost everywhere, so v is globally affine. Its values at the two distinct endpoints are zero, making it identically zero. The natural spline is therefore the unique minimizer, including the two-knot case.
Interpolation and smoothing solve different problems
The minimized quantity is an integrated squared second derivative, often called bending energy. It is a useful small-slope model of beam bending, not the exact geometric curvature energy of every parametric curve. The natural interpolant follows all data exactly, so a noisy measurement can still produce an undesirable feature. Minimal bending among exact interpolants does not imply that the original signal has been statistically recovered or that the spline preserves monotonicity and positivity.
A smoothing spline instead balances a data-misfit sum against a curvature penalty, with a chosen regularization parameter. That changes the optimization constraints and permits nonzero residuals at observations. Boundary conditions also matter: clamped splines prescribe endpoint slopes and minimize over the corresponding slope-constrained class, rather than the free-slope natural class. When choosing a method, identify whether the data are exact constraints or uncertain observations, and whether endpoint values, slopes, or periodicity carry actual modeling information.
Work it through
A symmetric three-knot arch
Find the natural cubic interpolant through . Determine its interior second derivative, give the left piece, and compute its bending energy.
Both interval lengths equal one and the endpoint second derivatives vanish. The sole tridiagonal equation is 4M₁=6[(0−1)−(1−0)]=−12, so M₁=−3.
On , the second derivative is . Integrating and imposing s(0)=0 and s(1)=1 gives . The right piece is its reflection s(2−x), giving slope zero and second derivative minus three at the middle knot.
The left bending energy is the integral of 9x² from zero to one, equal to three. Reflection gives another three on the right, so the total energy is six. The natural endpoint curvatures are zero, although the endpoint slopes are nonzero.
The interior second derivative is −3, the left piece is 1.5x−0.5x³, and the minimum bending energy is six.
The living notebook
Explore the model
Interactive lab · function
Why the interpolation constraints must stay fixed
Pause and Reset, then set a = 1 and x = 1. The curve ax² on [0,1] has constant second derivative 2a, so predict bending energy 4. Reset and set both a = 0.5 and x = 1; predict energy 1, but also notice the endpoint value changed from 1 to 0.5. Compare both predictions on paper with the displayed values. This quadratic instrument does not solve a spline problem; it exposes why lower energy with changed data is not a valid constrained comparison.
- y at chosen x
- 0.608
- Tangent slope · 2ax
- 1.35
- Signed area · ax³/3
- 0.182
This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forA variational minimum compares functions satisfying the same constraints; rescaling the data changes the admissible problem.
Pause & reason
Check your understanding
Your turn
Try it yourself
For only two data points (0,2) and (3,5), find the natural cubic interpolant and its bending energy. Use the variational identity to explain why no different admissible function can tie its energy.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
An affine function through the points has second derivative zero. Any zero-energy competitor must also have zero second derivative almost everywhere.
Compare with the solution
The line passes through both data and has zero second derivative everywhere, so it is the natural spline and its bending energy is zero. No energy can be negative. If an H² competitor ties zero, its second derivative vanishes almost everywhere, making it affine on the interval. Its two endpoint values uniquely determine the same line, so equality forces the competitor to equal s. The example also shows natural does not mean zero slope: this spline has slope one.
Keep the idea
Take it with you
- Natural cubic splines are C² piecewise cubics with zero endpoint second derivatives.
- The minimum-curvature identity compares H² functions with identical nodal values.
- Exact interpolation, smoothing, and slope-constrained splines solve different optimization problems.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.