I am following a derivation in a book by Bryson and Ho. The problem is for path calculation in a velocity field (wind). Wind is $w = \vec{w}$ position $r = \vec{r}$ and control heading $\hat{u} = \vec{\hat{u}}$ where $\hat{u} \cdot \hat{u} = 1$.
Aircraft velocity equation:
$$ \dot{r} = V \hat{u} + w $$
Hamiltonian
$$ \mathcal{H} = \lambda \cdot (V \hat{u} + w) + \mu (1 - \hat{u}\cdot\hat{u}) + 1 $$
Euler-Lagrange
$$ \dot{\lambda} = - \frac{\partial H}{\partial r} = - \nabla (\lambda \cdot w) $$
$$ 0 = \frac{\partial H}{\partial \hat{u}} = V \lambda - 2\mu\hat{u} $$
Then, using the last equation above, the author says
$$ 2\mu = \pm V |\lambda| \to \hat{u} = \pm \frac{\lambda}{|\lambda|} $$
I understand the algebra except the $\pm$ part.. Why was that necessary?
Thanks,
We have that $$V\lambda = 2 \mu \hat{u}$$ Which means that their direction is the same, so we can write that $$\hat{u}=C \lambda$$ for some $C$. But because $\hat{u}$ is an unit vector, we must have that $$|C|\, ||\lambda|| = 1$$ Which means that $$|C| = \frac{1}{||\lambda||}$$ But $C$ can be positive and negative as well, that's why we write $$\hat{u}=\pm |C| \lambda = \pm \frac{\lambda}{||\lambda||}$$ And we will pick the appropriate sign later (which will make the Hamiltonian zero, as I can see).