Why Boundary Curvature Matters
A cubic polynomial can bend, but its curvature is especially simple: its second derivative is a line. This makes it possible to control how a cubic spline behaves at the edges of its range. In a natural cubic spline, the curvature is constrained to be zero at the boundary knots. With a linear continuation beyond those knots, that condition allows the spline to join the continuation smoothly.
The essential distinction is between curvature being zero at a boundary point and curvature being zero throughout an interval. The first is a boundary constraint. The second forces the spline to be linear on that interval. Keeping these statements separate explains both the natural boundary conditions and what they do not imply.
Here \(s(x)\) denotes the spline function, and \(s''(x)\) its second derivative, which describes curvature. The boundary knots \(a\) and \(b\) mark the ends of the interval on which the spline is modeled. Between those endpoints, a natural cubic spline may still curve, including close to either boundary.
Why Zero Curvature Throughout an Interval Means Linear
On any one spline segment, write the cubic polynomial in a coordinate measured from a point \(c\) in that segment:
Differentiating twice gives the curvature function on that segment:
If \(q''(x)=0\) at every point of an interval, this linear function must be zero throughout that interval. Its constant and linear coefficients must therefore both be zero: \(2C=0\) and \(6D=0\). Thus \(C=D=0\), leaving \(q(x)=A+B(x-c)\), which is linear. Equivalently, integrating \(q''(x)=0\) once gives a constant first derivative, and integrating again gives a line.
Worked Example: Checking Curvature on an Exterior Segment
Suppose a spline’s polynomial on an exterior interval is \(q(x)=5+2x+3x^2-0.5x^3\). Determine whether this segment is linear, and whether its curvature is zero at \(x=0\).
Differentiate twice:
The second derivative is not identically zero on the interval, so the segment is not linear. At \(x=0\), however, \(q''(0)=6\), which is not zero. To illustrate the distinction between a zero at one point and zero throughout, consider instead \(r(x)=1+4x+x^3\). Then \(r''(x)=6x\), so \(r''(0)=0\) while \(r''(x)\ne0\) for \(x\ne0\). That cubic has zero curvature at the boundary point \(0\), but it is not linear near that point.
How Natural Boundary Constraints Support Linear Tails
A natural cubic spline is usually defined on the interval from its left boundary knot \(a\) to its right boundary knot \(b\). To continue it to the left, take the line through its value and slope at \(a\); to continue it to the right, take the line through its value and slope at \(b\). For example, the right continuation is
This continuation has constant slope \(s'(b)\), so its second derivative is zero. At \(b\), it agrees with the spline’s value and first derivative by construction. Its second derivative, zero, also agrees with \(s''(b)=0\). Thus the natural boundary constraint makes the join continuous through the second derivative. The corresponding left continuation is \(L_a(x)=s(a)+s'(a)(x-a)\) for \(x\le a\), with the same matching property.
The constraint \(s''(b)=0\) does not by itself specify what a function must do at every \(x>b\). The linear tail results when the spline is continued by the boundary tangent line, or when the spline is defined to have zero curvature throughout that exterior region. If an arbitrary cubic were instead allowed beyond \(b\), it could have \(s''(b)=0\) and still curve for \(x>b\). The boundary constraint is what permits the usual linear continuation to join smoothly; it is not a claim that the spline has no curvature on the last interior segment.
Worked Example: A Natural Spline That Curves Inside and Is Linear Outside
Consider a piecewise cubic on \([0,2]\), with an interior knot at \(1\). Define it by
On the first piece, \(s'(x)=1+x^2\) and \(s''(x)=2x\). On the second piece, \(s'(x)=4x-x^2-1\) and \(s''(x)=4-2x\). At the interior knot \(x=1\), both pieces give \(s(1)=4/3\), \(s'(1)=2\), and \(s''(1)=2\). The function and its first two derivatives therefore match there, as required for a twice continuously differentiable cubic spline.
At the boundaries, \(s''(0)=0\) and \(s''(2)=0\), so the natural boundary conditions hold. The left endpoint value and slope are \(s(0)=0\) and \(s'(0)=1\), giving the left linear continuation \(L_0(x)=x\). At the right endpoint, \(s(2)=4\) and \(s'(2)=3\), giving \(L_2(x)=4+3(x-2)\). Each continuation has second derivative zero and matches the spline’s value and slope at its join.
The interior is not linear: for example, \(s''(1)=2\). This example shows what the boundary conditions accomplish without implying that the spline is straight throughout its interior.
A Coefficient View of the Linear-Tail Constraints
The same result can be seen in a truncated power representation. For ordered knots \(\kappa_1<\cdots<\kappa_m\), consider a function of the form
The term \((x-\kappa_j)_+^3\) is zero for \(x\le\kappa_j\), and equals \((x-\kappa_j)^3\) for \(x>\kappa_j\). To the left of all knots, every truncated term is zero, so the function is already linear there. To the right of all knots, differentiating twice gives
This expression is zero for every \(x\) to the right of all knots exactly when the coefficient of \(x\) and the constant term are both zero. The two constraints are
Under these constraints the right-hand segment has zero second derivative throughout, and so is linear. This gives an algebraic way to impose linear behavior on both tails in this representation. It also shows why two restrictions are involved: the curvature expression on the right is itself a line, and both its slope and its intercept must vanish.
Worked Example: Verifying a Linear Right Tail From Coefficients
Take knots \(\kappa_1=0\), \(\kappa_2=1\), and \(\kappa_3=2\), with \(\gamma_1=1\), \(\gamma_2=-2\), and \(\gamma_3=1\). Check whether the truncated terms produce a linear right tail.
First check the two constraints:
For \(x>2\), all three truncated terms are active. Expanding their sum gives
The cubic and quadratic terms cancel, leaving a line. Including the baseline \(\beta_0+\beta_1x\), the right tail is \(\beta_0-6+(\beta_1+6)x\), which is still linear. The constraints remove curvature on the right; they do not require the tail’s slope to be zero.
What the Boundary Condition Does Not Say
A natural spline’s final interior piece is still a cubic polynomial. Its second derivative on that piece is a line that reaches zero at the right boundary. Unless that second derivative is zero at every point of the piece, the piece is curved somewhere before it reaches the boundary. The same reasoning applies at the left boundary.
This is why it is important to distinguish three statements:
- Zero curvature at the boundary: \(s''(a)=0\) or \(s''(b)=0\), the natural boundary condition.
- Zero curvature across an interval: \(s''(x)=0\) for every \(x\) in that interval, which makes the cubic segment linear there.
- Linear continuation: extending the boundary value and slope with a straight line outside the modeled interval; its zero curvature matches the natural condition at the join.
The distinction matters when describing or constructing a natural spline: an endpoint constraint controls curvature at a point, while a linear tail is a property of the chosen continuation (or an imposed zero-curvature condition across the tail).
Common Mistake
Incorrect reasoning: “A natural spline has \(s''(b)=0\), so its last interior cubic segment must be linear.”
Correction: A single value \(s''(b)=0\) does not establish that \(s''(x)=0\) throughout the last segment. A cubic’s second derivative is linear and can cross zero at \(b\) while being nonzero elsewhere. To conclude that a segment is linear, show that its second derivative is zero throughout that interval. For a natural spline’s exterior continuation, the straight line is chosen to match the boundary value and slope, and the boundary curvature condition ensures a smooth second-derivative join.
Check Your Understanding
Use the definitions and results above to answer these questions.
- For \(q(x)=2+3x+4x^2+x^3\), find \(q''(x)\). Is \(q\) linear on any interval where \(q''\) is not identically zero?
- Why does \(s''(b)=0\) alone not imply that the last interior cubic segment is linear?
- A spline reaches a right boundary with value \(7\), slope \(-2\), and second derivative \(0\). Write its usual linear continuation for \(x\ge b\).
- In the truncated power representation, what two coefficient sums must vanish for the right tail to have zero curvature throughout?
- Explain how a linear continuation can match a natural spline through the second derivative at a boundary knot.