MathLabs
TheoremProved

Existence and uniqueness of the natural cubic spline

Statement

Given n+1n+1 points (x0,y0),…,(xn,yn)(x_0,y_0),\dots,(x_n,y_n) with x0<x1<⋯<xnx_0<x_1<\dots<x_n, there exists a unique function SS that is a cubic polynomial on each subinterval [xi,xi+1][x_i,x_{i+1}], is twice continuously differentiable on all of [x0,xn][x_0,x_n], satisfies S(xi)=yiS(x_i)=y_i for every ii, and satisfies the natural boundary conditions S′′(x0)=S′′(xn)=0S''(x_0)=S''(x_n)=0.

Why is it true?

A single high-degree polynomial through many points tends to wiggle, but stitching together many gentle cubic pieces and only demanding they match up smoothly at the seams gives just enough freedom to fit the data without any wild swings, and the natural boundary conditions supply exactly the two extra equations needed to make the whole system solvable.

Proof sketch

Step 1 (unknowns: the second derivatives at the knots). Let Mi=S′′(xi)M_i = S''(x_i) for i=0,…,ni=0,\dots,n. The natural boundary conditions fix M0=0M_0=0 and Mn=0M_n=0 immediately, leaving n−1n-1 unknowns M1,…,Mn−1M_1,\dots,M_{n-1} to determine.

Step 2 (reconstruct each cubic piece from its M values). On [xi,xi+1][x_i,x_{i+1}], since SS is cubic, S′′S'' is linear, so it must be the straight line through (xi,Mi)(x_i,M_i) and (xi+1,Mi+1)(x_{i+1},M_{i+1}). Integrating this linear function twice and fixing the two constants of integration using S(xi)=yiS(x_i)=y_i and S(xi+1)=yi+1S(x_{i+1})=y_{i+1} determines SS completely on that piece, in terms of Mi,Mi+1,yi,yi+1M_i, M_{i+1}, y_i, y_{i+1} and the spacing hi=xi+1−xih_i=x_{i+1}-x_i. So once all the MiM_i are known, SS is fully known.

Step 3 (matching slopes gives a linear system). By construction SS and S′′S'' are already continuous across each knot. Demanding that the first derivative S′S' also matches from both sides at each interior knot xix_i (i=1,…,n−1i=1,\dots,n-1) produces one linear equation per interior knot relating three consecutive unknowns: 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(\dfrac{y_{i+1}-y_i}{h_i} - \dfrac{y_i-y_{i-1}}{h_{i-1}}\right). This gives n−1n-1 linear equations in the n−1n-1 unknowns M1,…,Mn−1M_1,\dots,M_{n-1} (using M0=Mn=0M_0=M_n=0).

Step 4 (the system has a unique solution). The coefficient matrix of this system is tridiagonal with diagonal entries 2(hi−1+hi)2(h_{i-1}+h_i) and off-diagonal entries hi−1h_{i-1} and hih_i; since 2(hi−1+hi)>hi−1+hi2(h_{i-1}+h_i) > h_{i-1}+h_i (as all spacings hi>0h_i>0), the matrix is strictly diagonally dominant, and a strictly diagonally dominant matrix is always invertible. So the linear system for M1,…,Mn−1M_1,\dots,M_{n-1} has exactly one solution, and by Step 2 this determines exactly one spline SS, proving both existence and uniqueness.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.