# CHAPTER 2 Basic properties of splines and B-splines

```CHAPTER 2
Basic properties of splines and
B-splines
In Chapter 1 we introduced splines through a geometric construction of curves based on
repeated averaging, and it turned out that a natural representation of spline curves was
as linear combinations of B-splines. In this chapter we start with a detailed study of the
most basic properties of B-splines, illustrated by examples and figures in Section 2.1, and
in Section 2.2 we formally define spline functions and spline curves. In Section 2.3 we give
a matrix representation of splines and B-splines, and this representation is the basis for
our development of much of the theory in later chapters.
2.1
Some simple consequences of the recurrence relation
We saw in Theorem 1.5 that a degree d spline curve f can be constructed from n control
points (ci )ni=1 and n + d + 1 knots (ti )n+d+1
and written as
i=1
f=
n
X
ci Bi,d ,
i=1
where {Bi,d }ni=1 are B-splines. In this section we will explore B-splines by considering a
number of examples, and deducing some of their most basic properties. For easy reference
we start by recording the definition of B-splines. Since we will mainly be working with
functions in this chapter, we use x as the independent variable.
Definition 2.1. Let d be a nonnegative integer and let t = (tj ), the knot vector or knot
sequence, be a nondecreasing sequence of real numbers of length at least d + 2. The jth
B-spline of degree d with knots t is defined by
Bj,d,t (x) =
tj+1+d − x
x − tj
Bj,d−1,t (x) +
Bj+1,d−1,t (x),
tj+d − tj
tj+1+d − tj+1
(2.1)
for all real numbers x, with
(
1, if tj ≤ x < tj+1 ;
Bj,0,t (x) =
0, otherwise.
37
(2.2)
38
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
1.5
2
2.5
1.5
3
(a)
2
2.5
3
(b)
Figure 2.1. A linear B-spline with simple knots (a) and double knots (b).
Here, the convention is assumed that ‘0/0 = 00 . When there is no chance of ambiguity
some of the subscripts will be dropped and the B-spline written as either Bj,d , Bj,t , or
simply Bj .
We say that a knot has multiplicity m if it appears m times in the knot sequence.
Knots of multiplicity one, two, three are also called simple, double and triple knots.
Many properties of B-splines can be deduced directly from the definition. One of the
most basic properties is that
Bj,d (x) = 0
for all x when tj = tj+d+1
which we made use of in Chapter 1. This is true by definition for d = 0, and if it is true
for B-splines of degree d − 1, the zero convention means that if tj = tj+d+1 then both
Bj,d−1 (x)/(tj+d − tj ) and Bj+1,d−1 (x)/(tj+1+d − tj+1 ) on the right in (2.1) are zero, and
hence Bj,d (x) is zero. The recurrence relation can therefore be expressed more explicitly
as


0,
if tj = tj+1+d ;



s (x),
if tj < tj+d and tj+1 = tj+1+d ;
1
Bj,d (x) =
(2.3)
s2 (x),
if tj = tj+d and tj+1 < tj+1+d ;



s (x) + s (x), otherwise;
1
2
where
s1 (x) =
x − tj
Bj,d−1 (x)
tj+d − tj
and
s2 (x) =
tj+1+d − x
Bj+1,d−1 (x)
tj+1+d − tj+1
for all x.
The following example shows that linear B-splines are quite simple.
Example 2.2 (B-splines of degree 1). One application of the recurrence relation gives


(x − tj )/(tj+1 − tj ),
x − tj
tj+2 − x
Bj,1 (x) =
Bj,0 (x) +
Bj+1,0 (x) = (tj+2 − x)/(tj+2 − tj+1 ),

tj+1 − tj
tj+2 − tj+1
0,
if tj ≤ x < tj+1 ;
if tj+1 ≤ x < tj+2 ; .
otherwise
A plot of this hat function is shown in Figure 2.1 (a) in a typical case where tj < tj+1 < tj+2 . The figure
shows clearly that Bj,1 consists of linear polynomial pieces, with breaks at the knots. In Figure 2.1 (b), the
2.1. SOME SIMPLE CONSEQUENCES OF THE RECURRENCE RELATION
39
1
0.8
0.6
0.4
0.2
2.5
5
7.5
10
12.5
15
17.5
Figure 2.2. From left to right we see the quadratic B-splines B(x|0, 0, 0, 1), B(x|2, 2, 3, 4), B(x|5, 6, 7, 8),
B(x|9, 10, 10, 11), B(x|12, 12, 13, 13), B(x|14, 15, 16, 16), and B(x|17, 18, 18, 18).
two knots tj and tj+1 are identical; then the first linear piece is identically zero since Bj,0 = 0, and Bj,1 is
discontinuous. This provides an illustration of the smoothness properties of B-splines: a linear B-spline is
discontinuous at a double knot, but continuous at simple knots.
The B-spline Bj,d depends only on the knots (tk )j+d+1
k=j . For B-splines of degree 0 this
is clear from equation (2.2), and Example 2.2 shows that it is also true for B-splines of
degree 1. To show that it is true in general we use induction and assume that Bj,d−1 only
j+d+1
depends on (tk )j+d
k=j and Bj+1,d−1 only depends on (tk )k=j+1 . By examining the recurrence
relation (2.1) we see that then Bj,d can only depend on the knots (tk )j+d+1
k=j , as we claimed.
To emphasise this local nature of B-splines, the notation Bj,d (x) = B(x|tj , . . . , tj+d+1 )
is sometimes useful. For example, if d ≥ 2 and if we set (tj , tj+1 , . . . , tj+d , tj+d+1 ) =
(a, b, . . . , c, d), then (2.1) can be written
B(x|a, b, . . . , c, d)(x) =
d−x
x−a
B(x|a, b, . . . , c) +
B(x|b, . . . , c, d).
c−a
d−b
(2.4)
Example 2.3 (Quadratic B-splines). Using the zero convention and (2.4) we find
1. B(x|0, 0, 0, 1) = (1 − x)B(x|0, 0, 1) = (1 − x)2 B(x|0, 1).
2. B(x|0, 0, 1, 2) = x(2 − 23 x)B(x|0, 1) + 12 (2 − x)2 B(x|1, 2).
3. B(x|0, 1, 2, 3) =
x2
B(x|0, 1)
2
+
3
4
− (x − 32 )2 B(x|1, 2) +
(3−x)2
B(x|2, 3).
2
4. B(x|0, 1, 1, 2) = x2 B(x|0, 1) + (2 − x)2 B(x|1, 2).
5. B(x|0, 0, 1, 1) = 2x(1 − x)B(x|0, 1).
6. B(x|0, 1, 2, 2) = 21 x2 B(x|0, 1) + (2 − x)( 32 x − 1)B(x|1, 2).
7. B(x|0, 1, 1, 1) = x2 B(x|0, 1).
Translates (see (2.6)) of these functions are shown in Figure 2.2. Note that the B-spline B(x|0, 1, 2, 3)
consists of three nonzero polynomial pieces, but that in general the number of nonzero pieces depends
on the multiplicity of the knots. For example, the functions B(x|0, 0, 0, 1) and B(x|0, 0, 1, 1) consist of
only one nonzero piece. Figure 2.2 illustrates these smoothness properties of B-splines: At a single knot a
quadratic B-spline is continuous and has a continuous derivative, at a double knot it is continuous, while
at a triple knot it is discontinuous.
Figure 2.3 shows the quadratic B-spline B(x|0, 1, 2, 3) together with its constituent polynomial pieces.
Note how the three parabolas join together smoothly to make the B-spline have continuous first derivative
at every point.
40
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
0.8
0.6
0.4
0.2
0.5
1
1.5
2
2.5
3
Figure 2.3. The different polynomial pieces of a quadratic B-spline.
By applying the recurrence relation (2.1) twice we obtain an explicit expression for a generic quadratic
B-spline,
i
tj+2 − x
x − t j h x − tj
Bj,0 (x) +
Bj+1,0 (x)
Bj,2 (x) =
tj+2 − tj tj+1 − tj
tj+2 − tj+1
i
tj+3 − x h x − tj+1
tj+3 − x
Bj+1,0 (x) +
Bj+2,0 (x)
+
tj+3 − tj+1 tj+2 − tj+1
tj+3 − tj+2
(2.5)
2
(tj+3 − x)2
(x − tj )
Bj,0 (x) +
Bj+2,0 (x)
=
(tj+2 − tj )(tj+1 − tj )
(tj+3 − tj+1 )(tj+3 − tj+2 )
(x − t )(t
(tj+3 − x)(x − tj+1 ) j
j+2 − x)
+
+
Bj+1,0 (x).
(tj+2 − tj )(tj+2 − tj+1 )
(tj+3 − tj+1 )(tj+2 − tj+1 )
The complexity of this expression gives us a good reason to work with B-splines through other means than
explicit formulas.
Figure 2.4 shows some cubic B-splines. The middle B-spline, B(x|9, 10, 11, 12, 13),
has simple knots and its second derivative is therefore continuous for all real numbers x,
including the knots. In general a cubic B-spline has 3 − m continuous derivatives at a
knot of multiplicity m for m = 1, 2, 3. A cubic B-spline with a knot of multiplicity 4 is
discontinuous at the knot.
Before considering the next example we show that B-splines possess a property called
translation invariance. Mathematically this is expressed by the formula
B(x + y|tj + y, . . . , tj+d+1 + y) = B(x|tj , . . . , tj+d+1 ) x, y ∈ R.
(2.6)
We argue by induction, and start by checking the case d = 0. We have
(
(
1, if tj + y ≤ x + y < tj+1 + y;
1, if tj ≤ x < tj+1 ;
B(x + y|tj + y, tj+1 + y) =
=
0, otherwise
0, otherwise,
so equation (2.6) holds for d = 0. Suppose that the translation invariance holds for Bsplines of degree d − 1. In the recurrence (2.1) for the left-hand-side of (2.6) the first
coefficient (x − tj )/(tj+d − tj ) can be written
(x + y) − (tj + y)
x − tj
=
,
(tj+d + y) − (tj + y)
tj+d − tj
2.1. SOME SIMPLE CONSEQUENCES OF THE RECURRENCE RELATION
41
1
0.8
0.6
0.4
0.2
5
10
15
20
Figure 2.4. From left to right we see the cubic B-splines B(x|0, 0, 0, 0, 1), B(x|2, 2, 2, 3, 4), B(x|5, 5, 6, 7, 8),
B(x|9, 10, 11, 12, 13), B(x|14, 16, 16, 16, 17), B(x|18, 19, 20, 20, 20), and B(x|21, 22, 22, 22, 22).
i.e., the same as before translation. This also holds for the other coefficient (tj+d+1 −
x)/(tj+d+1 − tj+1 ) in (2.1). Since the two B-splines of degree d − 1 are translation invariant
by the induction hypothesis, we conclude that (2.6) holds for all polynomial degrees.
Example 2.4 (Uniform B-splines). The B-splines on a uniform knot vector are of special interest. Let the knots be the set Z of all integers. We index this knot sequence by letting tj = j for all integers
j. We denote the uniform B-spline of degree d ≥ 0 by
Md (x) = B0,d (x) = B(x|0, 1, · · · , d + 1),
x ∈ R.
(2.7)
The functions Md are also called cardinal B-splines. On this knot vector all B-splines can be written as
translates of the function Md . Using (2.6) we have
Bj,d (x) = B(x|j, j + 1, . . . , j + d + 1) = B(x − j|0, 1, . . . , d + 1) = Md (x − j)
for all j.
In particular, B1,d−1 (x) = B(x|1, . . . , d + 1) = Md−1 (x − 1) and the recurrence relation implies that for
d≥1
x
d+1−x
Md (x) = Md−1 (x) +
Md−1 (x − 1).
(2.8)
d
d
Using this recurrence we can compute the first few uniform B-splines
M1 (x) = xM0 (x) + (2 − x)M0 (x − 1)
3
(3 − x)2
x2
3 M2 (x) =
M0 (x) +
− (x − )2 M0 (x − 1) +
M0 (x − 2)
2
4
2
2
3
x
2
1
M3 (x) =
M0 (x) +
− x(x − 2)2 M0 (x − 1)
6
3
2
2
(4 − x)3
1
+
− (4 − x)(x − 2)2 M0 (x − 2) +
M0 (x − 3)
3
2
6
(2.9)
( compare with Examples 2.2 and 2.3). As we shall see in Chapter 3, the B-spline Md has d − 1 continuous
derivatives at the knots. The quadratic cardinal B-spline M2 is shown in Figure 2.2, translated to the
interval [5, 8], while M3 is shown in Figure 2.4, translated to [9, 13].
Example 2.5 (Bernstein polynomials). The Bernstein polynomials that appeared in the representation of Bézier curves in Section 1.4 are special cases of B-splines. In fact it turns out that the jth
Bernstein polynomial on the interval [a, b] is (almost) given by
j+1
Bjd (x)
d+1−j
z }| { z }| {
= B(x| a, . . . , a, b, . . . , b),
for j = 0, . . . , d.
The recurrence relation (2.4) now takes the form
j
Bjd (x)
j+1
d+1−j
d−j
z }| { z }| {
z }| { z }| {
x−a
b−x
=
B(x| a, . . . , a, b, . . . , b) +
B(x| a, . . . , a, b, . . . , b)
b−a
b−a
x − a d−1
b − x d−1
=
B
(x) +
B
(x).
b − a j−1
b−a j
(2.10)
42
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
This is also valid for j = 0 and j = d if we define Bjd−1 = 0 for j < 0 and j ≥ d. Using induction on d one
can show the explicit formula
!
j d−j
b−x
d
x−a
d
Bj (x) =
B(x|a, b), for j = 0, 1, . . . , d,
(2.11)
b−a
b−a
j
see exercise 5. These are essentially the Bernstein polynomials for the interval [a, b], except that the factor
B(x|a, b) causes Bj,d to be zero outside [a, b]. To represent Bézier curves, it is most common to use the
Bernstein polynomials on the interval [0, 1] as in Section 1.4, i.e., with a = 0 and b = 1,
!
d j
Bj,d (x) =
x (1 − x)d−j B(x|0, 1) = bj,d (x)B(x|a, b), for j = 0, 1, . . . , d;
(2.12)
j
here Bjd is the jth Bernstein polynomial of degree d. For example, the quadratic Bernstein basis polynomials
are given by
b0,2 (x) = (1 − x)2 , b1,2 (x) = 2x(1 − x), b2,2 (x) = x2
which agrees with what we found in Chapter 1. These functions can also be recognised as the polynomial
part of the special quadratic B-splines in (1), (5) and (7) in Example 2.3. For Bernstein polynomials on
[0, 1] the recurrence relation (2.10) takes the form
bj,d (x) = xbj−1,d−1 (x) + (1 − x)bj,d−1 (x),
j = 0, 1, . . . , d.
(2.13)
We have now seen a number of examples of B-splines and some characteristic features
are evident. The following lemma sums up the most basic properties.
Lemma 2.6. Let d be a nonnegative polynomial degree and let t = (tj ) be a knot sequence. The B-splines on t have the following properties:
1. Local knots. The jth B-spline Bj,d depends only on the knots tj , tj+1 , . . . , tj+d+1 .
2. Local support.
(a) If x is outside the interval [tj , tj+d+1 ) then Bj,d (x) = 0. In particular, if tj =
tj+d+1 then Bj,d is identically zero.
(b) If x lies in the interval [tµ , tµ+1 ) then Bj,d (x) = 0 if j < µ − d or j > µ.
3. Positivity. If x ∈ (tj , tj+d+1 ) then Bj,d (x) > 0. The closed interval [tj , tj+d+1 ] is
called the support of Bj,d .
4. Piecewise polynomial. The B-spline Bj,d can be written
Bj,d (x) =
j+d
X
k
Bj,d
(x)Bk,0 (x)
(2.14)
k=j
k (x) is a polynomial of degree d.
where each Bj,d
5. Special values. If z = tj+1 = · · · = tj+d < tj+d+1 then Bj,d (z) = 1 and Bi,d (z) = 0
for i 6= j.
6. Smoothness. If the number z occurs m times among tj , . . . , tj+d+1 then the derivatives of Bj,d of order 0, 1, . . . , d − m are all continuous at z.
Proof. Properties 1–3 follow directly, by induction, from the recurrence relation, see
exercise 3. In Section 1.5 in Chapter 1 we saw that the construction of splines produced
piecewise polynomials, so this explains property 4. Property 5 is proved in exercise 6 and
property 6 will be proved in Chapter 3.
2.2. LINEAR COMBINATIONS OF B-SPLINES
2.2
43
Linear combinations of B-splines
In Theorem 1.5 we saw that B-splines play a central role in the representation of spline
curves. The purpose of this section is to define precisely what we mean by spline functions
and spline curves and related concepts like the control polygon.
2.2.1
Spline functions
The B-spline Bj,d depends on the knots tj , . . . , tj+1+d . This means that if the knot vector
is given by t = (tj )n+d+1
for some positive integer n, we can form n B-splines {Bj,d }nj=1 of
j=1
degree d associated with this knot vector. A linear combination of B-splines, or a spline
function, is a combination of B-splines on the form
f=
n
X
cj Bj,d ,
(2.15)
j=1
where c = (cj )nj=1 are n real numbers. We formalise this in a definition.
Definition 2.7 (Spline functions). Let t = (tj )n+d+1
be a nondecreasing sequence of
j=1
real numbers, i.e., a knot vector for a total of n B-splines. The linear space of all linear
combinations of these B-splines is the spline space Sd,t defined by
Sd,t = span{B1,d , . . . , Bn,d } =
n
nX
o
cj Bj,d | cj ∈ R for 1 ≤ j ≤ n .
j=1
P
An element f = nj=1 cj Bj,d of Sd,t is called a spline function, or just a spline, of degree
d with knots t, and (cj )nj=1 are called the B-spline coefficients of f .
As we shall see later, B-splines are linearly independent so Sd,t is a linear space of
dimension n.
It will often be the case that
Pthe exact length of the knot vector is of little interest.
Then we may write a spline as j cj Bj,d without specifying the upper and lower bounds
on j.
Example 2.8 (A linear spline). Let (xi , yi )m
i=1 be a set of data points with xi < xi+1 for i = 1,
2, . . . , m − 1. On the knot vector
t = (tj )m+2
j=1 = (x1 , x1 , x2 , x3 , . . . , xm−1 , xm , xm )
we consider the linear (d = 1) spline function
s(x) =
m
X
yj Bj,1 (x),
for x ∈ [x1 , xm ].
j=1
From Example 2.2 we see that s satisfies the interpolatory conditions
s(xi ) =
m
X
yj Bj,1 (xi ) = yi ,
i = 1, . . . , m − 1
(2.16)
j=1
since Bi−1,1 (xi ) = 1 and all other B-splines are zero at xi . At x = xm all the B-splines are zero according
to Definition 2.1. But the limit of Bm (x) when x tends to xm from the left is 1. Equation (2.16) therefore
44
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
2
1
1.5
0.5
1
0.5
0.5
1
1.5
2
2.5
3
-0.5
2
4
6
8
-1
-0.5
-1.5
-1
(a)
(b)
Figure 2.5. A linear spline interpolating data (a), and a quadratic spline (solid) that approximates sin(πx/2)
(dashed).
also holds for i = m if we take limits from the left at x = xm . In addition s is linear on each subinterval
[tµ , tµ+1 ) since
s(x) = yµ−1 Bµ−1,1 (x) + yµ Bµ,1 (x)
tµ+1 − x
x − tµ
=
yµ−1 +
yµ .
tµ+1 − tµ
tµ+1 − tµ
(2.17)
when x is in [tµ , tµ+1 ). It follows that s is the piecewise linear interpolant to the data. An example is
shown in Figure 2.5 (a).
Example 2.9 (A quadratic spline). Let f : [a, b] → R be a given function defined on some
interval [a, b], and let n be an integer greater than 2. On [a, b] we assume that we have a knot vector
t = (tj )n+3
j=1 , where
a = t1 = t2 = t3 < t4 < · · · < tn < tn+1 = tn+2 = tn+3 .
We can then define the quadratic spline function
s(x) = Qf (x) =
n
X
f (t∗j )Bj,2 (x),
j=1
where
We note that
t∗j = (tj+1 + tj+2 )/2,
j = 1, . . . , n.
a = t∗1 < t∗2 < · · · < t∗n = b.
The function Qf is called the Variation Diminishing Spline Approximation
to f of degree 2. As a particular
√
instance of this approximation we approximate the function f (x) = 2 sin ( π2 x) on the interval [0, 3]. With
t = (tj )8j=1 = (0, 0, 0, 1, 2, 3, 3, 3),
we obtain (t∗j )5j=1 = (0, 1/2, 3/2, 5/2, 3) and
s(x) = B2,2 (x) + B3,2 (x) − B4,2 (x) −
√
2B5,2 (x).
A plot of this function together with f (x) is shown in Figure 2.5 (b).
Example 2.10 (A cubic polynomial in Bernstein form). On the knot vector
t = (tj )8j=1 = (0, 0, 0, 0, 1, 1, 1, 1)
2.2. LINEAR COMBINATIONS OF B-SPLINES
1
45
4
0.5
2
0.5
1
1.5
2
2.5
3
0.2
-0.5
0.4
0.6
0.8
1
-2
-1
-4
(a)
(b)
Figure 2.6. The quadratic spline from Example 2.9 with its control polygon (a) and the cubic Chebyshev polynomial
with its control polygon (b).
we consider the cubic spline function
s(x) = −B1,3 (x) + 5B2,3 (x) − 5B3,3 (x) + B4,3 (x).
In terms of the cubic Bernstein basis we have
s(x) = −b0,3 (x) + 5b1,3 (x) − 5b2,3 + b3,3 ,
0 ≤ x ≤ 1.
This polynomial is shown in Figure 2.6 (b). It is the cubic Chebyshev polynomial with respect to the
interval [0, 1].
Note that the knot vectors in the above examples all have knots of multiplicity d + 1
at both ends. If in addition no knot occurs with multiplicity higher than d + 1 (as in the
examples), the knot vector is said to be d + 1-regular.
When we introduced spline curves in Chapter 1, we saw that a curve mimicked the
shape of its control polygon in an intuitive way. The control polygon of a spline function
is not quite as simple as for curves since the B-spline coefficients of a spline function is a
number. What is needed is an abscissa to associate with each coefficient.
P
Definition 2.11 (Control polygon for spline functions). Let f = nj=1 cj Bj,d be a
spline in Sd,t . The control points of f are the points with coordinates (t∗j , cj ) for j = 1,
. . . , n, where
tj+1 + · · · + tj+d
t∗j =
d
are the knot averages of t. The control polygon of f is the piecewise linear function
obtained by connecting neighbouring control points by straight lines.
Some spline functions are shown with their control polygons in Figures 2.6–2.7. It
is quite striking how the spline is a smoothed out version of the control polygon. In
particular we notice that at a knot with multiplicity at least d, the spline and its control
polygon agree. This happens at the beginning and end of all the splines since we have
used d + 1-regular knot vectors, and also at some points in the interior for the splines in
Figure 2.7. We also note that the control polygon is tangent to the spline function at a
knot of multiplicity d or d + 1. This close relationship between a spline and its control
polygon is a geometric instance of one of the many nice properties possessed by splines
represented in terms of B-splines.
46
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
2
6
5
1.5
4
1
3
2
0.5
1
0.5
1
1.5
2
2.5
3
1
(a)
2
3
4
5
(b)
Figure 2.7. A quadratic spline function with knots t = (0, 0, 0, 1, 1, 2, 3, 3, 3) and B-spline coefficients
c = (1, 0, 2, 1/2, 0, 1) is shown in (a) while (b) shows a cubic spline function with knots t =
(0, 0, 0, 0, 1, 1, 2, 2, 2, 4, 5, 5, 5, 5) and B-spline coefficients 0, 3, 1, 4, 6, 1, 5, 3, 0, 4).
From our knowledge of B-splines we immediately obtain some basic properties of
splines.
n+d+1
Lemma 2.12.
Pn Let t = (tj )j=1 be a knot vector for splines of degree d with n ≥ d + 1,
and let f = j=1 cj Bj,d be a spline in Sd,t . Then f has the following properties:
1. If x is in the interval [tµ , tµ+1 ) for some µ in the range d + 1 ≤ µ ≤ n then
f (x) =
µ
X
cj Bj,d (x).
j=µ−d
2. If z = tj+1 = · · · = tj+d < tj+d+1 for some j in the range 1 ≤ j ≤ n then f (z) = cj .
3. If z occurs m times in t then f has continuous derivatives of order 0, . . . , d − m at
z.
Proof. This follows directly from Lemma 2.6.
2.2.2
Spline curves
For later reference we give a precise definition of spline curves, although we have already
made extensive use of them in Chapter 1.
In many situations spline functions will be the right tool to represent a set of data or
some desired shape. But as we saw in Section 1.2, functions have some inherent restrictions
in that, for a given x, a function can only take on one function value. We saw that one way
to overcome this restriction was by representing the x- and y-components by two different
functions,
f (u) = f1 (u), f2 (u) .
Vector functions in higher dimensions are obtained by adding more components. We will
be particularly interested in the special case where all the components are spline functions
on a common knot vector.
2.3. A MATRIX REPRESENTATION OF B-SPLINES
47
Definition 2.13 (Spline curves). Let t = (tj )n+d+1
be a nondecreasing sequence of real
j=1
numbers, and let q ≥ 2 be an integer. The space of all spline curves in Rq of degree d and
with knots t is defined as
n
nX
o
Sqd,t =
cj Bj,d | cj ∈ Rq for 1 ≤ j ≤ n .
j=1
P
More precisely, an element f = nj=1 cj Bj,d of Sqd,t is called a spline vector function or
a parametric spline curve of degree d with knots t, and (cj )nj=1 are called the B-spline
coefficients or control points of f .
We have already defined what we mean by the control polygon of a spline curve, but
for reference we repeat the definition here.
n+d+1
Definition 2.14 (Control polygon for spline
be a knot
Pn curves). Let t = (tj )j=1
vector for splines of degree d, and let f =
c
B
be
a
spline
curve
in
Sd,t,q for
j=1 j j,d
q ≥ 2. The control polygon of f is the piecewise linear function obtained by connecting
neighbouring control points by straight lines.
Some examples of spline curves with their control polygons can be found in Section 1.5.
Spline curves may be thought of as spline functions with B-spline coefficients that are
vectors. This means that virtually all the algorithms that we develop for spline functions can be generalised to spline curves by simply applying the functional version of the
algorithm to each component of the curve in turn.
2.3
A matrix representation of B-splines
Mathematical objects defined by recurrence relations can become very complex even if the
recurrence relation is simple. This is certainly the case for B-splines. The structure of
the recurrence relation (2.1) is relatively simple, but if we try to determine the symbolic
expressions for the individual pieces of a B-spline in terms of the knots and the variable
x, for degree five or six, the algebraic complexity of the expressions is perhaps the most
striking feature. It turns out that these rather complex formulas can be represented
in terms of products of simple matrices, and this is the theme of this section. This
representation will be used in Section 3.1 to show how polynomials can be represented in
terms of B-splines and to prove that B-splines are linearly independent. In Section 2.4 we
will make use of the matrix notation to develop algorithms for computing function values
and derivatives of splines. The matrix representation will also be useful in the theory of
knot insertion in Chapter 4.
We start by introducing the matrix representation for linear, quadratic and cubic
splines in three examples.
Example 2.15 (Vector representation of linear B-splines). Consider the case of linear
B-splines with knots t, and focus on one nonempty knot interval [tµ , tµ+1 ). We have already seen in
previous sections that in this case the B-splines are quite simple. From the support properties of B-splines
we know that the only linear B-splines that are nonzero on this interval are Bµ−1,1 and Bµ,1 and their
restriction to the interval can be given in vector form as
tµ+1 −x
x−tµ
Bµ−1,1 Bµ,1 =
.
(2.18)
tµ+1 −tµ tµ+1 −tµ
Example 2.16 (Matrix representation of quadratic B-splines). The matrices appear
when we come to quadratic splines. We consider the same nonempty knot interval [tµ , tµ+1 ); the only
48
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
nonzero quadratic B-splines on this interval are {Bj,2 }µ
j=µ−2 . By checking with Definition 2.1 we see that
for x in [tµ , tµ+1 ), the row vector of these B-splines may be written as the product of two simple matrices,
tµ+1 −x
 tµ+1 −tµ−1
Bµ,1 

0

Bµ−2,2 Bµ−1,2 Bµ,2 = Bµ−1,1
x−tµ−1
tµ+1 −tµ−1
tµ+2 −x
tµ+2 −tµ
0



x−tµ 
tµ+2 −tµ
(2.19)
tµ+1 −x
 tµ+1 −tµ−1
x−tµ

tµ+1 −tµ 
0

=
tµ+1 −x
tµ+1 −tµ
x−tµ−1
tµ+1 −tµ−1
tµ+2 −x
tµ+2 −tµ

0
x−tµ
tµ+2 −tµ

.

If these matrices are multiplied together the result would of course agree with that in Example 2.3. However,
the power of the matrix representation lies in the factorisation itself, as we will see in the next section. To
obtain the value of the B-splines we can multiply the matrices together, but this should be done numerically,
after values have been assigned to the variables. In practise this is only done implicitly, see the algorithms
in Section 2.4.
Example 2.17 (Matrix representation of cubic B-splines). In the cubic case the only
nonzero B-splines on [tµ , tµ+1 ) are {Bj,3 }µ
j=µ−3 . Again it can be checked with Definition 2.1 that for x in
this interval these B-splines may be written
Bµ−3,3 Bµ−2,3 Bµ−1,3 Bµ,3 = Bµ−2,2 Bµ−1,2 Bµ,2
 tµ+1 −x
 tµ+1 −tµ−2



0



0
x−tµ−2
tµ+1 −tµ−2
tµ+2 −x
tµ+2 −tµ−1
0
tµ+1 −x
 tµ+1 −tµ−1


0

=
tµ+1 −x
tµ+1 −tµ
x−tµ
tµ+1 −tµ
 tµ+1 −x
 tµ+1 −tµ−2



0



0
x−tµ−1
tµ+2 −tµ−1
tµ+3 −x
tµ+3 −tµ
x−tµ−1
tµ+1 −tµ−1
tµ+2 −x
tµ+2 −tµ
x−tµ−2
tµ+1 −tµ−2
tµ+2 −x
tµ+2 −tµ−1
0
0
0

0







x−tµ
tµ+3 −tµ

0


x−tµ 
tµ+2 −tµ
0
x−tµ−1
tµ+2 −tµ−1
tµ+3 −x
tµ+3 −tµ
0

0



.



x−tµ
tµ+3 −tµ
The generalisation of this matrix notation to B-splines of arbitrary degree is straightforward.
Theorem 2.18. Let t = (tj )n+d+1
be a knot vector for B-splines of degree d, and let µ
j=1
be an integer such that tµ < tµ+1 and d + 1 ≤ µ ≤ n. For each positive integer k with
2.3. A MATRIX REPRESENTATION OF B-SPLINES
k ≤ d define the matrix Rµk (x) = Rk (x) by

x−tµ+1−k
tµ+1 −x
0
 tµ+1 −tµ+1−k tµ+1 −tµ+1−k


x−tµ+2−k
tµ+2 −x

0

tµ+2 −tµ+2−k tµ+2 −tµ+2−k
Rk (x) = 

..
..
..

.
.
.


0
0
...
49
···
0
...
0
..
.
tµ+k −x
tµ+k −tµ
..
.
x−tµ
tµ+k −tµ






 . (2.20)




Then, for x in the interval [tµ , tµ+1 ), the d + 1 B-splines {Bj,d }µj=µ−d of degree d that are
nonzero on this interval can be written
B d = Bµ−d,d Bµ−d+1,d . . . Bµ,d = R1 (x)R2 (x) · · · Rd (x).
(2.21)
P
If f = j cj Bj,d is a spline in Sd,t , and x is restricted to the interval [tµ , tµ+1 ), then f (x)
is given by
f (x) = R1 (x)R2 (x) · · · Rd (x)cd ,
(2.22)
where the vector cd is given by cd = (cµ−d , cµ−d+1 , . . . , cµ )T . The matrix Rk is called a
B-spline matrix.
For d = 0 the usual convention of interpreting an empty product as 1 is assumed in
equations (2.21) and (2.22).
Theorem 2.18 shows how one polynomial piece of splines and B-splines are built up, by
multiplying and adding together (via matrix multiplications) certain linear polynomials.
This representation is only an alternative way to write the recurrence relation (2.1), but
the advantage is that all the recursive steps are captured in one equation. This will be
convenient for developing the theory of splines in Section 3.1.2. The factorisation (2.22)
will also be helpful for designing algorithms for computing f (x). This is the theme of
Section 2.4.
It should be emphasised that equation (2.21) is a representation of d + 1 polynomials,
namely the d + 1 polynomials that make up the d + 1 B-splines on the interval [tµ , tµ+1 ).
This equation can therefore be written
µ
µ
µ
(x) . . . Bµ,d
(x) = Rµ1 (x)Rµ2 (x) · · · Rµd (x),
Bµ−d,d
(x) Bµ−d+1,d
see Lemma 2.6.
Likewise, equation (2.22) gives a representation of the polynomial f µ that agrees with
the spline f on the interval [tµ , tµ+1 ),
f µ (x) = R1 (x)R2 (x) · · · Rd (x)cd .
Once µ has been fixed we may let x take values outside the interval [tµ , tµ+1 ) in both these
equations. In this way the B-spline pieces and the polynomial f µ can be evaluated at any
real number x. Figure 2.3 was produced in this way.
Example 2.19 (Matrix representation of a quadratic spline). In Example 2.9 we
considered the spline
s(x) = B2,2 (x) + B3,2 (x) − B4,2 (x) −
√
2B5,2 (x)
50
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
on the knot vector
t = (tj )8j=1 = (0, 0, 0, 1, 2, 3, 3, 3).
Let us use the matrix representation to determine this spline explicitly on each of the subintervals [0, 1],
[1, 2], and [2, 3]. If x ∈ [0, 1) then t3 ≤ x < t4 so s(x) is determined by (2.22) with µ = 3 and d = 2. To
determine the matrices R1 and R2 we use the knots
(tµ−1 , tµ , tµ+1 , tµ+2 ) = (0, 0, 1, 2)
and the coefficients
(cµ−2 , cµ−1 , cµ ) = (0, 1, 1).
Then equation (2.22) becomes
s(x) = 1 − x,
1−x
x
0
x
(2 − x)/2
 
0
0  
1 = x(2 − x)
x/2
1
If x ∈ [1, 2) then t4 ≤ x < t5 so s(x) is determined by (2.22) with µ = 4 and d = 2. To determine the
matrices R1 and R2 in this case we use the knots
(tµ−1 , tµ , tµ+1 , tµ+2 ) = (0, 1, 2, 3)
and the coefficients
(cµ−2 , cµ−1 , cµ ) = (1, 1, −1).
From this we find
1
2 − x,
s(x) =
2
2−x
x−1
0
x
3−x
 
1
0
 1  = 2x − x2 .
x−1
−1
For x ∈ [2, 3) we use µ = 5, and on this interval s(x) is given by


1
√
√ (3 − x)/2 (x − 1)/2
0
 −1  = 2 − x 6 − 2 2 − (2 − 2)x .
s(x) = 3 − x, x − 2
√
0
3−x
x−2
− 2
2.4
Algorithms for evaluating a spline
We originally introduced spline curves as the result of the geometric construction given
in Algorithm 1.3 in Chapter 1. In this section we will relate this algorithm to the matrix
representation of B-splines and develop an alternative algorithm for computing splines.
Recall from Theorem 2.18 that a spline f of degree d with knots t and B-spline coefficients c can be expressed as
f (x) = R1 (x) · · · Rd (x)cd
(2.23)
for any x in the interval [tµ , tµ+1 ). Here cd = (cµ−d , . . . , cµ ) denotes the B-spline coefficients
that are active on this interval. To compute f (x) from this representation we have two
options: We can accumulate the matrix products from left to right or from right to left.
If we start from the right, the computations are
ck−1 = Rk ck ,
for k = d, d − 1, . . . , 1.
(2.24)
Upon completion of this we have f (x) = c0 (note that c0 is a vector of dimension 1, i.e.,
a scalar). We see that this algorithm amounts to post-multiplying each matrix Rk by a
vector which in component form becomes
(Rk (x)ck )j =
tj+k −x
x−tj
ck,j−1 +
ck,j
tj+k −tj
tj+k −tj
(2.25)
2.4. ALGORITHMS FOR EVALUATING A SPLINE
51
B m-3,3
tm+
B m-2,2
tm+1
x
1-
tm+\ 1 -tm-2
x
x- t
m- 1
B m-1,1
tm+1
B m-2,3
tm+1 -tm-1
x
tm+2
x- t
x
m- 1
B m,0
B m-1,2
tm+1 -tm
tm+2
x- t
tm+2 -tm-1
x
x- t
m- 1
m
B m,1
B m-1,3
tm+2 -tm
tm+3
x- t
-x
m
B m,2
tm+3 -tm
x- t
m
B m,3
Figure 2.8. A triangular algorithm for computation of all the nonzero cubic B-splines at x.
for j = µ − k + 1, . . . , µ. This we immediately recognise as Algorithm 1.3.
The alternative algorithm accumulates the matrix products in (2.23) from left to right.
This is equivalent to building up the nonzero B-splines at x degree by degree until we
have all the nonzero B-splines of degree d, and then multiply with the corresponding Bspline coefficients and sum up. Building up the B-splines is accomplished by starting with
B 0 (x)T = 1 and then performing the multiplications
B k (x)T = B k−1 (x)T Rk (x),
k = 1, . . . , d.
The vector B d (x) will contain the value of the nonzero B-splines of degree d at x,
T
B d (x) = Bµ−d,d (x), . . . , Bµ,d (x) .
We can then multiply with the B-spline coefficients and add up. We see that this algorithm
amounts to pre-multiplying each matrix Rk by a row vector which in component form
becomes
(B k−1 (x))T Rk (x))j =
tj+1+k −x
x−tj
Bj,k−1 (x) +
Bj+1,k−1 (x)
tj+k −tj
tj+1+k −tj+1
(2.26)
for j = µ − k, . . . , µ. Here it should be noted that Bµ−k,k−1 (x) = Bµ+1,k−1 (x) = 0 when
x ∈ [tµ , tµ+1 ). For j = µ − k, the first term on the right in (2.26) is therefore zero, and
similarly, for j = µ, the last term in (2.26) is zero.
Algorithm 2.20 (L). Let the polynomial degree d, the 2d knots tµ−d+1 ≤ tµ < tµ+1 ≤
(0)
tµ+d , the B-spline coefficients cd = cd = (cj )µj=µ−d of a spline f , and a number x in
[tµ , tµ+1 ) be given. After evaluation of the products
ck−1 = Rk (x)ck ,
k = d, . . . , 1,
52
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
c m-3,3
tm+1
c m-2,2
tm+1
x
tm+1 -tm-2
x
x- t
m- 1
c m-\ 1,\ 1
tm+1
c m-2,3
tm+1 -tm-1
x
tm+2
x- t
x
m- 1
c m,0
c m-1,2
tm+1 -tm
tm+2
x- t
tm+2 -tm-1
x
x- t
m- 1
m
c m,\ 1
c m-1,3
tm+2 -tm
tm+3
x- t
-x
m
c m,2
tm+3 -tm
x- t
m
c m,3
Figure 2.9. A triangular algorithm for computing the value of a cubic spline with B-spline coefficients c at x ∈
[tµ , tµ+1 ).
the function value f (x) is given by
f (x) = c0 .
Algorithm 2.21 (R). Let the polynomial degree d, the knots tµ−d+1 ≤ tµ < tµ+1 ≤ tµ+d
and a number x in [tµ , tµ+1 ) be given and set B 0 = 1. After evaluation of the products
B k (x)T = B k−1 (x)T Rk (x),
k = 1, . . . , d,
the vector vBd (x) will contain the value of the d + 1 possibly nonzero B-splines at x,
T
B d (x) = Bµ−d,d (x), . . . , Bµ,d (x) .
These algorithms have a simple triangular structure, just like Algorithm 1.3, see figures 2.9–2.8. Figure 2.9 shows how the value of a cubic spline can be computed at a point
x, while Figure 2.8 shows the computation of all the nonzero B-splines at a point.
In Algorithms 2.20 and 2.21 it is assumed that there are 2d knots to the left and right
of x. This may not always be the case, especially near the ends of the knot vector, unless
it is d + 1-regular. Exercise 19 discusses evaluation in such a case.
Exercises for Chapter 2
2.1 Show that
B(x|0, 3, 4, 6) =
1
1
1 2
x B(x|0, 3) + (−7x2 + 48x − 72)B(x|3, 4) + (6 − x)2 B(x|4, 6).
12
12
6
2.2 Find the individual polynomial pieces of the following cubic B-splines and discuss
smoothness properties at knots
2.4. ALGORITHMS FOR EVALUATING A SPLINE
53
a) B(x|0, 0, 0, 0, 1) and B(x|0, 1, 1, 1, 1)
b) B(x|0, 1, 1, 1, 2)
2.3 Show that the B-spline Bj,d satisfies properties 1–3 of Lemma 2.6.
2.4 Show that Bj,d is a piecewise polynomial by establishing equation 2.14. Use induction
on the degree d.
2.5 In this exercise we are going to establish some properties of the Bernstein polynomials.
a) Prove the differentiation formula
Dbj,d (x) = d(bj−1,d−1 (x) − Bj,d−1 (x)).
b) Show that the Bernstein basis function bj,d (x) has a maximum at x = j/d, and
that this is the only maximum.
c) Show that
1
Z
Bj,d (x)dx = 1/(d + 1).
0
2.6
a) When a B-spline is evaluated at one of its knots can be simplified according to
the formula
B(ti |tj , . . . , tj+1+d ) = B(ti |tj , . . . , ti−1 , ti+1 , . . . , tj+1+d )
(2.27)
which is valid for i = j, j + 1, . . . , j + 1 + d. Prove this by induction on the
degree d.
b) Use the formula in (2.27) to compute the following values of a quadratic B-spline
at the interior knots:
Bj,2 (tj+1 ) =
tj+1 − tj
,
tj+2 − tj
Bj,2 (tj+2 ) =
tj+3 − tj+2
.
tj+3 − tj+1
c) Prove property (5) of Lemma 2.6.
2.7 Prove the following formula using (2.4) and (2.11)
d
z }| {
(x − a)d
(c − x)d
B(x|a,
b)
+
B(x|b, c).
B(x|a, b, . . . , b, c) =
(b − a)d
(c − b)d
Show that this function is continuous at all real numbers.
(2.28)
54
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
2.8 Prove the following formulas by induction on d.
d
d−1
z }| {
x − a X (c − x)i (b − x)d−1−i
B(x| a, . . . , a, b, c) =
B(x|a, b)
b−a
(c − a)i (b − a)d−1−i
i=0
+
(c − x)d
B(x|b, c),
(c − a)d−1 (c − b)
z }| {
B(x|a, b, c, . . . , c) =
(x − a)d
B(x|a, b)
(c − a)d−1 (b − a)
d
d−1
+
c − x X (x − a)i (x − b)d−1−i
B(x|b, c).
c−b
(c − a)i (c − b)d−i
i=0
2.9 When the knots are simple we can give explicit formulas for the B-splines.
a) Show by induction that if tj < · · · < tj+1+d then
Bj,d (x) = (tj+1+d − tj )
j+1+d
X
i=j
where
(x −
ti )d+
(x − ti )d+
Qj+1+d
k=j
k6=i
(tk − ti )
(
(x − ti )d , if x ≥ ti ;
=
0,
otherwise.
b) Show that Bj,d can also be written
Bj,d (x) = (tj+1+d − tj )
j+1+d
X
i=j
(ti − x)d+
Qj+1+d
k=j
k6=i
(ti − tk )
but now the (·)+ -function must be defined by
(
(ti − x)d , if ti > x;
(ti − x)d+ =
0,
otherwise.
2.10 Write down the matrix R3 (x) for µ = 4 in the case of uniform splines (tj = j for all
j). Do the same for the Bernstein basis (t = (0, 0, 0, 0, 1, 1, 1, 1)).
2.11 Given a knot vector t = (tj )n+d+1
and a real number x with x ∈ [t1 , tn+d+1 ), write
j=1
a procedure for determining the index µ such that tµ ≤ x < tµ+1 . A call to this
routine is always needed before Algorithms 2.20 and 2.21 are run. By letting µ be
an input parameter as well as an output parameter you can minimise the searching
for example during plotting when the routine is called with many values of x in the
same knot interval.
2.12 Implement Algorithm 2.21 in your favourite programming language.
2.4. ALGORITHMS FOR EVALUATING A SPLINE
55
2.13 Implement Algorithm 2.20 in your favourite programming language.
2.14 Count the number of operations (additions, multiplications, divisions) involved in
Algorithm 2.20.
2.15 Implement Algorithm 2.21 in your favourite programming language.
2.16 Count the number of operations (additions, multiplications, divisions) involved in
Algorithm 2.21.
2.17 Write a program that plots the cubic B-spline B(x|0, 1, 3, 5, 6) and its polynomial
pieces. Present the results as in Figure 2.3.
2.18
a) What is computed by Algorithm 2.20 if x does not belong to the interval
[tµ , tµ+1 )?
b) Repeat (b) for Algorithm 2.21.
2.19 Suppose that d = 3 and that the knot vector is given by
t̂ = (tj )5j=1 = (0, 1, 2, 3, 4).
With this knot vector we can only associate one cubic B-spline, namely B1,3 . Therefore, if we are to compute B1,3 (x) for some x in (0, 4), none of the algorithms of this
section apply. Define the augmented knot vector t by
t = (−1, −1, −1, −1, 0, 1, 2, 3, 4, 5, 5, 5, 5).
Explain how this knot vector can be exploited to compute B1,3 (x) by Algorithms 2.20
or 2.21.
56
CHAPTER 2. BASIC PROPERTIES OF SPLINES AND B-SPLINES
```