In both Polynomial Interpolation and Hermite Interpolation, we constructed a single, global polynomial covering the entire domain [a,b][a, b].

Global polynomials suffer from a fundamental architectural flaw: global stiffness. Because a polynomial of degree nn is defined by a single formula, perturbing a single data point sends ripples across the entire interval. Furthermore, as the number of data points grows into hundreds or thousands, global polynomials become computationally ill-conditioned.

The modern resolution is piecewise approximation: partition the domain [a,b][a, b] into smaller subintervals, fit a low-degree polynomial on each piece, and glue them together smoothly at the knots.

This note develops the theory of piecewise interpolation and cubic splines [1][1] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011., [2][2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026.:

  1. Piecewise Linear Interpolation: Proving the sharp h28max⁡∣f′′∣\frac{h^2}{8} \max |f''| error bound;
  2. Piecewise Quadratic Interpolation: Matching midpoints for O(h3)\mathcal{O}(h^3) local accuracy;
  3. Cubic Splines: Balancing C2C^2 smoothness against degrees of freedom;
  4. Boundary Conditions: Contrasting Natural, Clamped, and Not-a-knot conditions, and the second-order boundary error qualification;
  5. The Tridiagonal System: Deriving the three-moment equation and solving it in O(n)\mathcal{O}(n) time;
  6. Method Comparison: A comprehensive decision map for interpolation techniques.

Piecewise linear interpolation

The simplest piecewise method connects adjacent data points with straight line segments.

DefinitionPiecewise linear interpolant

Let a=x0<x1<⋯<xn=ba = x_0 < x_1 < \dots < x_n = b partition [a,b][a, b] into nn subintervals. On each subinterval [xi,xi+1][x_i, x_{i+1}], the linear interpolant is

Li(x)=f(xi)xi+1−xxi+1−xi+f(xi+1)x−xixi+1−xi.L_i(x) = f(x_i) \frac{x_{i+1} - x}{x_{i+1} - x_i} + f(x_{i+1}) \frac{x - x_i}{x_{i+1} - x_i}.

The global piecewise linear interpolant L(x)L(x) is defined by L(x)=Li(x)L(x) = L_i(x) for x∈[xi,xi+1]x \in [x_i, x_{i+1}].

At each shared knot xix_i, the adjacent pieces agree in value: Li−1(xi)=f(xi)=Li(xi)L_{i-1}(x_i) = f(x_i) = L_i(x_i). Therefore L∈C0([a,b])L \in C^0([a, b]). However, the slopes Li−1′L'_{i-1} and Li′L'_i generally differ, so LL has sharp corners and does not belong to C1([a,b])C^1([a, b]).

The sharp uniform error bound

LemmaMaximum of the nodal quadratic factor

Let [xi,xi+1][x_i, x_{i+1}] have length hi=xi+1−xih_i = x_{i+1} - x_i. The quadratic function q(x)=(x−xi)(xi+1−x)q(x) = (x - x_i)(x_{i+1} - x) satisfies

max⁡x∈[xi,xi+1]∣(x−xi)(xi+1−x)∣=hi24,\max_{x \in [x_i, x_{i+1}]} |(x - x_i)(x_{i+1} - x)| = \frac{h_i^2}{4},

attained uniquely at the midpoint xm=xi+xi+12x_m = \frac{x_i + x_{i+1}}{2}.

Proof

Expanding q(x)=−x2+(xi+xi+1)x−xixi+1q(x) = -x^2 + (x_i + x_{i+1})x - x_i x_{i+1}, its derivative is q′(x)=−2x+(xi+xi+1)q'(x) = -2x + (x_i + x_{i+1}). Setting q′(x)=0q'(x) = 0 locates the unique critical point at xm=(xi+xi+1)/2x_m = (x_i + x_{i+1})/2.

Since q′′(x)=−2<0q''(x) = -2 < 0, qq is concave down, and its maximum value is:

q(xm)=(xm−xi)(xi+1−xm)=(hi2)(hi2)=hi24.q(x_m) = (x_m - x_i)(x_{i+1} - x_m) = \left( \frac{h_i}{2} \right) \left( \frac{h_i}{2} \right) = \frac{h_i^2}{4}.

Because q(xi)=q(xi+1)=0q(x_i) = q(x_{i+1}) = 0 at the endpoints, the maximum on [xi,xi+1][x_i, x_{i+1}] is exactly hi2/4h_i^2 / 4.

TheoremPiecewise linear error bound

Let f∈C2([a,b])f \in C^2([a, b]) and let h=max⁡i(xi+1−xi)h = \max_i (x_{i+1} - x_i) be the maximum step size. Then

max⁡x∈[a,b]∣f(x)−L(x)∣≤h28max⁡t∈[a,b]∣f′′(t)∣.\max_{x \in [a, b]} |f(x) - L(x)| \le \frac{h^2}{8} \max_{t \in [a, b]} |f''(t)|.
Proof

On each subinterval [xi,xi+1][x_i, x_{i+1}], the Cauchy interpolation error formula for n=1n = 1 states that for each x∈[xi,xi+1]x \in [x_i, x_{i+1}], there exists ξx∈(xi,xi+1)\xi_x \in (x_i, x_{i+1}) such that

f(x)−Li(x)=f′′(ξx)2(x−xi)(x−xi+1).f(x) - L_i(x) = \frac{f''(\xi_x)}{2} (x - x_i)(x - x_{i+1}).

Taking absolute values and applying Lemma 1:

∣f(x)−Li(x)∣≤12(max⁡t∈[xi,xi+1]∣f′′(t)∣)(hi24)=hi28max⁡t∈[xi,xi+1]∣f′′(t)∣.|f(x) - L_i(x)| \le \frac{1}{2} \left( \max_{t \in [x_i, x_{i+1}]} |f''(t)| \right) \left( \frac{h_i^2}{4} \right) = \frac{h_i^2}{8} \max_{t \in [x_i, x_{i+1}]} |f''(t)|.

Taking the maximum over all subintervals i=0,…,n−1i = 0, \dots, n-1 yields the global bound.

A crude bound that bounds ∣x−xi∣≤hi|x - x_i| \le h_i and ∣x−xi+1∣≤hi|x - x_{i+1}| \le h_i independently would yield h2/2h^2 / 2. Utilizing the parabola vertex sharpens the leading constant from 1/21/2 to 1/81/8, making the bound four times tighter. The convergence rate is second-order: halving the mesh size reduces the error by a factor of four.

Piecewise quadratic interpolation

To achieve higher accuracy, we can construct a quadratic polynomial on each subinterval [xi,xi+1][x_i, x_{i+1}] by evaluating ff at the midpoint mi=(xi+xi+1)/2m_i = (x_i + x_{i+1})/2 in addition to the endpoints:

(xi,f(xi)),(mi,f(mi)),(xi+1,f(xi+1)).(x_i, f(x_i)), \quad (m_i, f(m_i)), \quad (x_{i+1}, f(x_{i+1})).

On each subinterval, this is a 3-node Lagrange interpolation problem. If f∈C3f \in C^3, the local error has the form

f(x)−Qi(x)=f(3)(ξ)3!(x−xi)(x−mi)(x−xi+1),f(x) - Q_i(x) = \frac{f^{(3)}(\xi)}{3!} (x - x_i)(x - m_i)(x - x_{i+1}),

yielding third-order convergence O(hi3)\mathcal{O}(h_i^3).

However, adjacent quadratic pieces still fail to match in slope at the knots xix_i: Qi−1′(xi)≠Qi′(xi)Q'_{i-1}(x_i) \neq Q'_i(x_i). The curve remains non-differentiable at the knots.

Cubic splines

To eliminate slope and curvature discontinuities without increasing the polynomial degree to global heights, we turn to cubic splines.

The term spline originally referred to a flexible wooden strip used by shipbuilders and draftsmen, pinned down at discrete points with lead weights (called ducks) to trace fair, naturally smooth curves. Mechanically, the strip bends to minimize strain energy, producing a continuous second derivative across all joints.

DefinitionCubic spline interpolant

Let a=x0<x1<⋯<xn=ba = x_0 < x_1 < \dots < x_n = b. A function S(x)S(x) is a cubic spline interpolant for ff through the data (xi,f(xi))(x_i, f(x_i)) if:

  1. Piecewise Cubic: On each subinterval [xi,xi+1][x_i, x_{i+1}], S(x)=Si(x)S(x) = S_i(x) is a polynomial of degree at most 33;
  2. Interpolation: S(xi)=f(xi)S(x_i) = f(x_i) for all i=0,1,…,ni = 0, 1, \dots, n;
  3. C2C^2 Smoothness: S(x)S(x), S′(x)S'(x), and S′′(x)S''(x) are continuous across the entire interval [a,b][a, b].

Counting constraints and degrees of freedom

Let us determine whether a cubic spline is uniquely determined:

  • There are nn subintervals, each carrying a cubic polynomial Si(x)=ai+bix+cix2+dix3S_i(x) = a_i + b_i x + c_i x^2 + d_i x^3;
  • Each cubic polynomial has 44 coefficients, giving 4n4n total unknowns;
  • Endpoint values on each piece: Matching the given data at both ends of each subinterval requires Si(xi)=yiS_i(x_i) = y_i and Si(xi+1)=yi+1S_i(x_{i+1}) = y_{i+1} for each i=0,…,n−1i = 0, \dots, n-1, contributing 2n2n equations;
  • First derivative continuity: Matching Si−1′(xi)=Si′(xi)S'_{i-1}(x_i) = S'_i(x_i) at the n−1n-1 interior knots contributes n−1n-1 equations;
  • Second derivative continuity: Matching Si−1′′(xi)=Si′′(xi)S''_{i-1}(x_i) = S''_i(x_i) at the n−1n-1 interior knots contributes n−1n-1 equations.

Summing all continuity and interpolation conditions:

2n+(n−1)+(n−1)=4n−2.2n + (n - 1) + (n - 1) = 4n - 2.

Subtracting from the 4n4n degrees of freedom leaves:

4n−(4n−2)=2 degrees of freedom remaining.4n - (4n - 2) = 2 \text{ degrees of freedom remaining}.

To specify the spline uniquely, we must supply exactly two additional boundary conditions.

Spline boundary conditions

Three standard boundary specifications are used in numerical practice:

DefinitionSpline boundary conditions
  1. Natural (Free) Boundary Conditions:
S′′(x0)=0andS′′(xn)=0.S''(x_0) = 0 \quad \text{and} \quad S''(x_n) = 0.

The curvature is forced to zero at the boundary endpoints, mimicking a physical beam with free ends. 2. Clamped (Complete) Boundary Conditions:

S′(x0)=f′(x0)andS′(xn)=f′(xn).S'(x_0) = f'(x_0) \quad \text{and} \quad S'(x_n) = f'(x_n).

The boundary slopes are clamped to match the true derivative of ff. 3. Not-a-Knot Boundary Conditions:

S′′′(x) is continuous across x1 and xn−1.S'''(x) \text{ is continuous across } x_1 \text{ and } x_{n-1}.

This forces S0(x)≡S1(x)S_0(x) \equiv S_1(x) and Sn−2(x)≡Sn−1(x)S_{n-2}(x) \equiv S_{n-1}(x), so x1x_1 and xn−1x_{n-1} cease to be active knots (requiring n≥3n \ge 3).

Natural cubic spline through three points demonstrating C2 continuity at the interior knot and zero second derivatives at boundaries.

Natural cubic spline through three points demonstrating C2 continuity at the interior knot and zero second derivatives at boundaries.

Accuracy qualification: the boundary curvature trap

Textbooks frequently state that cubic splines converge at fourth order: O(h4)\mathcal{O}(h^4). While true for clamped splines and not-a-knot splines on refining uniform meshes, this does not hold universally for natural splines.

If f∈C4([a,b])f \in C^4([a, b]), clamped boundary conditions guarantee

max⁡x∈[a,b]∣f(x)−S(x)∣≤Ch4max⁡t∈[a,b]∣f(4)(t)∣.\max_{x \in [a, b]} |f(x) - S(x)| \le C h^4 \max_{t \in [a, b]} |f^{(4)}(t)|.

However, natural boundary conditions force S′′(a)=S′′(b)=0S''(a) = S''(b) = 0. If the true function has non-zero boundary curvature (f′′(a)≠0f''(a) \neq 0 or f′′(b)≠0f''(b) \neq 0), the spline suffers from boundary curvature incompatibility.

Consider f(x)=x2f(x) = x^2 on [0,1][0, 1]. Here f(4)(x)≡0f^{(4)}(x) \equiv 0, yet the natural spline cannot reproduce x2x^2 because S′′(0)=S′′(1)=0≠2S''(0) = S''(1) = 0 \neq 2. As a consequence, the global error rate of a natural spline degrades to second order:

max⁡x∈[a,b]∣f(x)−Snatural(x)∣=O(h2).\max_{x \in [a, b]} |f(x) - S_{\text{natural}}(x)| = \mathcal{O}(h^2).

Fourth-order convergence is restored for natural splines only if the true function naturally satisfies f′′(a)=f′′(b)=0f''(a) = f''(b) = 0.

Derivation of the tridiagonal system

To compute the spline efficiently, we do not solve for the 4n4n polynomial coefficients directly. Instead, we express each cubic piece in terms of its second derivatives at the knots:

Mi=S′′(xi),i=0,1,…,n.M_i = S''(x_i), \quad i = 0, 1, \dots, n.

Since each Si(x)S_i(x) is cubic, its second derivative Si′′(x)S''_i(x) is linear on [xi,xi+1][x_i, x_{i+1}]. Since Si′′(xi)=MiS''_i(x_i) = M_i and Si′′(xi+1)=Mi+1S''_i(x_{i+1}) = M_{i+1}, the linear Lagrange interpolant gives

Si′′(x)=Mixi+1−xhi+Mi+1x−xihi,hi=xi+1−xi.S''_i(x) = M_i \frac{x_{i+1} - x}{h_i} + M_{i+1} \frac{x - x_i}{h_i}, \quad h_i = x_{i+1} - x_i.

Integrating Si′′(x)S''_i(x) twice and using the interpolation conditions Si(xi)=yiS_i(x_i) = y_i and Si(xi+1)=yi+1S_i(x_{i+1}) = y_{i+1} yields the closed-form expression:

Si(x)=Mi(xi+1−x)36hi+Mi+1(x−xi)36hi+(yi−Mihi26)xi+1−xhi+(yi+1−Mi+1hi26)x−xihi.S_i(x) = M_i \frac{(x_{i+1} - x)^3}{6 h_i} + M_{i+1} \frac{(x - x_i)^3}{6 h_i} + \left( y_i - \frac{M_i h_i^2}{6} \right) \frac{x_{i+1} - x}{h_i} + \left( y_{i+1} - \frac{M_{i+1} h_i^2}{6} \right) \frac{x - x_i}{h_i}.

By construction, this formula guarantees C0C^0 value interpolation and C2C^2 second-derivative continuity. It remains only to enforce C1C^1 first-derivative continuity at each interior knot:

Si−1′(xi)=Si′(xi),i=1,2,…,n−1.S'_{i-1}(x_i) = S'_i(x_i), \quad i = 1, 2, \dots, n - 1.

Differentiating Si(x)S_i(x) and equating the one-sided limits at xix_i produces the celebrated Three-Moment Equation:

TheoremTridiagonal spline system

For i=1,2,…,n−1i = 1, 2, \dots, n - 1, the knot second derivatives Mi=S′′(xi)M_i = S''(x_i) satisfy

hi−1Mi−1+2(hi−1+hi)Mi+hiMi+1=6(yi+1−yihi−yi−yi−1hi−1).h_{i-1} M_{i-1} + 2(h_{i-1} + h_i) M_i + h_i M_{i+1} = 6 \left( \frac{y_{i+1} - y_i}{h_i} - \frac{y_i - y_{i-1}}{h_{i-1}} \right).

For natural boundary conditions, setting M0=Mn=0M_0 = M_n = 0 reduces this to a square linear system of size (n−1)×(n−1)(n-1) \times (n-1) for the interior unknowns M1,…,Mn−1M_1, \dots, M_{n-1}:

[2(h0+h1)h10…0h12(h1+h2)h2…00h22(h2+h3)…0⋮⋱⋱⋮0…0hn−22(hn−2+hn−1)][M1M2M3⋮Mn−1]=[d1d2d3⋮dn−1].\begin{bmatrix} 2(h_0 + h_1) & h_1 & 0 & \dots & 0 \\ h_1 & 2(h_1 + h_2) & h_2 & \dots & 0 \\ 0 & h_2 & 2(h_2 + h_3) & \dots & 0 \\ \vdots & & \ddots & \ddots & \vdots \\ 0 & \dots & 0 & h_{n-2} & 2(h_{n-2} + h_{n-1}) \end{bmatrix} \begin{bmatrix} M_1 \\ M_2 \\ M_3 \\ \vdots \\ M_{n-1} \end{bmatrix} = \begin{bmatrix} d_1 \\ d_2 \\ d_3 \\ \vdots \\ d_{n-1} \end{bmatrix}.

Notice that for every row ii:

2(hi−1+hi)>hi−1+hi.2(h_{i-1} + h_i) > h_{i-1} + h_i.

The coefficient matrix is strictly diagonally dominant and symmetric positive-definite. By the Gershgorin circle theorem, it is non-singular and well-conditioned.

Furthermore, because the matrix is tridiagonal, it can be solved using the Thomas algorithm (tridiagonal Gaussian elimination) in O(n)\mathcal{O}(n) time and O(n)\mathcal{O}(n) storage.

RemarkAlignment with standard textbook coefficients

In standard reference texts such as Burden and Faires [1][1] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011., each cubic piece is expanded about its left knot:

Sj(x)=aj+bj(x−xj)+cj(x−xj)2+dj(x−xj)3,x∈[xj,xj+1].S_j(x) = a_j + b_j(x - x_j) + c_j(x - x_j)^2 + d_j(x - x_j)^3, \quad x \in [x_j, x_{j+1}].

Because Sj′′(xj)=2cj=MjS''_j(x_j) = 2 c_j = M_j, the second derivatives MjM_j map directly to the textbook coefficients:

aj=yj,cj=Mj2,dj=Mj+1−Mj6hj,bj=yj+1−yjhj−2Mj+Mj+16hj.a_j = y_j, \quad c_j = \frac{M_j}{2}, \quad d_j = \frac{M_{j+1} - M_j}{6 h_j}, \quad b_j = \frac{y_{j+1} - y_j}{h_j} - \frac{2 M_j + M_{j+1}}{6} h_j.

Dividing the three-moment equation by 33 yields the textbook's tridiagonal system for the unknown coefficients cjc_j.

This interactive figure needs JavaScript.

Method comparison

We can now summarize the interpolation methods developed across the curriculum in a comparative decision table:

MethodPrescribed DataDegree BoundGlobal SmoothnessConvergence RateLocality & Sensitivity
Lagrange / NewtonValues f(xi)f(x_i)nn (Global)C∞C^\inftyVaries (Runge divergence on uniform grids)Non-local: moving one point affects the entire curve
ChebyshevValues at Chebyshev rootsnn (Global)C∞C^\inftyGeometric / Spectral for analytic ffNon-local: requires freedom to select node locations
HermiteValues f(xi)f(x_i) and slopes f′(xi)f'(x_i)2n+12n + 1 (Global)C∞C^\inftyO(h2n+2)\mathcal{O}(h^{2n+2}) locallyNon-local: matches tangents, but global degree grows
Piecewise LinearValues f(xi)f(x_i)11 (Local)C0C^0O(h2)\mathcal{O}(h^2) with sharp constant 1/81/8Strictly Local: perturbation affects only adjacent pieces
Piecewise QuadraticValues and midpoints22 (Local)C0C^0O(h3)\mathcal{O}(h^3)Strictly Local: corners persist at knots
Cubic Spline (Clamped)Values f(xi)f(x_i) and 22 boundary slopes33 (Local pieces)C2C^2O(h4)\mathcal{O}(h^4) uniformlyLocally damped: perturbation decays exponentially away from knot
Cubic Spline (Natural)Values f(xi)f(x_i) and S′′(a)=S′′(b)=0S''(a)=S''(b)=033 (Local pieces)C2C^2O(h2)\mathcal{O}(h^2) unless f′′=0f''=0 at boundariesLocally damped: zero endpoint curvature

By breaking the monopoly of high-degree global polynomials, cubic splines achieve the golden standard of scientific interpolation: optimal C2C^2 smoothness, linear O(n)\mathcal{O}(n) computational complexity, and bounded local influence.

References

  1. [1] R. L. Burden and J. D. Faires, Numerical Analysis, 9th ed. Brooks/Cole, Cengage Learning, 2011. a b
  2. [2] M. U. School of Mathematics, “MTH2051: Introduction to Computational Mathematics: Course Lecture Notes and Study Workbooks,” 2026. Monash University course materials and study workbooks, Semester 2, 2026. ↩