Real Analysis & Metric Spaces

Absolute Value Calculator

Calculate real modulus \(|x|\), complex plane magnitude \(|a + bi|\), number line distance \(|x - y|\), and explore metric properties and vector norms.

Absolute Value |x|
42.75
Distance from origin: |-42.75| = 42.75
Signum / Sign Function \(\operatorname{sgn}(x)\)
-1 (Negative)
Squared Modulus \(|x|^2\)
1,827.5625
Opposite Value \(-x\)
42.75
Algebraic Form
\(\sqrt{(-42.75)^2}\)

Mathematical & Metric Resolution

Loading mathematical breakdown...

1. Foundations and Formal Definition of Absolute Value

In classical mathematical analysis, algebra, and topology, the concept of magnitude divorced from direction is formalized through the absolute value function (traditionally termed the modulus in European mathematical literature). Introduced symbolically by German mathematician Karl Weierstrass in 1841 using vertical bars \(|x|\), the function provides the foundational definition of metric distance across Euclidean spaces.

For any real number \(x \in \mathbb{R}\), the absolute value is defined piece-wise by the piecewise linear rule:

$$|x| = \begin{cases} x & \text{if } x \ge 0 \\ -x & \text{if } x < 0 \end{cases}$$

Under this definition, the absolute value of a positive number or zero is identically itself (\(|7| = 7\), \(|0| = 0\)), whereas the absolute value of a negative number negates the negative sign, yielding a strictly non-negative magnitude (\(|-7| = -(-7) = 7\)). Consequently, for all real \(x\), the absolute value satisfies the non-negativity axiom: \(|x| \ge 0\), with \(|x| = 0 \iff x = 0\).

1.1 Algebraic Radical Formulation

An alternative, purely algebraic definition of absolute value that avoids piecewise piecewise conditional logic defines \(|x|\) as the principal (positive) square root of the square of \(x\):

$$|x| = \sqrt{x^2}$$

This identity reinforces a critical axiom in elementary algebra often misunderstood by students: \(\sqrt{x^2}\) does not equal \(x\); rather, it equals \(|x|\). For instance, \(\sqrt{(-5)^2} = \sqrt{25} = +5 = |-5|\).

2. Geometrical Interpretation: The 1D Euclidean Metric

Geometrically, the real number line \(\mathbb{R}\) is a one-dimensional metric space. The absolute value of a single coordinate \(|x|\) represents the geometric distance between the point \(x\) and the origin \(0\). Because physical distance cannot be negative, \(|x|\) is inherently scalar and positive.

2.1 Distance Between Two Coordinates

Given any two arbitrary points \(x, y \in \mathbb{R}\), the Euclidean distance \(d(x, y)\) separating them along the real number line is defined by:

$$d(x, y) = |x - y| = |y - x|$$

Because \(|x - y| = |-(y - x)| = |y - x|\), metric distance is inherently symmetric: the distance from point \(A\) to point \(B\) is identical to the distance from \(B\) to \(A\). For example, if temperature drops from \(15^\circ\text{C}\) to \(-8^\circ\text{C}\), the total temperature shift magnitude is \(|15 - (-8)| = |15 + 8| = 23^\circ\text{C}\).

3. Fundamental Algebraic Properties and Axioms

The absolute value satisfies four core algebraic axioms that establish it as a formal norm on the field of real numbers:

  1. Non-negativity: \(|x| \ge 0\) for all \(x \in \mathbb{R}\).
  2. Positive Definiteness: \(|x| = 0\) if and only if \(x = 0\).
  3. Multiplicativity: \(|x \cdot y| = |x| \cdot |y|\), and for \(y \neq 0\), \(\left|\frac{x}{y} \right| = \frac{|x|}{|y|}\).
  4. Subadditivity (The Triangle Inequality): \(|x + y| \le |x| + |y|\).

3.1 The Triangle Inequality and Reverse Triangle Inequality

The Triangle Inequality is arguably the most indispensable inequality in mathematical analysis. It dictates that the magnitude of a sum cannot exceed the sum of the individual magnitudes:

$$|x + y| \le |x| + |y|$$

Equality holds (\(|x + y| = |x| + |y|\)) if and only if \(x\) and \(y\) share the same sign (\(x \cdot y \ge 0\)). If \(x\) and \(y\) possess opposite signs, internal cancellation occurs, making \(|x + y|\) strictly smaller than \(|x| + |y|\) (e.g., \(|5 + (-3)| = |2| = 2 < |5| + |-3| = 5 + 3 = 8\)).

From the standard inequality, one derives the Reverse Triangle Inequality, which provides a lower bound on the difference between magnitudes:

$$\big||x| - |y|\big| \le |x - y|$$

