Calc Lab Online
Math & Basic Calculators

Absolute Difference Calculator

Free online Absolute Difference Calculator. Compute the absolute distance |x - y| between numbers, signed differences, percent difference, and dataset Mean Absolute Difference with interactive visualization.

Sponsored • Leaderboard

Absolute Difference Calculator

Calculate absolute numeric distance |x - y| with step-by-step proofs and number line visuals

Examples:

Input Values

x =
y =
Number Line VisualizationDistance = 6
x(3)
y(9)
mid(6)
Absolute Difference|3 - 9|
6units apart

The geometric distance between 3 and 9 on the real number line is exactly 6.

Signed (x - y)
-6
Signed (y - x)
6
Midpoint Average
6
Relative Difference
100.00%
vs avg magnitude
Percent Difference
100.00%
vs arithmetic mean
Percent Change (x → y)
+200.00%
from x to y

fxStep-by-Step Solution

1Formula: |x - y|
2Substitute values: |(3) - (9)|
3Compute subtraction inside brackets: |-6|
4Apply absolute value function: |-6| = 6
5Verification: |y - x| = |(9) - (3)| = |6| = 6
Advertisement • In-Content

How to Use the Absolute Difference Calculator

Step-by-step instructions for computing distance between numbers, signed differences, and dataset MAD

1

Choose Your Mode

Select Two Numbers (|x - y|) to calculate distance and comparisons between a pair of values, or select Dataset / List to analyze an entire group of numbers.

2

Enter Input Values

Input any real numbers (positive, zero, negative, or decimals). For datasets, enter numbers separated by commas or spaces. Use the quick presets for instant sample scenarios.

3

Explore the Number Line

Review the dynamic SVG number line graphic that plots coordinate points x and y and visually highlights the one-dimensional Euclidean distance between them.

4

Review Detailed Derivations & Export

Inspect the step-by-step arithmetic proof, copy full calculation summaries to your clipboard, or save your work to your personal account history for future reference.

Absolute Difference Formulas & Definitions

Mathematical definitions, algebraic properties, and geometric interpretation

The absolute difference between two real numbers x and y is defined as the absolute value of their algebraic difference:

|x - y| = |y - x| = √((x - y)²)

Fundamental Mathematical Properties

  • Non-negativity: |x - y| ≥ 0 for all real numbers x and y.
  • Identity of Indiscernibles: |x - y| = 0 if and only if x = y.
  • Symmetry (Commutative): |x - y| = |y - x|. The order of arguments does not affect distance.
  • Triangle Inequality: |x - z| ≤ |x - y| + |y - z| for any three points x, y, and z.

Related Comparative Metrics

  • Signed Difference: Δ = x - y (preserves direction: positive if x > y, negative if x < y).
  • Midpoint (Average): M = (x + y) / 2 (center point on the number line).
  • Relative Difference: (|x - y| / [ (|x| + |y|) / 2 ]) × 100%.
  • Percent Change (x to y): ((y - x) / |x|) × 100%.

Handling Negative Numbers

When either x or y is negative, the operation follows standard arithmetic rules where subtracting a negative quantity becomes addition. For example:

Between x = -8 and y = 14: |-8 - 14| = |-22| = 22
Between x = -5 and y = -12: |-5 - (-12)| = |-5 + 12| = |7| = 7

Dataset Analysis & Mean Absolute Difference (MAD)

Understanding dispersion without squared variance

In statistics, the Gini Mean Absolute Difference measures the expected absolute distance between two randomly chosen values from a population or dataset. Unlike the standard deviation, which squares differences and heavily weights outliers, the mean absolute difference provides a pure linear measure of scale:

MAD = [ 1 / (n × (n - 1)) ] × ∑i=1n ∑j=1n |xi - xj|

The Gini coefficient commonly used in economics to evaluate income inequality is directly proportional to this Mean Absolute Difference divided by twice the mean of the dataset.

Frequently Asked Questions

Common questions about absolute differences, formulas, and edge cases

What is the absolute difference between two numbers?

The absolute difference between two real numbers x and y is given by |x - y|. It measures the positive distance between the two values along the real number line, disregarding direction. For instance, the absolute difference between 8 and 3 is |8 - 3| = 5, and the absolute difference between 3 and 8 is |3 - 8| = |-5| = 5.

Can an absolute difference ever be negative?

No. By mathematical definition, the absolute value function |z| maps any real number to a non-negative value (|z| >= 0). The absolute difference equals zero if and only if x = y; otherwise, it is strictly positive.

How do you calculate absolute difference with negative numbers?

Substitute both numbers into |x - y| with their negative signs intact. Subtracting a negative number turns into addition. For example, between -4 and 6: |-4 - 6| = |-10| = 10. Between -5 and -12: |-5 - (-12)| = |-5 + 12| = |7| = 7.

What is the difference between absolute difference and relative difference?

Absolute difference (|x - y|) is an absolute quantity expressed in the exact same units as the input values. Relative difference scales the absolute difference against the magnitude of the values (typically the average: |x - y| / [ (|x| + |y|) / 2 ] * 100%), allowing meaningful percentage comparisons across vastly different scales.

What is the Mean Absolute Difference (MAD) for a dataset?

The Gini Mean Absolute Difference measures statistical dispersion by calculating the average of all pairwise absolute differences between every pair of values in a dataset. Unlike variance or standard deviation, it does not square deviations, making it less sensitive to extreme outliers.

Advertisement