Absolute Value Calculator

Calculate the absolute value of any number, find the distance between two values as |a-b|, and solve absolute value equations for all solutions.

Guides & Reference

How It Works

DefinitionDistance from zero

Absolute value of x is x if x≥0, or −x if x<0. Geometrically, it is the distance from x to 0 on the number line.

|x| = x if x≥0; −x if x<0|7|=7, |−7|=7, |0|=0
Distance Interpretation|a−b| between two values

|a−b| gives the distance between a and b. It is always non-negative and symmetric: |a−b|=|b−a|.

distance(a,b) = |a−b||3−7| = |−4| = 4
Solving |x| = kTwo-case split

|x|=k means x=k or x=−k (for k>0). Split into two equations and solve each. If k<0, no solution exists.

x=k or x=−k (if k>0)|x|=5: x=5 or x=−5
Triangle Inequality|a+b| ≤ |a|+|b|

The triangle inequality states the absolute value of a sum is at most the sum of absolute values. Equality holds when a and b have the same sign.

|a+b| ≤ |a| + |b||3+(−7)| = 4 ≤ 3+7 = 10
Mean Absolute DeviationStatistics application

MAD = average of |xi − mean|. It measures how far data points deviate from the mean on average, without squaring.

MAD = Σ|xi−x̄| / nData {2,4,6}: mean=4, MAD=(2+0+2)/3≈1.33
Error MeasuresML and signal processing

L1 loss (sum of |errors|) is used in machine learning as a loss function. More robust to outliers than L2 (squared errors).

L1 loss = Σ|predicted−actual|More robust than squaring for outlier data

Quick Reference

Common examples — verify instantly above.

Positive

|7|

7

Negative

|−7|

7

Zero

|0|

0

Decimal

|−3.14|

3.14

Distance

|3−7|

4

Distance

|−2−5|

7

Equation

|x|=5

x=5 or x=−5

Equation

|x|=0

x=0 only

Tips & Shortcuts

Think of absolute value as "distance from zero." Distance is always positive, never negative.

|a−b| = |b−a| — order does not matter when computing distance between two values.

For |x|=k: if k>0, two solutions. If k=0, one solution. If k<0, no real solution.

To solve |2x+3|=7: split into 2x+3=7 (x=2) and 2x+3=−7 (x=−5). Always check both solutions.

The triangle inequality: |a+b| ≤ |a|+|b|. Useful in many mathematical proofs.

In programming: abs(x) or Math.abs(x) computes absolute value. For integers: if n<0 return −n else return n.

Common Mistakes

Thinking |−x| = x always

Only true if x≥0. If x=−3, then −x=3 and |−x|=|3|=3=x… but if x=3, −x=−3 and |−x|=3=x. Actually |−x|=|x| always.

Forgetting that |x|=k with k<0 has no solution

No real number has a negative absolute value. |x|<0 has no solution; |x|≥0 always.

Only finding the positive solution for |x|=k

|x|=5 gives x=5 AND x=−5. Always split into two cases.

Computing |a|−|b| instead of |a−b|

These are different! |3|−|−7|=3−7=−4, but |3−(−7)|=|10|=10.

Applying absolute value to fractions incorrectly

|−3/4| = 3/4. Apply absolute value to the whole fraction, making numerator and denominator both positive.

Distributing absolute value over addition: |a+b|=|a|+|b|

This is only true when a and b have the same sign. In general, |a+b| ≤ |a|+|b|.

Frequently Asked Questions

Absolute value is the distance from zero on the number line — always non-negative. |7|=7, |−7|=7, |0|=0.

Absolute value measures distance, which is always positive. Distance from 0 to −7 is 7 units, same as 0 to 7.

If k>0: x=k or x=−k (two solutions). If k=0: x=0 (one solution). If k<0: no real solution.

|a−b| gives the distance between a and b on the number line. It is symmetric: |a−b| = |b−a|.

Mean Absolute Deviation (MAD) uses |x − mean| to measure spread. It is more robust than variance because it does not square the errors.

No. Absolute value is always ≥ 0. By definition, |x| ≥ 0 for all real x.

The Triangle Inequality states |a + b| ≤ |a| + |b| — the absolute value of a sum is always less than or equal to the sum of absolute values. Equality holds only when a and b have the same sign. Example: |3 + (−5)| = |−2| = 2, but |3| + |−5| = 8. In geometry this means the direct distance between two points is never longer than the path through a third point.

Related Calculators