This relationship is paramount when proving the continuity of functions and establishing convergence criteria in calculus \(\epsilon\)-\(\delta\) proofs.

4. Calculus of the Absolute Value: Non-Differentiability at the Origin

In differential calculus, the absolute value function \(f(x) = |x|\) serves as the classic counterexample demonstrating that continuity does not imply differentiability.

4.1 Derivative Analysis and the Signum Function

For all non-zero values of \(x\) (\(x \neq 0\)), the function is differentiable. Using the radical form \(f(x) = \sqrt{x^2}\) and applying the chain rule:

$$f'(x) = \frac{d}{dx}\left(\sqrt{x^2} \right) = \frac{1}{2\sqrt{x^2}} \cdot 2x = \frac{x}{|x|} = \operatorname{sgn}(x)$$

where \(\operatorname{sgn}(x)\) is the signum function:

$$\operatorname{sgn}(x) = \begin{cases} +1 & \text{if } x > 0 \\ -1 & \text{if } x < 0 \end{cases}$$

4.2 Singularity at \(x = 0\)

At \(x = 0\), the derivative fails to exist. Evaluating the difference quotient via one-sided limits:

$$\lim_{h \to 0^+} \frac{f(0 + h) - f(0)}{h} = \lim_{h \to 0^+} \frac{|h| - 0}{h} = \lim_{h \to 0^+} \frac{h}{h} = +1$$ $$\lim_{h \to 0^-} \frac{f(0 + h) - f(0)}{h} = \lim_{h \to 0^-} \frac{|h| - 0}{h} = \lim_{h \to 0^-} \frac{-h}{h} = -1$$

Because the left-hand limit (\(-1\)) and right-hand limit (\(+1\)) are unequal, the two-sided limit does not exist. Geometrically, the graph of \(y = |x|\) forms a sharp \(90^\circ\) corner (cusp) at the origin \((0, 0)\). In optimization theory, algorithms optimizing functions with absolute value terms (such as \(L_1\) regularization in machine learning Lasso regression) must utilize subgradient calculus rather than standard gradient descent.

5. Extension to Complex Numbers: The Modulus in the Argand Plane

When extending numbers into the complex domain \(\mathbb{C}\), let \(z = a + bi\) be a complex number, where \(a = \operatorname{Re}(z)\) is the real component, \(b = \operatorname{Im}(z)\) is the imaginary component, and \(i^2 = -1\).

The absolute value of \(z\), termed its modulus, is defined as the Euclidean distance from the origin \((0, 0)\) to the point \((a, b)\) in the complex Argand plane:

$$|z| = |a + bi| = \sqrt{a^2 + b^2}$$

In terms of the complex conjugate \(z^* = a - bi\), the modulus satisfies the profound algebraic identity:

$$|z|^2 = z \cdot z^* = (a + bi)(a - bi) = a^2 - (bi)^2 = a^2 + b^2 \implies |z| = \sqrt{z \cdot z^*}$$

In polar form, writing \(z = r e^{i\theta} = r(\cos\theta + i\sin\theta)\), the modulus is simply the radial distance: \(|z| = r\).

6. Multidimensional Vector Norms: \(L_1\), \(L_2\), and \(L_\infty\)

In linear algebra and data science, the absolute value generalizes into vector norms across \(n\)-dimensional spaces \(\mathbb{R}^n\) for vector \(\mathbf{x} = (x_1, x_2, \dots, x_n)\):

  • \(L_1\) Norm (Manhattan / Taxicab Norm): Sum of absolute values: $$\|\mathbf{x}\|_1 = \sum_{i=1}^n |x_i| = |x_1| + |x_2| + \dots + |x_n|$$ Used in robust statistics and compressed sensing.
  • \(L_2\) Norm (Euclidean Norm): Straight-line vector magnitude: $$\|\mathbf{x}\|_2 = \sqrt{\sum_{i=1}^n x_i^2} = \sqrt{x_1^2 + x_2^2 + \dots + x_n^2}$$
  • \(L_\infty\) Norm (Chebyshev / Maximum Norm): Maximum absolute component: $$\|\mathbf{x}\|_\infty = \max(|x_1|, |x_2|, \dots, |x_n|)$$

7. Benchmark Comparative Reference Table

The table below catalogues benchmark real and complex values, illustrating their absolute values, squared moduli, signum values, and algebraic expressions.

