order of differentiation with respect to time, $z$, and $t_j$ has been changed. For calculating $\partial_{t_j}\!\vW$, $\partial_{t_j}\!\vw$, and $\partial_{t_j}\!w$, we need to calculate the derivative of the linearized dynamics and the quadratic approximation of the cost function with respect to switching time $t_j$ as well. To do so, we need to examine the impact of $t_j$ variation on the system dynamics and cost function of the approximated LQ subproblem.

In each approximated LQ subproblem, we use a quadratic approximation of the cost function components $L$ and $\Phi$ around the nominal trajectories $\bar{\vx}(z)$ and $\bar{\vu}(z)$ of the equivalent system . We can readily derive the differential equation which determines the sensitivity of the state trajectory with respect to switching time $t_j$ by differentiating both side of the equivalent systems dynamics in with respect to $t_j$. $$\partial_{t_j} \frac{d \bar{\vx}}{dz} = ( \delta_{i,j} - \delta_{i-1,j} ) \vf_i(\bar{\vx},\bar{\vu}) \notag + (t_{i}-t_{i-1}) \left( \vA_i \partial_{t_j}\!\bar{\vx} + \vB_i \partial_{t_j}\!\bar{\vu} \right).$$ For simplicity in notation, we drop this dependencies on time, $z$. Using the continuity condition of the state trajectory, the order of derivatives on the right hand side of the equation is changed which is resulted in . Furthermore, since the control input trajectory in SLQ 