Digital Garden
Maths
Common Functions
Absolute Value

Absolute Value

The absolute value of a real number xx is denoted by x|x| and is defined as follows:

x={xif x0xif x<0|x| = \begin{cases} x & \text{if } x \geq 0 \\ -x & \text{if } x < 0 \end{cases}

In other words, if the number is positive, the absolute value is the number itself, and if the number is negative, the absolute value is the number with the sign flipped i.e. the positive version of the number.

The absolute value can also be thought of as the "distance" of a number from zero on the number line.
Example 3=33=30=012=1257=23.14=3.14\begin{align*} |3| &= 3 \\ |-3| &= 3 \\ |0| &= 0 \\ |-\frac{1}{2}| &= \frac{1}{2} \\ |5 - 7| &= 2 \\ |-3.14| &= 3.14 \end{align*}