There exist an -vector function of adjoint or costate variables and a multiplier function . With the Hamiltonian
the necessary first order conditions of optimality result in a multi-point boundary value problem
The original boundary constraints (3) and
at , , and also have to
In general, at junction points , ,
the adjoint variables may have discontinuities.
For more details cf. Bryson, Ho  and Hestenes  and also
Jacobson, Lele, Speyer ,
and the results of
Maurer cited in Bulirsch, Montrone, Pesch 
for the necessary conditions of optimality in the constrained case.
In the sequel, we shall see that the necessary first order optimality conditions of the continuous problem are reflected in the necessary first order optimality conditions of the discretized problem.