# Absolute value

**Absolute value** (also called modulus) is the magnitude of a real number, complex number, or vector without regard to its sign, written with vertical bars as |x|, |z|, or |v| and always nonnegative<sup>[1](https://www.britannica.com/science/absolute-value)</sup>. For a real number x it is the distance from x to zero on the number line: |x| = x when x ≥ 0 and |x| = −x when x < 0<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup><sup> • </sup><sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup>. The same notation and the same core properties extend to complex numbers and to fields<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup>.

| Key fact | Detail |
|---|---|
| Real definition | \( |x| = x \) if x ≥ 0, \( |x| = -x \) if x < 0; equivalently \( |x| = \sqrt{x^2} \)<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup><sup> • </sup><sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup> |
| Complex modulus | For z = x + iy, \( |z| = \sqrt{x^2 + y^2} \), the distance from the origin in the complex plane<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup><sup> • </sup><sup>[1](https://www.britannica.com/science/absolute-value)</sup> |
| Central inequality | \( |a| - |b| \le |a+b| \le |a| + |b| \), the two-sided triangle inequality<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup> |
| Algebraic rules | \( |a| = |-a| \), \( |ab| = |a|\,|b| \), and \( |a/b| = |a|/|b| \) for b ≠ 0<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup> |
| p-adic value | \( |x|_p = p^{-v_p(x)} \), so \( |p|_p = 1/p \); the product formula \( |x|_\infty \cdot \prod_p |x|_p = 1 \) holds for every nonzero rational x<sup>[4](https://kskedlaya.org/18.787/absolute-values.pdf)</sup><sup> • </sup><sup>[5](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)</sup> |
| Ostrowski's theorem | Up to equivalence, the nontrivial absolute values on Q are exactly the usual archimedean one and the p-adic ones, one per prime<sup>[6](https://kconrad.math.uconn.edu/blurbs/gradnumthy/ostrowskinumbfield.pdf)</sup> |
| Notation | Karl Weierstrass (1815–1897) introduced the vertical bars in an 1841 essay, "Zur Theorie der Potenzreihen"<sup>[7](https://mathshistory.st-andrews.ac.uk/Miller/mathsym/functions/)</sup> |

## Definition and basic properties

The piecewise definition works because every real number is either nonnegative or negative, and in each case the formula returns the number with its sign removed: a positive number is left alone, and a negative number x is replaced by −x, which is positive. The two branches meet at 0, where |0| = 0<sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup>.

The same function can be written without a case split as \( |x| = \sqrt{x^2} \)<sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup>. This identity is also the source of a common algebra mistake: simplifying \( \sqrt{x^2} \) to x is valid only when x ≥ 0. The correct simplification for every real x is \( \sqrt{x^2} = |x| \); for example \( \sqrt{(-5)^2} = \sqrt{25} = 5 = |-5| \), not −5<sup>[8](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/19%3A_Absolute_Value_Functions/19.01%3A_The_Absolute_Value_Function)</sup>.

At the level of abstract algebra, an absolute value on a field k is a map \( |\cdot| : k \to \mathbb{R}_{\ge 0} \) satisfying three conditions: \( |x| = 0 \) if and only if x = 0; multiplicativity, \( |xy| = |x|\,|y| \); and the triangle inequality, \( |x+y| \le |x| + |y| \)<sup>[9](https://math.mit.edu/classes/18.785/2025/LectureNotes1.pdf)</sup>. From these follow \( |a| = |-a| \), the quotient rule \( |a/b| = |a|/|b| \) for b ≠ 0, and the two-sided form \( |a| - |b| \le |a+b| \le |a| + |b| \)<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup>.

## Geometric interpretation

Geometrically, the absolute value of a real number is its displacement from the origin, which is why it is always nonnegative<sup>[1](https://www.britannica.com/science/absolute-value)</sup>. The graph of f(x) = |x| has domain all real numbers and range \( [0, \infty) \), and consists of the two rays y = x (for x ≥ 0) and y = −x (for x < 0) meeting at a sharp corner called the vertex<sup>[8](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/19%3A_Absolute_Value_Functions/19.01%3A_The_Absolute_Value_Function)</sup>.

For a complex number z = x + iy, the modulus is \( |z| = \sqrt{x^2 + y^2} \)<sup>[2](https://encyclopediaofmath.org/wiki/Absolute_value)</sup>. When z is viewed as the ordered pair (a, b) in the complex plane, this is exactly z's distance from the origin, by the [Pythagorean theorem](https://www.edgepedia.org/pythagorean-theorem)<sup>[1](https://www.britannica.com/science/absolute-value)</sup>. The same construction gives the norm on the quaternions H: \( |x| = \sqrt{x \cdot \bar{x}} \)<sup>[10](https://encyclopediaofmath.org/wiki/Norm_on_a_field)</sup>.

## The triangle inequality and metrics

The triangle inequality \( |x+y| \le |x| + |y| \) is the property that makes absolute value usable as a measure of size: it says the size of a sum never exceeds the sum of the sizes, the numerical statement that a straight path is no longer than a detour. It is one of the three defining axioms of an absolute value on a field<sup>[9](https://math.mit.edu/classes/18.785/2025/LectureNotes1.pdf)</sup>, and Britannica lists it among the fundamental properties the notation obeys<sup>[1](https://www.britannica.com/science/absolute-value)</sup>.

Any absolute value induces a metric on its field by \( d(x, y) = |x - y| \), and hence a metric topology<sup>[11](https://users.math.msu.edu/users/ruiterj2/math/Documents/Notes%20and%20talks/Ostrowski%27s%20Theorem.pdf)</sup>. This is the link between the algebraic definition and geometry: distance on the real line, in the complex plane, and in more abstract settings is absolute value of a difference.

A stronger condition sometimes holds: \( |x+y| \le \max(|x|, |y|) \), the ultrametric inequality. An absolute value satisfying it is called nonarchimedean; otherwise it is archimedean<sup>[9](https://math.mit.edu/classes/18.785/2025/LectureNotes1.pdf)</sup>. The ordinary absolute value is archimedean; the p-adic absolute values described below are nonarchimedean.

## Generalizations: norms and p-adic absolute values

On a general field, a norm (also called an absolute value or multiplicative valuation) is a function φ with φ(x) ≥ 0 and φ(x) = 0 only at 0, satisfying the axioms above<sup>[10](https://encyclopediaofmath.org/wiki/Norm_on_a_field)</sup>. On vector spaces the notion widens: a norm on a vector space V over a valued field F is a function \( |\cdot|_V : V \to [0, +\infty) \) that is positive definite, subadditive, and homogeneous, \( |fx|_V = |f|\,|x|_V \)<sup>[4](https://kskedlaya.org/18.787/absolute-values.pdf)</sup>. When F is complete, any two norms on a finite-dimensional F-vector space compatible with |·| are equivalent<sup>[4](https://kskedlaya.org/18.787/absolute-values.pdf)</sup>.

**The p-adic absolute value.** Every rational number x has a p-adic valuation \( v_p(x) \), the power of the prime p dividing x. Exponentiating gives \( |x|_p = p^{-v_p(x)} \); any base 0 < b < 1 would give an equivalent absolute value, but the standard choice b = p<sup>−1</sup> is made so that the product formula holds<sup>[5](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)</sup><sup> • </sup><sup>[4](https://kskedlaya.org/18.787/absolute-values.pdf)</sup>. For x = a/b in lowest terms, \( |x|_p = 1 \) if neither a nor b is divisible by p, \( |x|_p = p^{-1} \) if a is divisible by p once, and \( |x|_p = p \) if b is divisible by p once; in particular \( |p|_p = p^{-1} \)<sup>[5](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)</sup>.

**Ostrowski's classification.** Ostrowski showed in 1916 that the nontrivial absolute values on Q fall into two classes when considered up to equivalence: the standard archimedean one and, for each prime p, a p-adic one, and no two of them are equivalent to one another.<sup>[6](https://kconrad.math.uconn.edu/blurbs/gradnumthy/ostrowskinumbfield.pdf)</sup> This gives infinitely many places of Q, one p-adic place per prime plus the archimedean place, sometimes called the "prime at infinity"<sup>[5](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)</sup>. The archimedean case says any nontrivial archimedean absolute value on Q is equivalent to \( |\cdot|_\infty \)<sup>[11](https://users.math.msu.edu/users/ruiterj2/math/Documents/Notes%20and%20talks/Ostrowski%27s%20Theorem.pdf)</sup>, and an archimedean norm on a field is equivalent, under an embedding into a dense subfield, to the norm induced from R, C, or H<sup>[10](https://encyclopediaofmath.org/wiki/Norm_on_a_field)</sup>. The classification date is reported differently across the literature: Conrad's notes date it to 1916<sup>[6](https://kconrad.math.uconn.edu/blurbs/gradnumthy/ostrowskinumbfield.pdf)</sup>, while an arXiv paper states "Ostrowski, 1918" for its version of the theorem<sup>[12](https://arxiv.org/pdf/0903.2615)</sup>. The product formula ties the places together: for any nonzero rational x, \( |x|_\infty \cdot \prod_p |x|_p = 1 \)<sup>[5](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)</sup>.

## Related notions and how they differ

The vertical-bar notation is overloaded. It is commonly used for the complex modulus, the p-adic norm, general valuations, and vector norms<sup>[13](https://mathworld.wolfram.com/AbsoluteValue.html)</sup>. The distinctions matter in practice:

- **Sign** is the piece of information absolute value discards; |x| recovers magnitude only.
- **Magnitude** is the everyday word for what absolute value measures, of a real number, complex number, or vector<sup>[1](https://www.britannica.com/science/absolute-value)</sup>.
- **Norm** generalizes absolute value to vectors and to fields; double bars \( \|v\| \) are conventional for vector norms, single bars for numbers.
- **Distance** is absolute value applied to a difference, d(x, y) = |x − y|<sup>[11](https://users.math.msu.edu/users/ruiterj2/math/Documents/Notes%20and%20talks/Ostrowski%27s%20Theorem.pdf)</sup>.

In statistics and machine learning the same split appears as L1 versus L2: MSE and MAE are the mean squared and mean absolute errors, respectively, corresponding to the squared L2 (Euclidean) and L1 (Manhattan) norms<sup>[14](https://gmd.copernicus.org/articles/15/5481/2022/gmd-15-5481-2022.html)</sup>.

## By the numbers

The two standard error metrics are defined by

\[ \mathrm{MAE} = \frac{1}{n} \sum_{i=1}^{n} |y_i - \hat{y}_i|, \qquad \mathrm{RMSE} = \sqrt{\frac{1}{n} \sum_{i=1}^{n} (y_i - \hat{y}_i)^2}. \]

MAE is the average of absolute differences between predictions and observations<sup>[14](https://gmd.copernicus.org/articles/15/5481/2022/gmd-15-5481-2022.html)</sup>. The two are linked by a bound: RMSE's lower limit equals MAE, reached when all errors have the same magnitude, and its upper limit is \( \sqrt{n} \times \mathrm{MAE} \), reached when all the error is contained in a single data value<sup>[15](https://eos.org/opinions/climate-and-other-models-may-be-more-accurate-than-reported)</sup>. Because RMSE's upper bound relative to MAE grows with the square root of the number of errors (\( n^{1/2} \)), Willmott and Matsuura found MAE a more natural and unambiguous measure of average error<sup>[16](https://www.int-res.com/journals/cr/articles/cr030079)</sup>.

The choice of loss encodes an error model. MAE can be interpreted as the negative log-likelihood of errors following a Laplacian distribution, whereas MSE corresponds to Gaussian errors<sup>[17](https://arxiv.org/html/2008.07281)</sup>. This is the modern form of a 1920 exchange in which Fisher demonstrated that minimizing squared error is theoretically optimal for normal errors, while permitting Eddington to add a footnote that minimizing absolute error often works better in practice because real observations include outliers that deviate from the normal distribution<sup>[14](https://gmd.copernicus.org/articles/15/5481/2022/gmd-15-5481-2022.html)</sup>.

The p-adic normalization is itself a quantitative statement: \( |p|_p = 1/p \) is chosen so that \( |x|_\infty \cdot \prod_p |x|_p = 1 \) for every nonzero rational x<sup>[4](https://kskedlaya.org/18.787/absolute-values.pdf)</sup><sup> • </sup><sup>[5](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)</sup>.

## Applications

**Model evaluation and robust statistics.** MAE is considered a robust form of estimation because of its tolerance of outliers, per the Fisher–Eddington exchange above<sup>[14](https://gmd.copernicus.org/articles/15/5481/2022/gmd-15-5481-2022.html)</sup>. For a constant prediction θ, the mean absolute error is \( L(\theta, \mathbf{y}) = \frac{1}{n} \sum_{i=1}^{n} |y_i - \theta| \)<sup>[18](https://learningds.org/ch/04/modeling_loss_functions.html)</sup>, and the constant that minimizes it is the median, whereas the mean minimizes mean squared error<sup>[19](https://notes.eecs245.org/introduction-to-supervised-learning/comparing-loss-functions/)</sup>. In deep learning, MAE as a loss for vector-to-vector regression is Lipschitz continuous, which guarantees a generalized upper bound on the loss under additive noise, a property MSE lacks because it is not Lipschitz continuous<sup>[17](https://arxiv.org/html/2008.07281)</sup>.

**Differentiability and optimization.** The absolute value function is not differentiable at zero because of the sharp corner at its minimum, which poses challenges for gradient-based optimization and motivates subgradient methods in L1-regularized models<sup>[8](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/19%3A_Absolute_Value_Functions/19.01%3A_The_Absolute_Value_Function)</sup><sup> • </sup><sup>[20](https://ai-terms-glossary.com/item/absolute-value-function/)</sup>. In L1 regularization ([Lasso](https://www.edgepedia.org/lasso-statistics)), the absolute values of a model's coefficients are added to the loss, shrinking some coefficients to zero and performing automatic feature selection<sup>[20](https://ai-terms-glossary.com/item/absolute-value-function/)</sup>. Over the complex numbers the situation is starker: the derivative of the absolute value depends on the direction in which it is taken, so the [Cauchy–Riemann equations](https://www.edgepedia.org/cauchy-riemann-equations) cannot hold and the function is complex-differentiable nowhere, though the real derivative along the real axis exists at points other than 0<sup>[13](https://mathworld.wolfram.com/AbsoluteValue.html)</sup>.

**Computing.** MATLAB's abs returns the absolute value of each element of its input and, for complex input, the complex magnitude; abs(-0) returns 0<sup>[21](https://www.mathworks.com/help/matlab/ref/double.abs.html)</sup>. In C++, the standard library computes floating-point absolute value via std::abs and std::fabs overloads, with overloads for all cv-unqualified floating-point types added since C++23<sup>[22](https://cppreference.com/cpp/numeric/math/fabs)</sup>. The value returned by std::fabs is exact and does not depend on any rounding modes, and the function is not subject to the error conditions specified in math_errhandling<sup>[22](https://cppreference.com/cpp/numeric/math/fabs)</sup>.

## Solving equations and inequalities

The basis for solving absolute-value equations is that if \( |p| = b \) with b > 0, then p = −b or p = b<sup>[23](https://tutorial.math.lamar.edu/classes/alg/SolveAbsValueEqns.aspx)</sup>: a quantity whose magnitude is b sits at one of two points on the number line. Inequalities split by direction. A bound of the form \( |x - 3| \le 9 \) says the distance from x to 3 is at most 9, so it rewrites as a compound inequality \( -9 \le x - 3 \le 9 \), giving \( -6 \le x \le 12 \)<sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup>.

Two pitfalls account for most errors. First, a negative sign written outside the bars is not removed: \( -|-6| = -6 \), because the bars are evaluated first and the negation applied afterward<sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup>. Second, \( |a+b| \) is generally not equal to \( |a| + |b| \); the triangle inequality bounds the left side by the right, but equality holds only in special cases<sup>[3](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)</sup>. Absolute value bars are also not parentheses and in many cases do not behave like them<sup>[23](https://tutorial.math.lamar.edu/classes/alg/SolveAbsValueEqns.aspx)</sup>.

## History

Before a dedicated symbol existed, writers expressed the concept verbally, in phrases such as "the value of … taken absolutely"<sup>[24](https://link.springer.com/content/pdf/10.1007/s00407-020-00266-9.pdf)</sup>. J. R. Argand introduced the word "module" for the absolute value of a complex number in 1806 (with a further publication in 1814), and Karl Weierstrass introduced the vertical-bar notation |z| in 1841<sup>[25](https://functions.wolfram.com/ComplexComponents/Abs/introductions/ComplexComplements/01/ShowAll.html)</sup>. Weierstrass (1815–1897) used the bars in his 1841 essay "Zur Theorie der Potenzreihen"<sup>[7](https://mathshistory.st-andrews.ac.uk/Miller/mathsym/functions/)</sup>, and from its first page that article consistently uses the sign for absolute values, a vertical line before and after an algebraic expression<sup>[24](https://link.springer.com/content/pdf/10.1007/s00407-020-00266-9.pdf)</sup>. The symbol has since been standardized: ISO 80000-2:2019 includes the vertical bars in its catalog of mathematical signs and symbols for the absolute value of a real number<sup>[26](https://cdn.standards.iteh.ai/samples/23602/89e2d877cbab4426bd935f12ac4d8bf9/ISO-80000-2-2019.pdf)</sup>.

## References

1. [Absolute value, Encyclopaedia Britannica](https://www.britannica.com/science/absolute-value)
2. [Absolute value, Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Absolute_value)
3. [2.10: The Absolute Value of a Number, Mathematics LibreTexts](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/02%3A_Arithmetic/2.10%3A_The_Absolute_Value_of_a_Number)
4. [Kiran Kedlaya, 18.787 notes: Absolute values on fields and norms on vector spaces](https://kskedlaya.org/18.787/absolute-values.pdf)
5. [Berkeley number fields notes: Absolute values and Ostrowski's theorem](https://math.berkeley.edu/~avizeff/Fermat/number-fields.pdf)
6. [Keith Conrad, Ostrowski for number fields](https://kconrad.math.uconn.edu/blurbs/gradnumthy/ostrowskinumbfield.pdf)
7. [Earliest Uses of Function Symbols, MacTutor History of Mathematics](https://mathshistory.st-andrews.ac.uk/Miller/mathsym/functions/)
8. [19.1: The Absolute Value Function, Mathematics LibreTexts](https://math.libretexts.org/Courses/Cosumnes_River_College/Corequisite_Codex/19%3A_Absolute_Value_Functions/19.01%3A_The_Absolute_Value_Function)
9. [MIT 18.785 Lecture Notes 1: Absolute values on fields](https://math.mit.edu/classes/18.785/2025/LectureNotes1.pdf)
10. [Norm on a field, Encyclopedia of Mathematics](https://encyclopediaofmath.org/wiki/Norm_on_a_field)
11. [Ostrowski's Theorem and Completions of Fields, MSU notes](https://users.math.msu.edu/users/ruiterj2/math/Documents/Notes%20and%20talks/Ostrowski%27s%20Theorem.pdf)
12. [arXiv paper on moduli and Ostrowski's theorem](https://arxiv.org/pdf/0903.2615)
13. [Absolute Value, Wolfram MathWorld](https://mathworld.wolfram.com/AbsoluteValue.html)
14. [Root-mean-square error (RMSE) or mean absolute error (MAE): when to use them or not, Geoscientific Model Development (2022)](https://gmd.copernicus.org/articles/15/5481/2022/gmd-15-5481-2022.html)
15. [Climate and Other Models May Be More Accurate Than Reported, Eos](https://eos.org/opinions/climate-and-other-models-may-be-more-accurate-than-reported)
16. [Advantages of the mean absolute error (MAE) over the root mean square error (RMSE), Climate Research](https://www.int-res.com/journals/cr/articles/cr030079)
17. [On Mean Absolute Error for Deep Neural Network Based Vector-to-Vector Regression, arXiv](https://arxiv.org/html/2008.07281)
18. [4.2. Minimizing Loss, Learning Data Science](https://learningds.org/ch/04/modeling_loss_functions.html)
19. [1.4. Comparing Loss Functions, EECS 245 Course Notes](https://notes.eecs245.org/introduction-to-supervised-learning/comparing-loss-functions/)
20. [What is an Absolute Value Function, AI Terms Glossary](https://ai-terms-glossary.com/item/absolute-value-function/)
21. [abs - Absolute value and complex magnitude, MATLAB documentation](https://www.mathworks.com/help/matlab/ref/double.abs.html)
22. [std::abs, std::fabs, cppreference.com](https://cppreference.com/cpp/numeric/math/fabs)
23. [Algebra - Absolute Value Equations, Paul's Online Notes](https://tutorial.math.lamar.edu/classes/alg/SolveAbsValueEqns.aspx)
24. [The development of the concept of uniform convergence in Karl Weierstrass's lectures and publications, Archive for History of Exact Sciences](https://link.springer.com/content/pdf/10.1007/s00407-020-00266-9.pdf)
25. [Absolute value function: Introduction to the complex components, Wolfram Functions](https://functions.wolfram.com/ComplexComponents/Abs/introductions/ComplexComplements/01/ShowAll.html)
26. [ISO 80000-2:2019, Quantities and units, Part 2: Mathematical signs and symbols (sample)](https://cdn.standards.iteh.ai/samples/23602/89e2d877cbab4426bd935f12ac4d8bf9/ISO-80000-2-2019.pdf)

---
*Topic: Encyclopedia › Physical world and mathematics › Mathematics and statistics › Numbers and algebra › Arithmetic and number systems*

*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

*Copyright 2026 EdgeChat AI, a subsidiary of Biostate AI.*

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license
