freeCodeCamp/guide/english/mathematics/absolute-value/index.md

1.3 KiB

title
Absolute Value

Absolute Value

Absolute value is the non-negative value of a number, whether that number is positive or negative. You can think of a number's absolute value as its distance from zero. It can be defined as,

img

The absolute value of a quantity x is denoted by |x| (the quantity is enclosed between two vertical bars). Here you can see that in the graph of y = |x|, if -2 is input in to the function, 2 is the result. This is because -2 has a distance of 2 from zero. The absolute value of a number can never be negative.

Examples

  • Simplify |-5|

    |-5| = 5

  • Simplify |0(5)|

    |0(5)| = |0| = 0

  • Simplify -|-1|

    -|-1| = -(1) = -1

  • Simplify |-5(-3) + 1|

    |-5(-3) + 1| = |15 + 1| = |16| = 16

  • Simplify |8|

    |8| = 8

  • Simplify |(-5)^3| |-125| = 125

More Information:

Purplemath