Solution (source code)

= Solution

Let $y$ be a stationary <function> and perturb it to $y_\varepsilon=y+\varepsilon\eta$, where $\eta$ is smooth and $\eta(a)=\eta(b)=0$. These perturbations preserve the prescribed endpoint values. Differentiate the <functional> at $\varepsilon=0$:
$$
\delta I=\left.\frac{dI[y_\varepsilon]}{d\varepsilon}\right|_{\varepsilon=0}=\int_a^b(F_y\eta+F_{y'}\eta')\,dx.
$$
By <integration by parts>,
$$
\delta I=[F_{y'}\eta]_a^b+\int_a^b\left(F_y-\frac d{dx}F_{y'}\right)\eta\,dx.
$$
The boundary term vanishes. The remaining <integral> must vanish for every such $\eta$, so the <fundamental lemma of the calculus of variations> gives the <Euler-Lagrange equation>
$$
\boxed{\frac{\partial F}{\partial y}-\frac d{dx}\left(\frac{\partial F}{\partial y'}\right)=0.}
$$
It is a necessary stationarity condition; deciding whether the stationary path is a minimum requires additional information.