A study showing that the functional equation technique of dynamic programming yields formal derivations of such classical necessary conditions of the calculus of variations as the Euler-Lagrange equations, the Weierstrass and Legendre conditions, natural boundary conditions, a transversality condition, and the Erdmann corner conditions. The more general "problem of Bolza"-in which the final time is defined implicitly and in which the expression to be extremized is the sum of an integral, and a function evaluated at the end point-is also considered. The principal necessary condition, usually called the "multiplier rule," is deduced. Necessary conditions are derived for the case in which the decision variables are restricted by inequality constraints. Finally, it is shown that the functional equation characterization readily yields the Hamilton-Jacobi partial differential equation of classical mechanics.