Input Value Domain Absolute Value / Modulus Squared Modulus Signum / Direction Algebraic Radical Form
\(-42.75\) Real (\(\mathbb{R}\)) \(42.75\) \(1,827.5625\) \(-1\) \(\sqrt{(-42.75)^2}\)
\(+128.5\) Real (\(\mathbb{R}\)) \(128.5\) \(16,512.25\) \(+1\) \(\sqrt{(128.5)^2}\)
\(0\) Real (\(\mathbb{R}\)) \(0\) \(0\) \(0\) \(\sqrt{0^2}\)
\(3 + 4i\) Complex (\(\mathbb{C}\)) \(5.000\) \(25.0\) \(\angle 53.13^\circ\) \(\sqrt{3^2 + 4^2} = \sqrt{25}\)
\(-5 + 12i\) Complex (\(\mathbb{C}\)) \(13.000\) \(169.0\) \(\angle 112.62^\circ\) \(\sqrt{(-5)^2 + 12^2} = \sqrt{169}\)
\(-7.071\) Real (\(\mathbb{R}\)) \(7.071\) \(50.000\) \(-1\) \(\sqrt{(-7.071)^2}\)
\(1 - i\) Complex (\(\mathbb{C}\)) \(\sqrt{2} \approx 1.414\) \(2.0\) \(\angle -45.0^\circ\) \(\sqrt{1^2 + (-1)^2} = \sqrt{2}\)
\(-1000\) Real (\(\mathbb{R}\)) \(1,000\) \(1,000,000\) \(-1\) \(\sqrt{(-1000)^2}\)

8. Worked Engineering Case Study: Error Tolerancing & Deviation Limits

Precision Manufacturing Case Study: CNC Turbine Shaft Runout Tolerancing

Scenario: An aerospace quality assurance engineer inspects a precision high-pressure turbine drive shaft. The blueprint nominal outer diameter is \(D_{\text{nominal}} = 75.000\text{ mm}\) with a strict bilateral dimensional tolerance of \(\pm 0.025\text{ mm}\). A laser micrometer records an actual measured diameter of \(D_{\text{measured}} = 74.968\text{ mm}\). The engineer must: (1) express the dimensional acceptance criteria as a formal absolute value inequality, (2) calculate the absolute error deviation, and (3) determine whether the shaft passes or requires rejection.

Step 1: Formulate the Absolute Value Tolerance Inequality
A fabricated part satisfies specification if and only if the absolute deviation between actual and nominal diameter does not exceed the maximum allowable tolerance \(\delta = 0.025\text{ mm}\): $$|D_{\text{measured}} - D_{\text{nominal}}| \le 0.025\text{ mm}$$ Expanding this absolute value inequality produces the two-sided acceptable interval: $$-0.025 \le D_{\text{measured}} - 75.000 \le +0.025$$ $$74.975\text{ mm} \le D_{\text{measured}} \le 75.025\text{ mm}$$

Step 2: Calculate Actual Absolute Deviation
$$|D_{\text{measured}} - D_{\text{nominal}}| = |74.968 - 75.000| = |-0.032\text{ mm}| = 0.032\text{ mm}$$

Step 3: Quality Control Verdict
Comparing the observed deviation against the specification limit: $$0.032\text{ mm} > 0.025\text{ mm}$$ The absolute error exceeds allowable tolerance by \(0.032 - 0.025 = 0.007\text{ mm}\) (\(7\text{ }\mu\text{m}\)). The turbine shaft fails inspection and is routed for CNC re-machining.

9. Frequently Asked Questions (FAQ)

How do you solve equations involving absolute values, such as |2x - 3| = 7?

An equation of the form \(|A| = B\) (where \(B \ge 0\)) splits into two separate linear branches: \(A = B\) or \(A = -B\). For \(|2x - 3| = 7\): Branch 1: \(2x - 3 = 7 \implies 2x = 10 \implies x = 5\). Branch 2: \(2x - 3 = -7 \implies 2x = -4 \implies x = -2\). Both solutions (\(x = 5\) and \(x = -2\)) must be checked against the original expression.

What is the difference between absolute error and relative error?

Absolute error is the absolute difference between an experimental measurement \(x\) and the true accepted value \(x_0\): \(\Delta_{\text{abs}} = |x - x_0|\). Relative error normalizes this deviation against the magnitude of the true value: \(\Delta_{\text{rel}} = \frac{|x - x_0|}{|x_0|}\). Multiplying relative error by 100% yields percentage error.

Can the absolute value of a number ever be negative?

No. By definition in both real and complex mathematics, absolute value represents a metric distance from the origin. Distance is strictly non-negative (\(|x| \ge 0\)). If an equation states \(|x| = -5\), it has no solution in the real or complex numbers.

Why does the absolute value appear in computer science integer abs() functions?

In computer programming (e.g. C, Python, Java), abs() computes mathematical modulus. However, in two's complement integer hardware, 32-bit signed integers range from \(-2,147,483,648\) to \(+2,147,483,647\). Calling abs(-2147483648) causes integer overflow because the positive value \(+2,147,483,648\) cannot be represented in a 32-bit signed register, demonstrating a famous edge-case bug in systems engineering.