Minimum roughness property of the natural cubic spline interpolant (source code)

= Minimum roughness property of the natural cubic spline interpolant
{title2=$J(\widetilde g)=J(g)+J(\widetilde g-g)$}

For $g=N\mathbf v$ and any $\widetilde g\in C^2[a,b]$ taking the same values at at least two distinct knots, $J(\widetilde g)=J(g)+J(\widetilde g-g)$. To prove it, set $r=\widetilde g-g$, integrate $g^{\prime\prime}r^{\prime\prime}$ by parts on each <polynomial> interval and use $g^{(4)}=0$, $r(x_i)=0$, <continuous> $g^{\prime\prime}$ and linear exterior pieces. Boundary terms cancel. Expanding the square proves the identity. Equality forces $r^{\prime\prime}=0$, so $r$ is an <affine function> and its two prescribed zeros make it identically zero.