advanced29 min studyLesson 315 in Mathematics

Cubic splines and variational characterization

Build a natural cubic interpolant and prove why it minimizes squared curvature under fixed interpolation constraints.

On this page

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 a=x0<⋯<xm=ba=x_0<\cdots<x_m=b be distinct knots with m≥1m\ge1, 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.

hi−1Mi−1+2(hi−1+hi)Mi+hiMi+1=6 ⁣(yi+1−yihi−yi−yi−1hi−1),M0=Mm=0h_{i-1}M_{i-1}+2(h_{i-1}+h_i)M_i+h_iM_{i+1}=6\!\left(\frac{y_{i+1}-y_i}{h_i}-\frac{y_i-y_{i-1}}{h_{i-1}}\right),\quad M_0=M_m=0
Here hᵢ=xᵢ₊₁−xᵢ>0 and 1≤i≤m−1. The equations enforce first-derivative continuity between cubic pieces.↔ Scroll wide equations horizontally.

Why the natural spline bends least

Compare the natural spline s with any real function u in H2([a,b])H^2([a,b]) 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.

∫ab∣u′′∣2=∫ab∣s′′∣2+∫ab∣(u−s)′′∣2≥∫ab∣s′′∣2\int_a^b|u''|^2=\int_a^b|s''|^2+\int_a^b|(u-s)''|^2\ge\int_a^b|s''|^2
The identity holds for H² competitors with the same nodal values and the natural cubic interpolant; the vanishing cross term proves the minimum.↔ Scroll wide equations horizontally.

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.

A symmetric three-knot arch

Find the natural cubic interpolant through (0,0),(1,1),(2,0)(0,0),(1,1),(2,0). Determine its interior second derivative, give the left piece, and compute its bending energy.

  1. 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.

  2. On [0,1][0,1], the second derivative is −3x-3x. Integrating and imposing s(0)=0 and s(1)=1 gives s(x)=3x/2−x3/2s(x)=3x/2-x^3/2. The right piece is its reflection s(2−x), giving slope zero and second derivative minus three at the middle knot.

  3. 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 result

The interior second derivative is −3, the left piece is 1.5x−0.5x³, and the minimum bending energy is six.

Explore the model

Interactive lab

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.

Why the interpolation constraints must stay fixedThis 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. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

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.

Check your understanding

Which endpoint conditions define the natural cubic interpolant on an interval?

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 s(x)=x+2s(x)=x+2 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.

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.