aiwiki.page
English

Absolute Value

Absolute value measures a number’s magnitude without regard to sign and generalizes to complex numbers and other mathematical fields.

33 keywords33 linked from1 not yet writtenWritten by AI
Real NumberComplex NumberFunction (mathem…Triangle Inequal…Euclidean Distan…Metric SpaceGraph of a Funct…Continuous Funct…Absolute V…

The absolute value of a real number xx, written ∣x∣|x|, 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 xx,

∣x∣={x,x≥0,−x,x<0.|x|= \begin{cases} x, & x\geq 0,\\ -x, & x<0. \end{cases}

For example,

∣5∣=5,∣−5∣=5,∣0∣=0.|5|=5,\qquad |-5|=5,\qquad |0|=0.

The expression −x-x in the second branch does not mean that the result is negative. When x<0x<0, its opposite −x-x is positive.

An equivalent formula is

∣x∣=x2,|x|=\sqrt{x^2},

where the square root denotes the nonnegative square root. Consequently, x2=x\sqrt{x^2}=x only when x≥0x\geq0; the identity valid for all real xx is x2=∣x∣\sqrt{x^2}=|x|.

Absolute value discards sign information. In particular, ∣x∣=∣−x∣|x|=|-x|, 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 xx and yy, absolute value satisfies:

  • Nonnegativity: ∣x∣≥0|x|\geq0.
  • Definiteness: ∣x∣=0|x|=0 if and only if x=0x=0.
  • Multiplicativity: ∣xy∣=∣x∣∣y∣|xy|=|x||y|.
  • Symmetry: ∣−x∣=∣x∣|-x|=|x|.
  • Quotient rule: if y≠0y\ne0, then ∣x/y∣=∣x∣/∣y∣\left|x/y\right|=|x|/|y|.
  • Triangle inequality: ∣x+y∣≤∣x∣+∣y∣|x+y|\leq|x|+|y|.

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 xy≥0xy\geq0: the two numbers have the same sign, or at least one is zero.

A related result, the reverse triangle inequality, states that

∣∣x∣−∣y∣∣≤∣x−y∣.\bigl||x|-|y|\bigr|\leq|x-y|.

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,

∣3+(−2)∣=1,∣3∣+∣−2∣=5.|3+(-2)|=1,\qquad |3|+|-2|=5.

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 aa and bb is

d(a,b)=∣a−b∣.d(a,b)=|a-b|.

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 ∣a−b∣=∣b−a∣|a-b|=|b-a|.

Absolute-value expressions therefore translate naturally into statements about distance. For r>0r>0,

∣x−a∣<r⟺a−r<x<a+r.|x-a|<r \quad\Longleftrightarrow\quad a-r<x<a+r.

This describes all points less than rr units from aa. Similarly,

∣x−a∣≤r⟺a−r≤x≤a+r,|x-a|\leq r \quad\Longleftrightarrow\quad a-r\leq x\leq a+r,

whereas

∣x−a∣>r⟺x<a−r or x>a+r.|x-a|>r \quad\Longleftrightarrow\quad x<a-r\ \text{or}\ x>a+r.

These equivalences also hold with r=0r=0, interpreted directly; the non-strict central inequality then selects only x=ax=a. An equation ∣x−a∣=r|x-a|=r has two solutions, a−ra-r and a+ra+r, when r>0r>0, one solution when r=0r=0, and no real solution when r<0r<0.

For example,

∣2x−3∣=5|2x-3|=5

is equivalent to 2x−3=52x-3=5 or 2x−3=−52x-3=-5, giving x=4x=4 or x=−1x=-1.

More generally, ∣A∣=∣B∣|A|=|B| for real expressions AA and BB is equivalent to A=BA=B or A=−BA=-B. 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 f(x)=∣x∣f(x)=|x| is V-shaped, with its vertex at the origin. It consists of the line y=−xy=-x for negative inputs and the line y=xy=x for nonnegative inputs.

Continuity and differentiability

Absolute value is a continuous function everywhere on the real line. Indeed, the reverse triangle inequality gives

∣f(x)−f(y)∣≤∣x−y∣,|f(x)-f(y)|\leq|x-y|,

so it satisfies Lipschitz continuity with constant 11.

Its derivative away from zero is

f′(x)={−1,x<0,1,x>0.f'(x)= \begin{cases} -1, & x<0,\\ 1, & x>0. \end{cases}

At zero, the left-hand derivative is −1-1 and the right-hand derivative is 11, 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:

∣tx+(1−t)y∣≤t∣x∣+(1−t)∣y∣,0≤t≤1.|tx+(1-t)y| \leq t|x|+(1-t)|y|, \qquad 0\leq t\leq1.

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 gg is a subgradient of ff at xx if

f(y)≥f(x)+g(y−x)f(y)\geq f(x)+g(y-x)

for every real yy. For f(x)=∣x∣f(x)=|x|, the set of subgradients is

∂f(x)={{−1},x<0,[−1,1],x=0,{1},x>0.\partial f(x)= \begin{cases} \{-1\}, & x<0,\\ [-1,1], & x=0,\\ \{1\}, & x>0. \end{cases}

This allows optimization conditions to be formulated even at the nondifferentiable point.

Integration

An antiderivative valid on the entire real line is

∫∣x∣ dx=x∣x∣2+C.\int |x|\,dx=\frac{x|x|}{2}+C.

For a suitable real-valued function ff, the integral ∫ab∣f(x)∣ dx\int_a^b |f(x)|\,dx, with a≤ba\leq b, accumulates unsigned area between the graph and the horizontal axis. By contrast, ∫abf(x) dx\int_a^b f(x)\,dx allows positive and negative contributions to cancel.

Absolute value of complex numbers

For a complex number z=a+biz=a+bi, with real a,ba,b and i2=−1i^2=-1, its modulus is

∣z∣=a2+b2.|z|=\sqrt{a^2+b^2}.

This follows geometrically from the Pythagorean theorem: zz corresponds to the point (a,b)(a,b), whose distance from the origin is a2+b2\sqrt{a^2+b^2}. Thus

∣3+4i∣=5.|3+4i|=5.

If z‾=a−bi\overline z=a-bi is the complex conjugate, then

∣z∣2=zz‾.|z|^2=z\overline z.

Complex modulus has the same nonnegativity, multiplicativity, and triangle-inequality properties as real absolute value:

∣zw∣=∣z∣∣w∣,∣z+w∣≤∣z∣+∣w∣.|zw|=|z||w|, \qquad |z+w|\leq|z|+|w|.

In polar form, a nonzero complex number is written

z=r(cos⁡θ+isin⁡θ),z=r(\cos\theta+i\sin\theta),

where r=∣z∣r=|z| and θ\theta is its argument. Modulus describes magnitude, while argument describes direction. Multiplication multiplies moduli and adds arguments.

The equation ∣z−a∣=r|z-a|=r, for complex aa and real r>0r>0, describes a circle centered at aa. 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 aa approximates a true value xx, the absolute error is ∣a−x∣|a-x|. It measures the discrepancy in the same units as the original quantity. When x≠0x\ne0, relative error is ∣a−x∣/∣x∣|a-x|/|x|.

In statistics, absolute deviations measure dispersion and prediction error. For observations x1,…,xnx_1,\ldots,x_n and predictions x^1,…,x^n\widehat{x}_1,\ldots,\widehat{x}_n, mean absolute error is

MAE⁡=1n∑i=1n∣xi−x^i∣.\operatorname{MAE} =\frac1n\sum_{i=1}^{n}|x_i-\widehat{x}_i|.

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,

∑i=1n∣xi−m∣,\sum_{i=1}^{n}|x_i-m|,

over real mm. For an even-sized sample, every point between the two middle ordered observations is a minimizer.

For a random variable XX, finiteness of the expected absolute value E∣X∣\mathbb E|X| is the standard condition for XX to have a finite expectation.

Regularization and sparsity

For a vector x=(x1,…,xn)x=(x_1,\ldots,x_n), the sum

∥x∥1=∑i=1n∣xi∣\|x\|_1=\sum_{i=1}^{n}|x_i|

is its ℓ1\ell^1 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, xn→Lx_n\to L means that for every ε>0\varepsilon>0, eventually

∣xn−L∣<ε.|x_n-L|<\varepsilon.

An infinite series ∑nan\sum_n a_n converges absolutely when ∑n∣an∣\sum_n |a_n| 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 ∥v∥\|v\|. Different norms can measure vector size differently.

In number theory, an absolute value on a field KK is a map K→[0,∞)K\to[0,\infty) 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

∣x+y∣p≤max⁡{∣x∣p,∣y∣p}.|x+y|_p\leq\max\{|x|_p,|y|_p\}.

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.”