Consider a particle of mass $m$, acted upon by a thrust force of magnitude $ma$. The thrust-direction angle $\beta(t)$ we will call the control variable for the system:
$$\dot X=\pmatrix{ \dot x \\ \dot y\\\dot u \\\dot v} = \pmatrix{u\\v\\a\cos\beta\\a\sin\beta} = f \tag{$a\equiv$ const}$$ Solve the system to transfer the particle to a path parallel to the $x$-axis a distance $h$ away in time $T$ arriving at the maximum velocity value of $u(T)$.
Hey, all. I need a little bit of help understanding the last step that my textbook presents for understanding the solution to the above dynamical system. My textbook (2nd page here), (continued both pages here) presents the solution to the problem, but lots of steps seem to be left out, likely due to the fact that the book was from before computers were mainstream and steps were time-consuming to write.
Here is the solution presented in a much more readable form, with steps as I can understand them: We can introduce a set of Lagrange multipliers $\lambda = \pmatrix{\lambda_x & \lambda_y & \lambda_u & \lambda_v}^T$, for which we can determine the Hamiltonian of the dynamical system: $$H = \lambda^Tf = \pmatrix{\lambda_x & \lambda_y & \lambda_u & \lambda_v}\pmatrix{u\\v\\a\cos\beta\\a\sin\beta} = \lambda_xu+\lambda_yv+\lambda_ua\cos\beta+\lambda_va\sin\beta.$$
The Euler-Lagrange equations can be determined from $$\dot\lambda=-\left({\partial f\over\partial X}\right)^T\lambda = -\pmatrix{0&0&1&0\\0&0&0&1\\0&0&0&0\\0&0&0&0}^T\pmatrix{\lambda_x\\\lambda_y\\\lambda_u\\\lambda_v} = \pmatrix{0\\0\\-\lambda_x\\-\lambda_y},$$ and setting $${\partial H\over\partial \beta} = 0\quad\implies\quad -\lambda_ua\sin\beta+\lambda_va\cos\beta=0\quad\implies\quad\tan\beta={\lambda_v\over\lambda_u}.$$
Immediately, we have the boundary conditions:
$$\begin{cases}x(0)=0\\y(0)=0\\u(0)=0\\v(0)=0\end{cases}\quad\quad\begin{cases}y(T)=h\\v(T)=0.\end{cases}$$
where the left boundary conditions are the initial BCs because the particle does not move, and the right BCs are what we want to happen with the $y$ coordinate to be $h$ at time $T$ and travelling parallel to a path parallel to the $x$-axis ($v(T) = 0$).
There is a set of equations from the textbook which basically tells us that $$\begin{cases}\lambda_x(T) = 0\\\lambda_u(T)=1.\end{cases}$$ Notice that $\dot\lambda$ describes a system of differential equations, which at time $T$, from the above we can obtain the following: $$\begin{cases}\lambda_x(t)=\int\dot\lambda_x\,dt = \int0\,dt = c_1\\\lambda_y(t) = c_2\\\lambda_u(t) = -c_1t+c_3\\\lambda_v(t) = -c_2t+c_4\end{cases}\quad\quad\implies\quad\quad\begin{cases}\lambda_x(T) = c_1 = 0\\\lambda_u(T) = -(0)(T) + c_3 =1 \implies c_3 = 1.\end{cases}$$
Then our optimal control law becomes: $$\begin{align*}\tan\beta &= {\lambda_v(t)\over\lambda_u(t)}\\ &= {c_4-c_2t}\\&= c_4-c_2t+(c_2T-c_2T)\\&= \underbrace{c_4-c_2T}_{\lambda_v(T)}+c_2T-c_2t\\&=\underbrace{\lambda_v(T)+\lambda_y(T)T}_{\tan\beta_0}-\underbrace{\lambda_y(T)}_ct\\&=\tan\beta_0-ct\end{align*}$$
From here, I think what we do is we differentiate the above implicitly: $$\begin{align*}\tan\beta = \tan\beta_0-ct &\implies\dot\beta\sec^2\beta = -c\\&\implies\dot\beta=-c\cos^2\beta\end{align*}$$ $$\begin{align*}\dot v={\partial v\over\partial t} = {\partial v\over\partial\beta}{\partial\beta\over\partial t} = v_\beta\dot\beta&=-c\cos^2\beta=a\sin\beta\\\implies v_\beta &=-{a\over c}\tan\beta\sec\beta\\\implies v &= {a\over c}(\sec\beta_0-\sec\beta)\end{align*}$$ The remainder of the solution of the dynamical system can be determined as follows:
$$\begin{cases}u = {a\over c}\ln\left({\tan\beta_0 + \sec\beta_0\over\tan\beta + \sec\beta}\right)\\ v = {a\over c}(\sec\beta_0 - \sec\beta)\\ x= {a\over c^2}\left[\sec\beta_0-\sec\beta-\tan\beta\ln\left({\tan\beta_0 + \sec\beta_0\over\tan\beta + \sec\beta}\right)\right]\\y = {a\over2c^2}\left[(\tan\beta_0-\tan\beta)\sec\beta_0-(\sec\beta_0-\sec\beta)\tan\beta - \ln\left({\tan\beta_0 + \sec\beta_0\over\tan\beta + \sec\beta}\right)\right]\end{cases}$$
According to my textbook (2nd page here), (continued both pages here), the constants $\beta_0$ and $c$ are determined by the boundary conditions $v(T) = 0$ and $y(T) = h$ to give us $$\begin{cases}{4h\over aT^2} = {1\over\sin\beta_0}-{1\over 2\tan^2\beta_0}\ln\left({\sec\beta_0+\tan\beta_0\over\sec\beta_0-\tan\beta_0}\right)\\c={2\tan\beta_0\over T} \implies \tan\beta = \tan\beta_0\left(1-{2t\over T}\right).\end{cases}$$
Can someone please explain how exactly?
It seems like we plug in $v(T) = 0$ into $y(T)$ to yield the first equation, but I'm not sure how or where the $\displaystyle {1\over\sin\beta_0}$ or $2\tan^2\beta_0$ comes from. Why does it suddenly become $\sec\beta_0-\tan\beta_0$ in the denominator in the logarithm? I have been periodically revisiting this problem for the last week, and I have made no progress. I've tried some trig rearrangement such as trying to use the fact that $v(T)=0$ implies $\sec\beta = \sec\beta_0$, but I do nothing but blow through paper. Can someone please provide a little bit of guidance on what the author of the textbook might've done?

