Solution (source code)

= Solution

Substitute the B-spline expansion $s=\sum_{j=1}^na_jM_j$ into $(M_i,s)=k!\gamma_i$. The coefficients solve
$$
\boxed{Ga=b},
$$
with the <Gram matrix> and right-hand side
$$
\boxed{G_{ij}=(M_i,M_j)=\int_a^bM_i(t)M_j(t)\,dt},
\qquad
\boxed{b_i=k!\gamma_i}.
$$
The linearly independent B-splines have a positive-definite Gram matrix, so this system has a unique coefficient vector.