Maximum Function in terms of Absolute Value

Theorem
Let $x$ and $y$ be real numbers.

Then:
 * $\ds \max \set {x, y} = \frac 1 2 \paren {\paren {x + y} + \size {x - y} }$

Proof
We aim to show that:


 * $\ds \frac 1 2 \paren {\paren {x + y} + \size {x - y} } = \begin{cases}y & x \le y \\ x & x > y\end{cases}$

Let $x \le y$.

Then:


 * $x - y \le 0$

Then, from the definition of the absolute value, we have:


 * $\size {x - y} = y - x$

So:

Let $x > y$.

Then:


 * $x - y > 0$

Then, from the definition of the absolute value, we have:


 * $\size {x - y} = x - y$

So:

So:


 * $\ds \frac 1 2 \paren {\paren {x + y} + \size {x - y} } = \begin{cases}y & x \le y \\ x & x > y\end{cases}$

as required.