Based on this function:
$$\text{max} \int_0^2(-2tx-u^2) \, dt$$
We know that $$(1) \;-1 \leq u \leq 1, \; \; \; (2) \; \dot{x}=2u, \; \; \; (3) \; x(0)=1, \; \; \; \text{x(2) is free}$$
I can rewrite the function into a hamiltonian function:
$$H=-2tx-u^2+p2u$$
where u(t) maxizmizee H where:
\begin{equation} u = \left\{\begin{array}{rc} 1 & p \geq 1 \\ p & -1 < p < 1 \\ -1 & p \leq -1 \end{array}\right. \end{equation}
Now, can somebody help me understand how the last part is true, and why? I find it hard to see the bridge between $u$ and $p$.