### The Absolute Value Function

The absolute value function receives a number as input an outputs how far away from zero the input is. With the exception of the input zero, the output of the absolute function is always greater than zero.

In the math-world, an expression inside of vertical bars represents the absolute value function. In the computer-world, the absolute value function is sometimes named `abs()`.

```   |5| = 5        |-5| = 5
abs(5) = 5     abs(-5) = 5

|2 x -6| = |-12| = 12
abs(2 x -6) = abs(-12) = 12
```

The following is a mathematical definition for the absolute value function.

```   For any real number 'n', the absolute value of 'n' is
written ```|n| and is defined as:

|n| = n, if n >= 0
|n| = -n, if n < 0
``````
``` Exercises No or Yes: The absolute value of a number 'n' is always equal to the opposite of the number 'n'. No or Yes: 5 + -|-5| + 5 = 5^3 No or Yes: If |a| ≤ b, then -b ≤ a ≤ b. No or Yes: |a + b| ≤ |a| + |b| Rewrite |ab| = |a||b| using function notation with the function name being abs(). ```
``` Creator: Gerald D. Thurman [gthurman@gmail.com] Created: 31 January 2007 <!-- document.writeln("<b>URL:</b> " + document.URL + "<br />"); document.writeln("<b>Last Modified:</b> " + document.lastModified + "<br />"); //--> This work is licensed under a Creative Commons License. ```