A flexible interpolant with controlled joins
A polynomial through many data points must use one global set of coefficients: changing a single datum may change the curve everywhere, and high degree does not guarantee a good fit between nodes. A cubic spline takes a different route. It uses a cubic on each interval but requires the pieces, their slopes, and their second derivatives to agree at every interior knot. These conditions still leave two degrees of freedom; different endpoint conditions select different splines.
Let , where , and let be real numbers. Write and .
Definition 7.10.1
(Natural cubic spline)
A natural cubic spline is a function which is a polynomial of degree at most three on each , satisfies , and has .
We will find it by solving for the nodal second derivatives . On one interval must be the line joining to . Integrating twice, and choosing the two integration constants to match the endpoint values, gives
This formula automatically interpolates the two data values and makes linear with the prescribed endpoints. It does not yet guarantee that the derivatives match at a knot. Differentiation gives
Equating the right derivative of interval and the left derivative of interval yields the tridiagonal equations
with . When there are no interior equations: the spline is simply the line through the two points.
Theorem 7.10.2
(Existence and uniqueness of the natural spline)
For every and all data there is exactly one natural cubic spline. Its curvatures are the unique solution of the tridiagonal system above with .
Proof
(Strict diagonal dominance and the interval formula)
The case was settled above, so let . The interior coefficient matrix is symmetric. In each row its diagonal entry is strictly greater than the sum of the magnitudes of its interior off-diagonal entries. To see directly that its kernel is zero, choose a largest-magnitude component of a solution of the homogeneous system. If , the diagonal term has greater magnitude than the sum of all other terms in that row, a contradiction. The square system is therefore invertible. Its unique solution inserted into the interval formula gives a interpolant with natural endpoint conditions; conversely every natural spline gives that same system, so it is unique.
Proof X-ray
Why solve for curvature?
Prescribing nodal values of makes the second derivatives agree automatically, and endpoint interpolation fixes each cubic's remaining constants. Only matching remains. This turns a piecewise polynomial problem into a sparse linear system without losing any candidate spline.
The hypotheses enter at three separate points. The condition gives strict diagonal dominance, hence invertibility. The natural endpoint conditions supply the two values ; the system has equations for curvatures, which is the two-parameter freedom noted at the start, and any other endpoint condition would replace these two values. Finally, uniqueness comes from the converse direction: every natural spline must satisfy the same equations, so no second spline can exist.
Worked examples
Worked example 7.10.3
(Three equally spaced data points)
Take knots and data . Here , , and . The single interior equation is , so . On the first interval the formula reduces to
The reflected spline has the same data and natural conditions, so uniqueness gives for . Both pieces take the value at the middle knot, their derivatives there are , and their second derivatives there are . At the endpoints the second derivative is zero. Notice that the slopes at and are and : natural boundary conditions prescribe curvature, not slope.
Worked example 7.10.4
(Unequal spacing)
Take knots and data . Then , , , and . The interior equation is , so . The interval formula gives
Check at the knot : both pieces equal ; the slopes are and ; the second derivatives are and . At the second derivative of is , as required.
Worked example 7.10.5
(Two knots: no interior equation)
Take knots and data . Here , so there are no interior equations and . The interval formula reduces to
the straight line through the two points, with as the natural conditions demand.
Least bending among interpolants
There is a useful variational interpretation.
Theorem 7.10.6
(Minimum bending of the natural spline)
Let interpolate the same data as the natural spline . Then , with equality only for .
Proof
(Orthogonality of the spline curvature to the error)
Put , so . On each interval . Integrating by parts twice and summing over intervals gives
Indeed, the boundary terms are on each interval. The values of the piecewise constant at a knot are understood one-sided; terms involving vanish there; the interior terms involving cancel because both factors are continuous, and the endpoint terms vanish because . Consequently,
Equality forces the continuous function to vanish, so is affine. It vanishes at the two distinct endpoints, hence . Thus uniquely minimizes the squared-curvature integral in this class.
This criterion is a model of bending, not a promise that the spline is monotone or stays between the data values.
Counterexample mode
Natural cubic spline interpolation does not preserve monotonicity
For knots and data , we have and . On , , which is negative for . The data are nondecreasing, but the natural cubic spline dips below zero. Shape-preserving interpolation needs additional constraints or a different construction.
Common mistakes
Two slips occur repeatedly when the linear system is set up.
Common mistake
(Natural does not mean zero slope)
The natural conditions are . Conditions on and belong to a different endpoint choice. In the three-point example above the end slopes are .
Common mistake
(Dropping the spacing factors)
Only for uniform spacing does the system reduce to . For the unequally spaced example, the equation would give instead of the correct . Note also that the natural conditions fix , so only curvatures are unknown.
Practice and solutions
Quick check
(If all data lie on one affine function, identify the natural spline.)
Compare second derivatives.
Solution · Answer
The affine function interpolates the data and has zero second derivative everywhere; uniqueness identifies it as the spline.
Quick check
(For knots and data , compute the first interval polynomial.)
Solve the single interior equation for first.
Solution · Answer
The equation gives ; substituting yields .
Quick check
(Explain why a positive interval length matters in the linear system.)
Look at the diagonal and off-diagonal entries.
Solution · Answer
Each both makes the formulas meaningful and gives strict row diagonal dominance, which proves uniqueness.
Quick check
(Does natural boundary mean ?)
Recall the symmetric three-point example.
Solution · Answer
No: the symmetric three-point example has endpoint slopes and .