Theabsolute difference of tworeal numbers and is given by, theabsolute value of theirdifference. It describes the distance on thereal line between the points corresponding to and, and is a special case of theLp distance for all. Its applications in statistics include theabsolute deviation from acentral tendency.
Absolute difference has the following properties:
Because it is non-negative, nonzero for distinct arguments, symmetric, and obeys the triangle inequality, the real numbers form ametric space with the absolute difference as its distance, the familiar measure of distance along a line.[4] It has been called "the most natural metric space",[5] and "the most important concrete metric space".[2] This distance generalizes in many different ways to higher dimensions, as a special case of theLp distances for all, including the and cases (taxicab geometry andEuclidean distance, respectively). It is also the one-dimensional special case ofhyperbolic distance.
Instead of, the absolute difference may also be expressed as Generalizing this to more than two values, in any subset of the real numbers which has aninfimum and asupremum, the absolute difference between any two numbers in is less or equal then the absolute difference of the infimum and supremumof.
The absolute difference takes non-negative integers to non-negative integers. As a binary operation that is commutative but not associative, with an identity element on the non-negative numbers, the absolute difference gives the non-negative numbers (whether real or integer) the algebraic structure of acommutative magma with identity.[1]
The absolute difference is used to define therelative difference, the absolute difference between a given value and a reference value divided by the reference value itself.[6]
In the theory ofgraceful labelings ingraph theory, vertices are labeled bynatural numbers and edges are labeled by the absolute difference of the numbers at their two vertices. A labeling of this type is graceful when the edge labels are distinct and consecutive from 1 to the number of edges.[7]
As well as being a special case of the Lp distances, absolute difference can be used to defineChebyshev distance (L∞), in which the distance between points is the maximum or supremum of the absolute differences of their coordinates.[8]
In statistics, theabsolute deviation of a sampled number from acentral tendency is its absolute difference from the center, theaverage absolute deviation is the average of the absolute deviations of a collection of samples, andleast absolute deviations is a method forrobust statistics based on minimizing the average absolute deviation.