{
  "id": "absolute-value",
  "title": "Absolute Value",
  "lang": "en",
  "source_lang": "en",
  "summary": "Absolute value measures a number’s magnitude without regard to sign and generalizes to complex numbers and other mathematical fields.",
  "category": "mathematics",
  "subcategory": "algebra",
  "type": "concept",
  "aliases": [
    "Modulus",
    "Numerical value"
  ],
  "generated_at": "2026-11-03",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/absolute-value/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/absolute-value/",
      "json": "https://aiwiki.page/zh/absolute-value.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The absolute value of a real number \\(x\\), written \\(|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."
    },
    {
      "heading": "Definition for real numbers",
      "text": "For any real number \\(x\\),\n\n\\[|x|= \\begin{cases} x, & x\\geq 0,\\\\ -x, & x<0. \\end{cases}\\]\n\nFor example,\n\n\\[|5|=5,\\qquad |-5|=5,\\qquad |0|=0.\\]\n\nThe expression \\(-x\\) in the second branch does not mean that the result is negative. When \\(x<0\\), its opposite \\(-x\\) is positive.\n\nAn equivalent formula is\n\n\\[|x|=\\sqrt{x^2},\\]\n\nwhere the square root denotes the nonnegative square root. Consequently, \\(\\sqrt{x^2}=x\\) only when \\(x\\geq0\\); the identity valid for all real \\(x\\) is \\(\\sqrt{x^2}=|x|\\).\n\nAbsolute value discards sign information. In particular, \\(|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."
    },
    {
      "heading": "Fundamental properties",
      "text": "For real numbers \\(x\\) and \\(y\\), absolute value satisfies:\n\n- Nonnegativity: \\(|x|\\geq0\\).\n- Definiteness: \\(|x|=0\\) if and only if \\(x=0\\).\n- Multiplicativity: \\(|xy|=|x||y|\\).\n- Symmetry: \\(|-x|=|x|\\).\n- Quotient rule: if \\(y\\ne0\\), then \\(\\left|x/y\\right|=|x|/|y|\\).\n- Triangle inequality: \\(|x+y|\\leq|x|+|y|\\).\n\nThe 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\\geq0\\): the two numbers have the same sign, or at least one is zero.\n\nA related result, the reverse triangle inequality, states that\n\n\\[\\bigl||x|-|y|\\bigr|\\leq|x-y|.\\]\n\nThus the difference between two magnitudes cannot exceed the distance between the original numbers.\n\nAbsolute value does not generally distribute over addition or subtraction. For instance,\n\n\\[|3+(-2)|=1,\\qquad |3|+|-2|=5.\\]\n\nMultiplicativity is an exact identity; the corresponding statement for addition is generally only an inequality."
    },
    {
      "heading": "Distance, equations, and inequalities",
      "text": "The distance between two real numbers \\(a\\) and \\(b\\) is\n\n\\[d(a,b)=|a-b|.\\]\n\nThis 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|\\).\n\nAbsolute-value expressions therefore translate naturally into statements about distance. For \\(r>0\\),\n\n\\[|x-a|<r \\quad\\Longleftrightarrow\\quad a-r<x<a+r.\\]\n\nThis describes all points less than \\(r\\) units from \\(a\\). Similarly,\n\n\\[|x-a|\\leq r \\quad\\Longleftrightarrow\\quad a-r\\leq x\\leq a+r,\\]\n\nwhereas\n\n\\[|x-a|>r \\quad\\Longleftrightarrow\\quad x<a-r\\ \\text{or}\\ x>a+r.\\]\n\nThese equivalences also hold with \\(r=0\\), interpreted directly; the non-strict central inequality then selects only \\(x=a\\). An equation \\(|x-a|=r\\) has two solutions, \\(a-r\\) and \\(a+r\\), when \\(r>0\\), one solution when \\(r=0\\), and no real solution when \\(r<0\\).\n\nFor example,\n\n\\[|2x-3|=5\\]\n\nis equivalent to \\(2x-3=5\\) or \\(2x-3=-5\\), giving \\(x=4\\) or \\(x=-1\\).\n\nMore generally, \\(|A|=|B|\\) for real expressions \\(A\\) and \\(B\\) is equivalent to \\(A=B\\) or \\(A=-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."
    },
    {
      "heading": "The absolute-value function",
      "text": "The graph of \\(f(x)=|x|\\) is V-shaped, with its vertex at the origin. It consists of the line \\(y=-x\\) for negative inputs and the line \\(y=x\\) for nonnegative inputs.\n\nContinuity and differentiability\n\nAbsolute value is a continuous function everywhere on the real line. Indeed, the reverse triangle inequality gives\n\n\\[|f(x)-f(y)|\\leq|x-y|,\\]\n\nso it satisfies Lipschitz continuity with constant \\(1\\).\n\nIts derivative away from zero is\n\n\\[f'(x)= \\begin{cases} -1, & x<0,\\\\ 1, & x>0. \\end{cases}\\]\n\nAt zero, the left-hand derivative is \\(-1\\) and the right-hand derivative is \\(1\\), so no ordinary derivative exists there. Absolute value is a basic example showing that continuity does not imply differentiability.\n\nConvexity and optimization\n\nAbsolute value is a convex function:\n\n\\[|tx+(1-t)y| \\leq t|x|+(1-t)|y|, \\qquad 0\\leq t\\leq1.\\]\n\nIts corner at zero is important in convex optimization. Although an ordinary derivative is unavailable there, a generalized notion called a subgradient applies. A number \\(g\\) is a subgradient of \\(f\\) at \\(x\\) if\n\n\\[f(y)\\geq f(x)+g(y-x)\\]\n\nfor every real \\(y\\). For \\(f(x)=|x|\\), the set of subgradients is\n\n\\[\\partial f(x)= \\begin{cases} \\{-1\\}, & x<0,\\\\ [-1,1], & x=0,\\\\ \\{1\\}, & x>0. \\end{cases}\\]\n\nThis allows optimization conditions to be formulated even at the nondifferentiable point.\n\nIntegration\n\nAn antiderivative valid on the entire real line is\n\n\\[\\int |x|\\,dx=\\frac{x|x|}{2}+C.\\]\n\nFor a suitable real-valued function \\(f\\), the integral \\(\\int_a^b |f(x)|\\,dx\\), with \\(a\\leq b\\), accumulates unsigned area between the graph and the horizontal axis. By contrast, \\(\\int_a^b f(x)\\,dx\\) allows positive and negative contributions to cancel."
    },
    {
      "heading": "Absolute value of complex numbers",
      "text": "For a complex number \\(z=a+bi\\), with real \\(a,b\\) and \\(i^2=-1\\), its modulus is\n\n\\[|z|=\\sqrt{a^2+b^2}.\\]\n\nThis follows geometrically from the Pythagorean theorem: \\(z\\) corresponds to the point \\((a,b)\\), whose distance from the origin is \\(\\sqrt{a^2+b^2}\\). Thus\n\n\\[|3+4i|=5.\\]\n\nIf \\(\\overline z=a-bi\\) is the complex conjugate, then\n\n\\[|z|^2=z\\overline z.\\]\n\nComplex modulus has the same nonnegativity, multiplicativity, and triangle-inequality properties as real absolute value:\n\n\\[|zw|=|z||w|, \\qquad |z+w|\\leq|z|+|w|.\\]\n\nIn polar form, a nonzero complex number is written\n\n\\[z=r(\\cos\\theta+i\\sin\\theta),\\]\n\nwhere \\(r=|z|\\) and \\(\\theta\\) is its argument. Modulus describes magnitude, while argument describes direction. Multiplication multiplies moduli and adds arguments.\n\nThe equation \\(|z-a|=r\\), for complex \\(a\\) and real \\(r>0\\), describes a circle centered at \\(a\\). The corresponding strict inequality describes its interior.\n\nAlthough 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."
    },
    {
      "heading": "Applications",
      "text": "Error measurement and statistics\n\nIf \\(a\\) approximates a true value \\(x\\), the absolute error is \\(|a-x|\\). It measures the discrepancy in the same units as the original quantity. When \\(x\\ne0\\), relative error is \\(|a-x|/|x|\\).\n\nIn statistics, absolute deviations measure dispersion and prediction error. For observations \\(x_1,\\ldots,x_n\\) and predictions \\(\\widehat{x}_1,\\ldots,\\widehat{x}_n\\), mean absolute error is\n\n\\[\\operatorname{MAE} =\\frac1n\\sum_{i=1}^{n}|x_i-\\widehat{x}_i|.\\]\n\nAs 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.\n\nA median minimizes the sum of absolute deviations,\n\n\\[\\sum_{i=1}^{n}|x_i-m|,\\]\n\nover real \\(m\\). For an even-sized sample, every point between the two middle ordered observations is a minimizer.\n\nFor a random variable \\(X\\), finiteness of the expected absolute value \\(\\mathbb E|X|\\) is the standard condition for \\(X\\) to have a finite expectation.\n\nRegularization and sparsity\n\nFor a vector \\(x=(x_1,\\ldots,x_n)\\), the sum\n\n\\[\\|x\\|_1=\\sum_{i=1}^{n}|x_i|\\]\n\nis its \\(\\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.\n\nConvergence and analysis\n\nAbsolute values express the size of errors in definitions of limits. For example, \\(x_n\\to L\\) means that for every \\(\\varepsilon>0\\), eventually\n\n\\[|x_n-L|<\\varepsilon.\\]\n\nAn infinite series \\(\\sum_n a_n\\) converges absolutely when \\(\\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."
    },
    {
      "heading": "Generalizations and notation",
      "text": "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\\|\\). Different norms can measure vector size differently.\n\nIn number theory, an absolute value on a field \\(K\\) is a map \\(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\n\n\\[|x+y|_p\\leq\\max\\{|x|_p,|y|_p\\}.\\]\n\nThus “absolute value” in abstract mathematics need not mean ordinary distance on the real line.\n\nVertical 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.”"
    }
  ],
  "links": [
    "real-number",
    "complex-number",
    "mathematical-function",
    "triangle-inequality",
    "euclidean-distance",
    "metric-space",
    "graph-of-a-function",
    "continuous-function",
    "lipschitz-continuity",
    "derivative",
    "convex-function",
    "convex-optimization",
    "antiderivative",
    "integral",
    "pythagorean-theorem",
    "circle",
    "statistics",
    "loss-function",
    "median",
    "random-variable",
    "expected-value",
    "regularization",
    "lasso-regression",
    "limit",
    "infinite-series",
    "norm-mathematics",
    "vector-space",
    "number-theory",
    "field-mathematics",
    "matrix",
    "determinant",
    "modular-arithmetic"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}