The validity of the Euler–Lagrange equation for solutions to variational problems