InfyCalculator
➗

Absolute Value & Number Line Distance Calculator

Find the distance between two numbers on the number line as |a − b|, plus each value’s absolute value and their midpoint.

First number (a)
Second number (b)
Loading calculator…

How it works

distance = |a − b| · |x| = x if x ≥ 0, else −x

The absolute value of a number is its distance from zero on the number line, so it is never negative. The distance between two numbers is the absolute value of their difference, |a − b|, which ignores direction — moving from 5 to −3 covers the same ground as moving from −3 to 5. The point exactly between them is their average.

Worked example

For a = −3 and b = 5: distance = |−3 − 5| = |−8| = 8. The absolute values are |−3| = 3 and |5| = 5, and the midpoint is (−3 + 5)/2 = 1.

Sources: Absolute value — Wikipedia

Frequently asked questions

Why is distance always positive?

Distance measures how far apart two points are, with no direction. Absolute value strips the sign from the difference, so the result is zero or positive.

Does |a − b| equal |b − a|?

Yes. The differences a − b and b − a are opposite in sign but equal in size, and absolute value ignores the sign, so both give the same distance.

What is the absolute value of a negative number?

It is the number without its minus sign: |−7| = 7. Geometrically it is that number’s distance from zero.

Related calculators

This calculator is for educational purposes. Double-check important results before acting on them.