with respect to controls.
This formula can be found with the help of adjoint equations. We now recall the appropriate formulation of adjoint equations in the considered case. The consistent terminal values of the adjoint variables \(\lambda _f(t_f)\)  and \(\lambda _g(t_f)\)  can be found by solving the following set of equations with respect to the variables \( \lambda _f(t_f), \lambda _g(t_f), \nu _1 \)  ([1]})
\(\phi _x^T(x(t_f)) + \lambda _f(t_f) & = & \nu _1 g_x^T(x(t_f))  \\0 & = & g_x(x(t_f))\lambda _f(t_f) \\0 & = & \left(g_x(x(t_f))\right)^{\prime }\lambda _f(t_f) -  \\& & g_x(x(t_f)) \left( f_F \right)_x^T(x(t_f),u(t_f))\lambda _f(t_f) -\nonumber \\& & g_x(x(t_f)) \left(g_x^T(x(t_f))z(t_f)\right)_x^T\lambda _f(t_f) + \nonumber \\& & g_x(x(t_f)) g_x^T(x(t_f)) \lambda _g (t_f) \nonumber \) 
