comprises a time-varying feedforward term and a time-varying linear state feedback, its sensitivity can be calculated as . Moreover, for the initial condition of this equation we have $\partial_{t_j}\bar{\vx}(z=0) = \mathbf{0}$ due to the fixed initial state. Based on Lemma 1, the second order approximation of the intermediate cost $L(\vx,\vu)$ around the nominal trajectories (which are in turn a function of $t_j$) can be written as $$\begin{aligned}
& L(z,\bar{\vx}(s)+\delta\!\vx,\bar{\vu}(s)+\delta\!\vu) \simeq 
q(z) +
\begin{bmatrix} \vq(z) \\ \vr(z) \end{bmatrix}^\top 
\begin{bmatrix} \partial_{t_j}\vx(z) \\ \partial_{t_j}\vu(z) \end{bmatrix} (t_j-\bar{t}_j)
\notag  \\
& \hspace{2mm} 
+\begin{bmatrix} \delta\!\vx \\ \delta\!\vu \end{bmatrix}^\top\! 
\left(
\begin{bmatrix} \vq(z) \\ \vr(z) \end{bmatrix} +
\begin{bmatrix} \vQ(z) & \vP(z) \\ \vP(z)^\top & \vR(z) \end{bmatrix}
\begin{bmatrix} \partial_{t_j}\vx(z) \\ \partial_{t_j}\vu(z) \end{bmatrix} 
(t_j-\bar{t}_j) \right) \notag \\
& \hspace{2mm} 
+\frac{1}{2}
\begin{bmatrix} \delta\!\vx \\ \delta\!\vu \end{bmatrix}^\top\!\! 
\begin{bmatrix} \vQ(z) & \vP(z) \\ \vP(z)^\top & \vR(z) \end{bmatrix}
\begin{bmatrix} \delta\!\vx \\ \delta\!\vu \end{bmatrix}
+ \frac{(t_j-\bar{t}_j)^2}{2}
\begin{bmatrix} \vq(z) \\ \vr(z) \end{bmatrix}^\top\! 
\begin{bmatrix} \partial_{t_j}^2\vx(z) \\ \partial_{t_j}^2\vu(z) \end{bmatrix}
\notag \\  
& \hspace{2mm} 
+ \frac{(t_j-\bar{t}_j)^2}{2}
\begin{bmatrix} \partial_{t_j}\vx(z) \\ \partial_{t_j}\vu(z) \end{bmatrix}^\top\! 
\begin{bmatrix} \vQ(z) & \vP(z) \\ \vP(z)^\top & \vR(z) \end{bmatrix}
\begin{bmatrix} \partial_{t_j}\vx(z) \\ \partial_{t_j}\vu(z) \end{bmatrix}\end{aligned}$$

In the above, we have combined the like terms of the state and input increments. Based on this equation the sensitivity of the cost 