Sum of Positive and Negative Parts

Theorem
Let $X$ be a set, and let $f: X \to \overline \R$ be an extended real-valued function.

Let $f^+, f^-: X \to \overline \R$ be the positive and negative parts of $f$, respectively.

Then $\size {f} = f^+ + f^-$, where $\size {f}$ is the absolute value of $f$.

Proof
Let $x \in X$.

Suppose that $\map f x \ge 0$, where $\ge$ signifies the extended real ordering.

Then $\size {\map f x} = \map f x$, and:


 * $\map {f^+} x = \map \max {\map f x, 0} = \map f x$
 * $\map {f^-} x = - \map \min {\map f x, 0} = 0$

Hence $\map {f^+} x + \map {f^-} x = \map f x = \size {\map f x}$.

Next, suppose that $\map f x < 0$, again in the extended real ordering.

Then $\size {\map f x} = - \map f x$, and:


 * $\map {f^+} x = \map \max {\map f x, 0} = 0$
 * $\map {f^-} x = - \map \min {\map f x, 0} = - \map f x$

Hence $\map {f^+} x + \map {f^-} x = - \map f x = \size {\map f x}$.

Thus, for all $x \in X$:


 * $\map {f^+} x + \map {f^-} x = \size {\map f x}$

That is, $f^+ + f^- = \size {f}$.