to efficiently compute the value function gradient with respect to switching times.

Using the SLQ algorithm to calculate the optimal control law for the continuous inputs has two major advantages. First, as discussed by [@sideris10], this algorithm has a linear time complexity with respect to the optimization time horizon in contrast to many standard discretization-based algorithms which scale cubically (such as the direct collocation methods). Second, since in each iteration of SLQ, an LQ problem is optimized, we can efficiently calculate the value function derivatives by obtaining derivatives of an LQ subproblem’s value function. However, in contrast to a regular time-variant LQ problem in which the system dynamics and the cost function are independent of the switching times, in this problem the cost and the system dynamics of the approximated LQ subproblem are functions of the switching times. Therefore, in order to calculate the cost function gradient, we should also consider the LQ subproblem variations to the switching times. We tackle this problem more rigorously in Theorem 1.

Here, we first briefly introduce the SLQ algorithm. We consider an intermediate iteration of the algorithm. We assume that $\{\bar{\vx}(z)\}_{z= 0}^{I}$ and $\{\bar{\vu}(z)\}_{z= 0}^{I}$ are the nominal state and input trajectories which 