Derivation of Spline Polynomials

Spline fitting or spline interpolation is a way to draw a smooth curve through n+1 points (x0, y0), …, (xn,yn). Thus, we seek a smooth function f(x) so that f(xi) = yi for all i. In particular, we seek n cubic polynomials p0, …, pn-1 so that f(x) = pi(x) for all x in the interval [xi, xi+1].

Key Property

Property 1: The cubic polynomials that we are seeking can be defined by

pi(x) = ai(x–xi)3 + bi(x–xi)2 + ci(x–xi) + di

where for i = 0, …, n-1degree 3 coefficient a

degree 1 coefficient c

constant coefficient d

based on hi = xi+1xi and ki = yi+1 – yiThe bi coefficients are defined via matrix operations as follows. First define for i = 1, …, nr, s, v

Now define U = [uij] to be an n+1 × n+1 matrix (where i, j = 0, …, n) where

U matrix

and define B = [bi] and V = [vi] to be n+1 × 1 matrices where the vi are as defined above and B is defined by

B = U-1V

Proof

The proof uses calculus.

We define n cubic polynomials p0, …, pn-1 with the following properties:

  1. pi(x) = ai(x–xi)3 + bi(x–xi)2 + ci(x–xi) + di for all i = 0, …, n–1
  2. if xi-1xxi then f(x) = pi(x) for all i = 0, …, n1 (f defined piecewise by the pi)
  3. f(xi) = yi for all i = 0, …, n (points (xi, yi) lie on the y = f(x)  curve)
  4. pi-1 (xi) = pi (xi) for all i = 0, …, n–1 (f  is continuous)
  5. pi-1 (xi) = pi (xi) for all i = 0, …, n–1 (f′ exists and is continuous)
  6. p′′i-1 (xi) = p′′i (xi) for all i = 0, …, n–1 (f′′ exists and is continuous)
  7. p′′0 (x0) = 0 and p′′n-1 (xn) = 0 (initial conditions)

We also define hi = xi+1 – xi and ki = yi+1 – yi for i = 0, …, n–1.

By 1, 2, and 3, for i = 0, …, n–1

d_i = y_i

and so by 1, 3, and 4, for i = 0, …, n–1

or equivalently

By 1

and so

It now follows by 6 that

and so for i = 0, …, n–1degree 3 coefficient

It now follows that

Solving for ci it follows thatdegree 1 coefficient

As we have seen previously

and so

It now follows by 5 that

or equivalently for i = 0, …, n–1

This can be re-expressed as

We now have n+1 linear equations in n+1 unknowns as follows for i = 1, …, n–1

Dividing both sides of this last equation by hi-1 + hi, we obtain the equivalent form

where ri, si, and vi are defined as in the statement of the property. With B, U, and V defined as in the statement of the property, the n+1 linear equations can be re-expressed as

UB = V

from which it follows that B = U-1V, which completes the proof.

References

Chen, M-Q (2013) Cubic spline interpolation
This paper has been removed from the Internet

Jameson, A. (2019) Cubic splines
http://aero-comlab.stanford.edu/Papers/splines.pdf

Wang, K. (2013) A study of cubic spline interpolation
https://www2.rivier.edu/journal/ROAJ-Fall-2013/J784-Wang_cubic-splines.pdf

2 thoughts on “Derivation of Spline Polynomials”

  1. A bit pedantic, but … in properties 4, 5, 6 your equations show indices “i-1” for i=0,…,n-1 but the polynomials are only defined for index values 0 to n-1 (property 1). So when i=0, your indices in properties 4, 5, 6 take a value of -1, for which the polynomials are not defined.
    Similarly in property 2, the “i-1” index for x can take a value of -1
    It would seem to be more sensible to use indices i and i+1 in place of i-1 and i, or else use i=1, …n (n+1 in property 3)

    Reply
    • Thanks for your suggestion. I am now finishing the testing of the new capabilities for the next release of the Real Statistics software. I will make the necessary changes once I have issued the new release.
      Charles

      Reply

Leave a Comment