Let $L \in C^2$ satisfy the strengthened Legendre condition $\partial_{y'y'} L > 0$ along an extremal $y$. Define $p(x) = \partial_{y'} L(x, y(x), y'(x))$ and $H(x, y, p) = py' - L$. Then $y$ satisfies the Euler–Lagrange equation if and only if the pair $(y, p)$ satisfies **Hamilton's canonical equations**:
\begin{align*}
\frac{dy}{dx} &= \frac{\partial H}{\partial p}(x, y, p), \\
\frac{dp}{dx} &= -\frac{\partial H}{\partial y}(x, y, p).
\end{align*}