Quadratic smoothing spline for interval averages (source code)

= Quadratic smoothing spline for interval averages
{title2=$\sum_i(Y_i-L_i g)^2+\lambda\int_a^b(g')^2$}

Let $L_i g$ be the average of $g$ on successive knot intervals. Minimizing the displayed loss over $C^1[a,b]$ gives a <quadratic spline> with constant tails outside the first and last knots. To prove the reduction, choose the unique constant-tail quadratic spline $q$ with the same interval averages as a candidate $g$, and put $v=g-q$. Since $q''$ is constant on every knot interval, $q'$ is continuous and vanishes on both tails, <integration by parts> gives $\int q'v'=-\sum_iq''|_{I_i}\int_{I_i}v=0$. Consequently the data loss is unchanged and $\int(g')^2=\int(q')^2+\int(v')^2$. The penalty decreases strictly unless $v$ is constant; its zero interval averages then force $v=0$. The finite-dimensional quadratic optimization on this spline space also gives a unique minimizer because the interval-average map is injective.