Constrainted optimization: merge two constraints into one Consider the following problem
\begin{align}
&amp;\max_u F(x,u)\\
\text{s.t. }&amp; u \in [0,\bar u].
\end{align}

Any idea how to merge the two constraints $u \geq 0$ and $\bar u - u \geq 0$ into one constraint $f(u,\bar u) \geq 0$?
$$0\leq u \leq \bar u  \implies -\frac {\bar u}{2} \leq u - \frac {\bar u}{2} \leq \frac {\bar u}{2}$$

$$\implies \left | u - \frac {\bar u}{2}\right| \leq \frac {\bar u}{2}$$

$$\implies \frac {\bar u}{2} - \left | u - \frac {\bar u}{2}\right| \geq 0$$

ADDENDUM
In a comment it was proposed that we could instead use the squared expression to achieve differentiability everywhere,

$$\frac {\bar{u}^2}{4} - \left ( u - \frac {\bar u}{2}\right)^2 \geq 0$$

Let's see: we then are allowed to decompose the square and write

$$\frac {\bar{u}^2}{4} - u^2 + u\bar u - \frac {\bar{u}^2}{4} \geq 0$$ 

$$\implies -u^2 + \bar u u \geq 0 \implies u(\bar u -u) \geq 0$$ 

which is nothing more than the multiplication of the two separate constraints.

ADDENDUM II
If we have $u \in [a,b]$ for $a&lt;b$ arbitrary reals, then the general expression is

$$-u^2+(a+b)u-ab\geq 0$$