Equivalence of Definitions of Absolute Value Function

Theorem
The two definitions can be found in the proof below.

1 implies 2
Let $f: \R \to \R$ be the function defined as:
 * $\forall x \in \R: f \left({x}\right) = \begin{cases}

x & : x > 0 \\ 0 & : x = 0 \\ -x & : x < 0 \end{cases}$

Let $x > 0$.

We have that:

Thus $f \left({x}\right) = + \sqrt {x^2}$

2 implies 1
Let $f: \R \to \R$ be the function defined as:
 * $\forall x \in \R: f \left({x}\right) = + \sqrt {x^2}$

Let $x > 0$.

Then by definition of square and square root:
 * $+ \sqrt {x^2} = x$

Let $x = 0$.

Then $+ \sqrt {0^2} = 0$.

Let $x < 0$.

Thus let $x = -y$.

Then:
 * $+ \sqrt {\left({-y}\right)^2} = y = -x$