The absolute value of a real number , written , is its distance from zero on the number line. It is always nonnegative: positive numbers retain their value, negative numbers have their sign reversed, and zero remains zero. For a complex number, absolute value—usually called modulus—measures distance from the origin in the complex plane. The concept underlies the mathematical treatment of distance, error, magnitude, and convergence.
Definition for real numbers
For any real number ,
For example,
The expression in the second branch does not mean that the result is negative. When , its opposite is positive.
An equivalent formula is
where the square root denotes the nonnegative square root. Consequently, only when ; the identity valid for all real is .
Absolute value discards sign information. In particular, , so the absolute-value function is not one-to-one on the real numbers. Except at zero, its outputs correspond to two inputs of opposite signs.
Fundamental properties
For real numbers and , absolute value satisfies:
- Nonnegativity: .
- Definiteness: if and only if .
- Multiplicativity: .
- Symmetry: .
- Quotient rule: if , then .
- Triangle inequality: .
The triangle inequality expresses the fact that combining two signed displacements cannot produce a distance greater than the sum of their separate lengths. For real numbers, equality holds exactly when : the two numbers have the same sign, or at least one is zero.
A related result, the reverse triangle inequality, states that
Thus the difference between two magnitudes cannot exceed the distance between the original numbers.
Absolute value does not generally distribute over addition or subtraction. For instance,
Multiplicativity is an exact identity; the corresponding statement for addition is generally only an inequality.
Distance, equations, and inequalities
The distance between two real numbers and is
This is the usual Euclidean distance in one dimension and makes the real line a metric space. The order of subtraction does not matter because .
Absolute-value expressions therefore translate naturally into statements about distance. For ,
This describes all points less than units from . Similarly,
whereas
These equivalences also hold with , interpreted directly; the non-strict central inequality then selects only . An equation has two solutions, and , when , one solution when , and no real solution when .
For example,
is equivalent to or , giving or .
More generally, for real expressions and is equivalent to or . Squaring can also eliminate absolute values from such an equation, but sign restrictions must be retained when comparing an absolute value with an expression that might be negative.
The absolute-value function
The graph of is V-shaped, with its vertex at the origin. It consists of the line for negative inputs and the line for nonnegative inputs.
Continuity and differentiability
Absolute value is a continuous function everywhere on the real line. Indeed, the reverse triangle inequality gives
so it satisfies Lipschitz continuity with constant .
Its derivative away from zero is
At zero, the left-hand derivative is and the right-hand derivative is , so no ordinary derivative exists there. Absolute value is a basic example showing that continuity does not imply differentiability.
Convexity and optimization
Absolute value is a convex function:
Its corner at zero is important in convex optimization. Although an ordinary derivative is unavailable there, a generalized notion called a subgradient applies. A number is a subgradient of at if
for every real . For , the set of subgradients is
This allows optimization conditions to be formulated even at the nondifferentiable point.
Integration
An antiderivative valid on the entire real line is
For a suitable real-valued function , the integral , with , accumulates unsigned area between the graph and the horizontal axis. By contrast, allows positive and negative contributions to cancel.
Absolute value of complex numbers
For a complex number , with real and , its modulus is
This follows geometrically from the Pythagorean theorem: corresponds to the point , whose distance from the origin is . Thus
If is the complex conjugate, then
Complex modulus has the same nonnegativity, multiplicativity, and triangle-inequality properties as real absolute value:
In polar form, a nonzero complex number is written
where and is its argument. Modulus describes magnitude, while argument describes direction. Multiplication multiplies moduli and adds arguments.
The equation , for complex and real , describes a circle centered at . The corresponding strict inequality describes its interior.
Although complex modulus is continuous everywhere, it is not complex-differentiable at any point. Complex differentiability requires a derivative independent of the direction of approach, a condition the modulus function does not satisfy.
Applications
Error measurement and statistics
If approximates a true value , the absolute error is . It measures the discrepancy in the same units as the original quantity. When , relative error is .
In statistics, absolute deviations measure dispersion and prediction error. For observations and predictions , mean absolute error is
As a loss function, absolute error grows linearly with the size of the residual, unlike squared error, which grows quadratically. Very large residuals therefore receive less relative weight under absolute loss.
A median minimizes the sum of absolute deviations,
over real . For an even-sized sample, every point between the two middle ordered observations is a minimizer.
For a random variable , finiteness of the expected absolute value is the standard condition for to have a finite expectation.
Regularization and sparsity
For a vector , the sum
is its norm. Penalties of this form are used in regularization, notably lasso regression. The corners of the penalty at zero allow fitted coefficients to become exactly zero, producing sparse solutions.
Convergence and analysis
Absolute values express the size of errors in definitions of limits. For example, means that for every , eventually
An infinite series converges absolutely when converges. For real or complex series, absolute convergence implies convergence, but the converse is false. The alternating harmonic series converges, while the series of its absolute values diverges.
Generalizations and notation
A norm generalizes magnitude from numbers to vectors. On the real or complex numbers, ordinary absolute value is a norm. On a higher-dimensional vector space, norms are usually written with double bars, such as . Different norms can measure vector size differently.
In number theory, an absolute value on a field is a map satisfying definiteness, multiplicativity, and the triangle inequality. This definition includes alternatives to ordinary magnitude. A p-adic absolute value, for example, measures a nonzero rational number according to the exponent of a fixed prime in its factorization and satisfies the stronger inequality
Thus “absolute value” in abstract mathematics need not mean ordinary distance on the real line.
Vertical bars also have other meanings determined by context. Around a matrix, they may denote a determinant; around a set, its cardinality. Complex modulus should also be distinguished from reduction modulo an integer in modular arithmetic, despite the shared word “modulus.”