## B-Splines and Smoothing Splines

The Cox-de Boor recursion definition of the jth B-spline ${B}_{j,k}\left(x\right)$ with order k and nondecreasing knot sequence $t=\left({t}_{0},{t}_{1},\dots ,{t}_{n}\right)$ is given by the following formulas:

`$\begin{array}{l}{B}_{j,1}\left(x\right)=\left\{\begin{array}{cc}1& {t}_{j}\le x<{t}_{j+1}\\ 0& x<{t}_{j},{t}_{j+1}\le x\end{array}\\ {B}_{j,k+1}\left(x\right)=\frac{x-{t}_{j}}{{t}_{j+k-1}-{t}_{j}}{B}_{j,k-1}\left(x\right)+\frac{{t}_{j+k}-x}{{t}_{j+k}-{t}_{j+1}}{B}_{j+1,k-1}\left(x\right)\end{array}$`

The reference page for the `bspligui` interface lists some of the basic properties of the B-spline. You can use the interface to gain some experience with B-splines. The most important property of the B-spline is also the reason for the letter B in its name:

Every space of (univariate) piecewise-polynomials of a given order has a Basis consisting of B-splines.

### B-Spline Properties

Because Bj,k is nonzero only on the interval $\left({t}_{j},{t}_{j+k}\right)$, the linear system for the B-spline coefficients is banded and easy to solve. For example, to construct a spline s of order k with knot sequence t1t2 ≤··· ≤ tn+k so that s(xi)=yi for i=1, ..., n, use the linear system

`$\begin{array}{cc}\sum _{j=1}^{n}{B}_{j,k}\left({x}_{i}\right){a}_{j}={y}_{i}& i=1:n\end{array}$`

for the unknown B-spline coefficients aj in which each equation has at most k nonzero entries.

Also, many theoretical facts concerning splines are most easily stated or proved in terms of B-splines. For example, it is possible to match arbitrary data at sites ${x}_{1}<\cdots <{x}_{n}$ uniquely by a spline of order k with knot sequence (t1, ..., tn+k) if and only if Bj,k(xj)≠0 for all j (Schoenberg-Whitney Conditions). Computations with B-splines are facilitated by their stable recurrence relations, which are also helpful in the conversion from B-form to ppform. The dual functional

`${a}_{j}\left(s\right):=\sum _{i`

provides a useful expression for the jth B-spline coefficient of the spline s in terms of its value and derivatives at an arbitrary site τ between tj and tj+k, and with ψj(t):=(tj+1–t)··· (tj+k–1–t)/(k–1)!. It can be used to show that aj(s) is closely related to s on the interval [tj..tj+k], and seems the most efficient means for converting from ppform to B-form.

### Variational Approach and Smoothing Splines

The above constructive approach is not the only avenue to splines. In the variational approach, a spline is obtained as a best interpolant, e.g., as the function with smallest mth derivative among all those matching prescribed function values at certain sites. As it turns out, among the many such splines available, only those that are piecewise-polynomials or, perhaps, piecewise-exponentials have found much use. Of particular practical interest is the smoothing spline s = sp which, for given data (xi,yi) with x∊[a..b], all i, and given corresponding positive weights wi, and for given smoothing parameter p, minimizes

`$p\sum _{i}{w}_{i}{|{y}_{i}-f\left({x}_{i}\right)|}^{2}+\left(1-p\right){\int }_{a}^{b}{|{D}^{m}f\left(t\right)|}^{2}dt$`

over all functions f with m derivatives. It turns out that the smoothing spline s is a spline of order 2m with a break at every data site. The smoothing parameter, p, is chosen artfully to strike the right balance between wanting the error measure

`$E\left(s\right)=\sum _{i}{w}_{i}{|{y}_{i}-s\left({x}_{i}\right)|}^{2}$`

small and wanting the roughness measure

`$F\left({D}^{m}s\right)={\int }_{a}^{b}{|{D}^{m}s\left(t\right)|}^{2}dt$`

small. The hope is that s contains as much of the information, and as little of the supposed noise, in the data as possible. One approach to this (used in `spaps`) is to make F(Dmf) as small as possible subject to the condition that E(f) be no bigger than a prescribed tolerance. For computational reasons, `spaps` uses the (equivalent) smoothing parameter ρ=p/(1–p), i.e., minimizes ρE(f) + F(Dmf). Also, it is useful at times to use the more flexible roughness measure

`$F\left({D}^{m}s\right)={\int }_{a}^{b}\lambda \left(t\right){|{D}^{m}s\left(t\right)|}^{2}dt$`

with λ a suitable positive weight function.