Solution (source code)

= Solution

Consider a competing interpolant $f$ and set $h=f-g$. At each <spline knot>, $h(x_i)=0$. If its <second derivative roughness penalty> is infinite there is nothing to prove, so assume $f''\in L^2$. Its absolutely continuous first derivative makes $h'$ absolutely continuous as well, with $h''$ defined almost everywhere.

On each knot interval the <natural cubic spline> has constant third derivative. Integrating by parts once gives
$$
\int_{x_i}^{x_{i+1}}g''h''
=[g''h']_{x_i}^{x_{i+1}}-g^{(3)}|_{(x_i,x_{i+1})}\,[h]_{x_i}^{x_{i+1}}.
$$
The last term vanishes because $h$ is zero at both endpoints. Summing over intervals cancels the interior boundary terms, since $g''$ and $h'$ are continuous at the knots. The exterior terms vanish because $g''(x_1)=g''(x_n)=0$. Hence $\int g''h''=0$. Expanding the square now gives
$$
\boxed{\alpha\int_{x_1}^{x_n}(f'')^2
=\alpha\int_{x_1}^{x_n}(g'')^2
+\alpha\int_{x_1}^{x_n}(h'')^2
\ \geq\alpha\int_{x_1}^{x_n}(g'')^2.}
$$
Since $\alpha>0$, equality requires $h''=0$ almost everywhere. Absolute continuity then makes $h$ affine. It has at least two distinct zeros because $n\geq2$, so $h=0$. \b[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.