For at least two distinct knots and values , the unique natural cubic spline matching those values and linear beyond . Its interpolation map is a linear map by uniqueness. Over a larger domain , the two exterior pieces remain linear. With only one knot, arbitrary slopes of affine functions make uniqueness false.
With the convention that the residual term is a sum rather than an average, the penalised least squares criterion is
Minimize over functions whose first derivative is absolutely continuous and whose second derivative is square-integrable, that is, the usual Sobolev space . The cubic smoothing spline is its minimizer, with natural boundary conditions and linear continuation outside the data range. It is a natural cubic spline with possible knots at the observed , but usually does not interpolate the noisy .
To see why the minimizer is a natural spline, for any take the natural cubic spline interpolant through its values and write . Then . Integrating by parts on every knot interval twice gives zero: the terms involving vanish at knots, the terms involving cancel because is continuous there, and the outer terms vanish by the natural boundary conditions. Hence
while their residual sums of squares agree. Replacing by never increases the criterion. This proves the minimum roughness property of the natural cubic spline interpolant needed here.
For fitted values , write , where is positive semidefinite and has the sampled affine functions as its two-dimensional nullspace. The finite-dimensional minimization becomes . Its strictly positive definite Hessian is , so it has the unique solution
This is the roughness-matrix formula for a natural cubic smoothing spline. Larger penalizes curvature more strongly. As the fit approaches interpolation; as it approaches the ordinary least-squares affine line.
A cubic spline belongs to and is a polynomial of degree at most three on each interval separated by the spline knots. A natural cubic spline is additionally an affine function on the exterior intervals and . On this is equivalent to the endpoint conditions ; these conditions remain part of the definition when an outer knot coincides with or .
Let be the natural cubic spline interpolant of the prescribed values, and let be any other interpolating function. Set , so . On the interval , integration by parts twice gives
because the fourth derivative of each cubic piece is zero. The second boundary term is zero because vanishes at the spline knots. After summing the first terms, the interior contributions cancel by continuity of and , and the two remaining terms vanish by the natural endpoint conditions. On the exterior intervals . Thus , and the second derivative roughness penalty satisfies
If equality holds, the continuous nonnegative function has zero integral, so everywhere. Hence is an affine function, and its zeros at two distinct spline knots force . This proves the minimum roughness property of the natural cubic spline interpolant and its equality case: the unique minimum-roughness interpolant is .
For the fixed-design nonparametric regression fit, use the penalized least squares criterion
Let be the natural cubic spline interpolant with value vector . Replacing by for leaves the residual sum unchanged and reduces the second derivative roughness penalty, strictly unless . It therefore remains to minimize the finite-dimensional quadratic form
The supplied spline roughness penalty matrix is positive semidefinite. For every nonzero vector ,
Consequently is a positive-definite matrix, and is strictly convex. Its normal equations for linear least squares have the unique solution
The preceding strict reduction also proves uniqueness over the whole class , not just over the natural cubic splines. This is the cubic smoothing spline. If the residual criterion is divided by instead, the corresponding formula is , reflecting a change in the numerical convention for the smoothing parameter.
The independence and specified error mean and variance are not needed for existence or uniqueness of this minimizer. They do imply, with smoothing matrix and , that and . The null space of consists of sampled affine functions: these have zero roughness, and conversely zero roughness forces their natural cubic spline interpolant to be an affine function. Thus these functions are reproduced without bias of an estimator, while other components are smoothed.
For ordinary homoscedastic fixed-design nonparametric regression, take observations at known distinct sites, with independent mean-zero errors of common variance. A degree- local polynomial estimator at a target solves the finite-dimensional weighted least squares problem
Here is a nonnegative regression kernel, is the smoothing bandwidth, and sufficient local design rank ensures uniqueness. The estimate of the regression function is . Each target has its own locally fitted polynomial; this is not one global polynomial fit. The bandwidth controls the localization and the bias-variance tradeoff.
A natural cubic smoothing spline instead solves the global penalized problem
The Sobolev space here consists of functions with square-integrable weak derivatives through order two. The minimizer is a natural cubic spline with knots at the observation sites and linear tails outside the extreme sites. Equivalently one may perform the minimization on that finite-dimensional spline space: the minimum roughness property of the natural cubic spline interpolant shows that replacing a candidate by the natural spline with the same site values preserves the data loss and decreases the second-derivative penalty. The smoothing parameter controls curvature; it differs from the local bandwidth .
For the interval-average observation problem, the printed upper limit in the loss is an indexing error: there are only responses and intervals, so a term with would involve the undefined and . The coherent loss uses the upper limit . Put and define the linear observation functionals
The intended criterion on is therefore
Unlike the ordinary cubic smoothing spline, this uses interval averages as data and a first-derivative penalty; the resulting spline degree will be two.
Fix any candidate . By the supplied interpolation property, there is a unique quadratic spline with knots , constant on both exterior intervals, such that for every . Put . Then
On each interior knot interval is a constant , and on the two exterior intervals . Integrate by parts separately on the intervals. At every knot the boundary contributions cancel because both and are continuous; the contributions at and vanish because is zero there. Thus
This orthogonality is the key to the quadratic smoothing spline for interval averages. Expanding the roughness penalty gives
The data-fit terms are equal because the interval averages are equal. Consequently,
Equality can occur only if everywhere: the derivative is continuous and its squared integral is zero. Then is constant, and any of its zero interval averages forces that constant to be zero. Therefore every minimizer must equal its matching quadratic spline .
We conclude that the minimizer is a continuously differentiable quadratic spline with knots at the specified sites and constant tails on both exterior intervals. Existence and uniqueness also follow from the supplied interpolation property. The interval-average map identifies the finite-dimensional space of these quadratic splines with , and the criterion becomes a strictly convex quadratic function of that average vector: its data-fit term is , while its penalty is nonnegative and quadratic. It has a unique minimizer, and the strict equality argument above proves uniqueness in the full function class.
Consider a competing interpolant and set . At each spline knot, . If its second derivative roughness penalty is infinite there is nothing to prove, so assume . Its absolutely continuous first derivative makes absolutely continuous as well, with defined almost everywhere.
On each knot interval the natural cubic spline has constant third derivative. Integrating by parts once gives
The last term vanishes because is zero at both endpoints. Summing over intervals cancels the interior boundary terms, since and are continuous at the knots. The exterior terms vanish because . Hence . Expanding the square now gives
Since , equality requires almost everywhere. Absolute continuity then makes affine. It has at least two distinct zeros because , so . The natural cubic spline is the unique minimizer. This proves the minimum roughness property with absolutely continuous first derivatives, covering the weaker regularity in the question rather than assuming competitors are twice continuously differentiable. The case of two knots is included: the minimizing spline is their straight-line interpolant.
Assume initially that the design points are distinct and ordered on . The cubic smoothing spline minimizes
over functions with an absolutely continuous first derivative and square-integrable second derivative. Dividing the residual term by simply changes the scaling assigned to . The minimum roughness property of the natural cubic spline interpolant reduces the problem to natural cubic splines with knots at the design points: among functions with any prescribed fitted values, that interpolant has the smallest integrated squared curvature. The minimizer is therefore a natural cubic smoothing spline, with natural second-derivative boundary conditions and linear tails when extended.
Choose a full basis for this natural-spline space. Put and . Writing changes the objective to
Differentiation gives . Although the curvature penalty has an affine nullspace, the full basis at distinct design points makes the combined matrix positive definite. Hence
Equivalently, use the cardinal basis that interpolates the observations, making and . These are smoothing matrices, symmetric but generally not idempotent. Their effective degrees of freedom are . As the fit interpolates; as it approaches ordinary least squares on the affine functions. With replicated predictors, use a design matrix for distinct knots and observation weights; the basis form remains valid when identifiable.
Useful choices include Leave-one-out cross-validation, generalized cross-validation, and estimation of smoothness by restricted maximum likelihood through a mixed-model representation. For fixed , the leave-one-out residual identity for a linear smoother gives
Minimize these over a suitable range. Choose smoothing by predictive performance or a variance-component likelihood, not by arbitrarily forcing a visually appealing curve.
With distinct knots , a natural cubic spline is a function on the real line, cubic on each interval between consecutive knots and affine outside the two outer knots. The latter condition gives .
There are coefficients for the interior cubic pieces. Matching values and the first two derivatives at the interior knots imposes independent constraints, and the two natural endpoint conditions impose two more. The affine continuations are then determined by endpoint values and slopes. The dimension of a vector space is therefore
One explicit basis uses and for , where
The cubic and quadratic terms cancel in each difference above , making it affine there; below the truncated powers vanish. The changes in third derivative at individual knots show independence of these basis functions. This count uses the linear independence of the spline constraints and counts the listed outer knots as boundary knots. If a convention instead lists interior knots and two additional boundaries, the dimension is . With only one listed knot and linearity on both sides, the condition forces a globally affine function, so the exceptional dimension is two.
Choose knots independently of the eventual validation responses, and let be a natural cubic spline basis as in part (a). A regression spline writes . Define the design matrix . Under the stated normal linear model, maximum likelihood estimation for is the same as ordinary least squares:
Differentiation gives the normal equations . If the design has full column rank,
If it does not, a Moore-Penrose inverse gives the fitted values, but not every coefficient or off-sample prediction is identifiable. Merely choosing distinct knots does not guarantee full rank for an arbitrary set of observed predictor values.
More knots allow greater curvature and reduce approximation bias at the cost of larger estimation variance. Too many or poorly located knots can cause unstable fits. Equally spaced knots are simple; empirical predictor quantiles put more flexibility where observations are dense; subject knowledge can concentrate knots near likely changes. Both the number and positions can be compared using cross-validation or an appropriate penalized model-selection criterion. Adaptive knot selection must be included within validation, since treating a data-selected basis as prespecified understates its flexibility. Boundary knots should cover the region where inference is intended, and natural linear tails do not by themselves justify far-out extrapolation.
For , minimize the smoothing spline objective over the Sobolev space of functions with square-integrable second derivative on the observed interval:
The roughness penalty measures curvature; its null space consists of affine functions. To see why the minimizer is a natural cubic spline, let be the natural spline interpolating the values of any competitor at its distinct observation locations, and put . Integration by parts twice on each knot interval gives : on each interval, vanishes at the knots, is continuous, and vanishes at the outer endpoints. Hence
while both functions have the same residual sum of squares. This proves the reduction to a finite-dimensional spline space.
For distinct and , use its -dimensional basis, write , and define the positive semidefinite matrix
The penalized least squares problem is , so
Use linear continuation outside the observation interval. The fitted-value matrix is ; its trace gives the effective degrees of freedom. As decreases to zero, the natural spline approaches interpolation, with trace ; as it grows without bound, the fit approaches ordinary least squares on , with trace two. For the criterion alone does not determine values between observations; the natural interpolant is the limiting convention. Repeated observation locations are combined by using distinct knots and their multiplicities as weights, rather than pretending the spline design has independent interpolation values.
Use the natural cubic spline convention appropriate to the interior design knots: the spline is linear on and . We also need . These points will be important for uniqueness.
A cubic spline is a function in whose restriction to each of , , through is a polynomial of degree at most three. A spline knot is a junction between consecutive pieces. For a natural cubic spline, the two exterior pieces are affine functions; equivalently, one uses the natural endpoint conditions on the spline over and then extends linearly with matching derivatives. Merely prescribing on otherwise arbitrary exterior cubic pieces is a different condition and does not provide the unique interpolant invoked in this question.
The natural cubic spline interpolant to values is the natural cubic spline satisfying . Its existence and uniqueness for are the interpolant fact allowed in the PDF. The interpolation map is a linear map: a linear combination of interpolants satisfies the same spline, boundary and value conditions, so uniqueness identifies it with the interpolant to the corresponding linear combination of value vectors.
Let , let have the same values, and put . Then . We prove the orthogonality
Apply integration by parts twice on each polynomial interval. On an interior interval, , and
The terms vanish because vanishes at the knots. The terms cancel at internal knots because and are continuous, and vanish at because is zero there. On the exterior intervals, identically. Summing therefore gives the claimed orthogonality without assuming that is continuous across knots.
Expanding the square now gives the minimum roughness property of the natural cubic spline interpolant
Equality forces everywhere, since is continuous. Thus is an affine function. It vanishes at two distinct design points, so , proving equality if and only if .
For the penalized fit, take the allowed spline roughness penalty matrix to be a symmetric matrix with ; thus it is a positive semidefinite matrix. If its supplied representative were not symmetric, its symmetric part defines the same quadratic form and is all that is needed. For any , let . Replacing it by preserves every fitted value and can only decrease the second derivative roughness penalty. Therefore it is enough to minimize
over . The matrix is a positive-definite matrix, since
Completing the quadratic or differentiating gives the unique solution
This is the cubic smoothing spline. More explicitly, the normal equations are , and
For an arbitrary function with fitted vector , the earlier orthogonality also gives
Both terms are nonnegative. Equality forces and, by the proved interpolation equality case, . This proves both existence in and uniqueness over the entire stated function class, not just over splines.
The argument is deterministic for each observed . The fixed-design nonparametric regression and homoscedasticity assumptions motivate the squared-error loss, but Gaussian errors are not required.
At least two distinct design points are required for uniqueness. Question 4 does not explicitly restate , and this hypothesis is necessary. With one design point, every function has zero residual and zero second derivative roughness penalty, for any real . Thus the printed unrestricted uniqueness conclusion would be false for . The corrected theorem assumes at least two distinct knots and the stated linear-tail convention. At , uniqueness over all of also fails; the stipulated eliminates that degeneracy.
A cubic spline with knots is twice continuously differentiable and restricts to a polynomial of degree at most three between consecutive knots. It is a natural cubic spline when it is linear outside , equivalently when its second derivative vanishes at the two outer knots and on the exterior intervals.
Let be the natural cubic spline interpolating prescribed values and let be any other interpolant in . Then . Piecewise integration by parts, using that between knots, is continuous, on the exterior intervals, and every jump of is multiplied by , gives
Consequently
Equality forces almost everywhere. Then is affine and its zeros at at least two distinct knots force , proving uniqueness.
For the penalized problem, fix a vector of fitted values. The preceding variational result says that its natural spline interpolant has the least roughness among all functions taking those values, and by assumption that roughness is . The infinite-dimensional problem therefore reduces to
Because is positive semidefinite, is positive definite. The unique fitted-value vector is
and is its unique natural cubic spline interpolant.
For Leave-one-out cross-validation, let minimize
and define
If , its normal equations say
Thus , where
Taking the th coordinate and writing gives
Therefore one spline fit and the diagonal of its smoothing matrix give