Max Operation Representation on Real Numbers

Theorem
Let $x, y \in \R$.

Then:


 * $\operatorname{max}(x,y)= \frac{1}{2}\left({x + y + \left \vert x - y \right \vert} \right)$

where $\operatorname{max}$ denotes the max operation.

Proof
From the Trichotomy Law for Real Numbers exactly one of the following holds:


 * $x < y$ and so $\operatorname{max}(x,y) = y$
 * $x = y$ and so $\operatorname{max}(x,y) = x = y$
 * $y < x$ and so $\operatorname{max}(x,y) = x$

By the definition of the absolute value function for each case respectively we have:


 * $\left \vert x - y \right \vert = y - x$
 * $\left \vert x - y \right \vert = 0$
 * $\left \vert x - y \right \vert = x - y$

Thus the equation holds by $+$ being commutativity and associative as for each case:


 * $\frac{1}{2}\left({x + y + y - x} \right) = y$
 * $\frac{1}{2}\left({x + y + 0} \right) = x = y$
 * $\frac{1}{2}\left({x + y + x - y} \right) = x$