# 2.10 Cubic Spline Interpolation

The method of least squares provides, among other things, an alternative to ordinary interpolation that avoids the problem of overfitting. Another alternative is spline interpolation, which encompasses a range of interpolation techniques that reduce the effects of overfitting. The method of cubic spline interpolation presented here is widely used in finance. It applies only in one dimension, but is useful for modeling yield curves, forward curves, and other term structures.

A cubic spline is a function *f* : → constructed by piecing together cubic polynomials *p*_{k}(*x*) on different intervals [*x*^{[k]}, *x*^{[k+1]}]. It has the form

[2.112]

Consider points (*x*^{[1]}, *y*^{[1]}), (*x*^{[2]}, *y*^{[2]}), … , (*x*^{[m]}, *y*^{[m]}), with *x*^{[1]} < *x*^{[2]} < … < *x*^{[m]}. We construct a cubic spline by interpolating a cubic polynomial *p*_{k} between each pair of consecutive points (*x*^{[k]}, *y*^{[k]}) and (*x*^{[k+1]}, *y*^{[k+1]}) according to the following constraints:

- Each polynomial passes through its respective end points:
[2.113]

- First derivatives match at interior points:
[2.114]

- Second derivatives match at interior points:
[2.115]

- Second derivatives vanish at the end points:
[2.116]

The above conditions specify a system of linear equations that can be solved for the cubic spline. In practice, it makes little sense to fit a cubic spline to fewer than five points. However, for the purpose of illustration, let’s interpolate a cubic spline between just three points.

Consider the points (*x*^{[k]}, *y*^{[k]}) = (1, 1), (2, 5), (3, 4). We seek to fit a cubic polynomial on the interval [1, 2] and another cubic polynomial on the interval [2, 3]. These take the forms

[2.117]

[2.118]

Our first condition requires

[2.119]

[2.120]

[2.121]

[2.122]

The second condition requires

[2.123]

The third condition requires

[2.124]

Finally, the last condition requires

[2.125]

[2.126]

We have eight equations in eight unknowns. These can be expressed as

[2.127]

which we solve to obtain

[2.128]

Our two polynomials are

[2.129]

[2.130]

The cubic spline, along with the three points upon which it is based, is shown in Exhibit 2.15.

###### Exercises

Interpolate a cubic spline between the three points (0, 1), (2, 2) and (4, 0).

Solution