# how to obtain Euler equation for smoothing spline minimization problem?

The question might be trivial, but I don't understand why this minimization problem in Sobolev space $$\min_{g}\int_{0}^{1}\left\{ f(x)-g(x)\right\}^{2} dx+\lambda\int_{0}^{1}\left\{ g^{(q)}(x)\right\} ^{2}dx$$ is equivalent to Euler equation

$$g(x)+\lambda (-1)^{q}g^{(2q)}(x)= f(x)$$ $$g^{(j)}(0)=g^{(j)}(1)=0,\ j=q,\ldots 2q-1.$$

-

If you define the functional $$F\big(x,g(x),g^{(q)}(x)\big) = \int_0^1 \{f(x)-g(x)\}dx + \lambda \int_0^1 \{g^{(q)}(x)\}^2 dx$$ and take test functions $h$ in the same space as the functions $g$, then \begin{multline} F\big(x,g + h, (g + h)^{(q)}\big) - F\big(x,g,g^{(q)}\big) = \\ \int_0^1\{f(x)- g(x) - h(x)\}dx + \lambda \int_0^1 \{g^{(q)}(x) + h^{(q)}(x)\}^2 dx \\ -\int_0^1\{f(x)- g(x)\}dx - \lambda \int_0^1 \{g^{(q)}(x)\}^2 dx, \end{multline} and then, the Frechet derivative is $$D F \cdot h = 2 \lambda \int_0^1 g^{(q)}(x) h^{(q)}(x) dx - \int_0^1 h(x) dx$$ which leads me to believe you've missed a square in the first term, i.e. $$F\big(x,g(x),g^{(q)}(x)\big) = \int_0^1 \{f(x)-g(x)\}^\color{red}{2}dx + \lambda \int_0^1 \{g^{(q)}(x)\}^2 dx$$ That being the case, the correct Frechet derivative is $$D F \cdot h = 2 \lambda \int_0^1 g^{(q)}(x) h^{(q)}(x) dx - 2 \int_0^1 \{f(x) - g(x)\}h(x) dx$$ Integrating the first term by parts \begin{multline} D F \cdot h = 2 \lambda g^{(q)}(x) h^{(q)}(x) \Big|_0^1 \\- 2 \lambda \int_0^1 g^{(q+1)}(x) h^{(q-1)}(x) dx - 2 \int_0^1 \{f(x) - g(x)\}h(x) dx \end{multline} and so on, after $q-1$ integrations \begin{multline} D F \cdot h = 2 \lambda g^{(q)}(x) h^{(q)}(x) \Big|_0^1 - 2 \lambda g^{(q+1)}(x) h^{(q-1)}(x)\Big|_0^1 + \ldots \\ + 2 \int_0^1 \big\{\lambda (-1)^q g^{(2q)}(x) + g(x) - f(x)\big\}h(x) dx \end{multline} In order for the functional $F$ to have a critical point, the Frechet derivative $D F \cdot h = 0$ for all $h$ in the space, which leads to the Euler-Lagrange equation $$g(x) + \lambda (-1)^q g^{(2q)}(x) = f(x)$$ with boundary conditions $$g^{(j)}(0) = g^{(j)}(1) = 0,\quad j=q,\ldots,2q-1.$$