Max Operation Representation on Real Numbers

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

Then:


 * $\max \left\{{x, y}\right\} = \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 $\max \left\{{x, y}\right\} = y$
 * $x = y$ and so $\max \left\{{x, y}\right\} = x = y$
 * $y < x$ and so $\max \left\{{x, y}\right\} = 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 commutative 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$