Absolute Value Calculator
Calculate the absolute value (magnitude) of any real number. Also called **modulus**, absolute value represents the distance from zero on the number line.
Single Number
Expression
Equation
Inequality
Quick Examples
Introduction to Absolute Value
When engineers measure manufacturing tolerance, statisticians compute prediction error, physicists distinguish speed from velocity, or programmers calculate distances, they all encounter the same mathematical concept: absolute value. Despite its simple definition, absolute value appears across every quantitative discipline.
An absolute value calculator instantly computes the magnitude of any number, expression, or solves equations and inequalities containing absolute value bars. The concept is also called modulus in physics and engineering contexts, but both terms mean exactly the same thing: the distance of a number from zero.
Students learning algebra, engineers calculating error tolerances, programmers implementing distance functions, physicists analyzing motion, statisticians measuring deviation, and data scientists evaluating model accuracy all rely on absolute value. This page covers four major applications: finding absolute value of single numbers, evaluating expressions inside absolute value bars, solving absolute value equations, and solving absolute value inequalities with full worked examples for each.
What is Absolute Value?
Absolute value is the distance of a number from zero on the number line, regardless of direction. Because distance is never negative, absolute value always returns zero or a positive number.
Formal mathematical definition:
|x| = -x, if x < 0
This is called a piecewise definition — the formula changes based on whether x is non-negative or negative.
Visual Explanation
On a number line, |5| = 5 because 5 is 5 units to the right of zero. |-5| = 5 because -5 is 5 units to the left of zero. Both numbers are equally distant from zero, just in opposite directions.
- |5| = 5 — five is 5 units from zero
- |-5| = 5 — negative five is also 5 units from zero
- |0| = 0 — zero is zero distance from itself
Key Insight
Absolute value strips the sign of a number. The result is always zero or positive — never negative.
Special Cases
- |0| = 0: Zero is zero distance from itself.
- |positive| = same positive: |7| = 7.
- |negative| = positive version: |-12| = 12.
Absolute Value vs. Opposite of a Number
These are different concepts. Absolute value removes the sign: |-7| = 7. The opposite flips the sign: -(-7) = 7. For negative inputs, both give the same result. But for positive inputs: |7| = 7 (absolute value) versus -7 = -7 (opposite). They differ fundamentally.
How Does the Absolute Value Calculator Work?
This calculator accepts various input types and handles each appropriately.
Input Types
- Single number: Returns the non-negative magnitude.
- Expression: Evaluates inside the bars first, then applies absolute value.
- Equation: Solves for unknown variable(s) in equations like |x-3| = 7.
- Inequality: Finds solution set for inequalities like |x| < 5.
How It Handles Different Inputs
| Input Type | Example | Process | Output |
|---|---|---|---|
| Positive integer | |12| | Returns same | 12 |
| Negative integer | |-15| | Removes minus | 15 |
| Zero | |0| | Base case | 0 |
| Decimal | |-3.75| | Removes minus | 3.75 |
| Fraction | |-7/8| | Removes minus | 7/8 |
| Expression | |3-8| | Evaluate: 3-8=-5, then |-5|=5 | 5 |
| Complex | |3+4i| | sqrt(9+16) | 5 |
Absolute Value Formula Explained
Piecewise Definition
The standard formal definition:
|x| = -x, when x < 0
When x is non-negative, its absolute value is itself. When x is negative, its absolute value is its opposite (which becomes positive).
Alternative Formula Using Square Root
This formula always produces a non-negative result because squaring eliminates any sign, and the square root returns the non-negative root. For example: sqrt((-5)^2) = sqrt(25) = 5.
Distance Interpretation
Example: |3 - 8| = |-5| = 5. The points 3 and 8 are 5 units apart on the number line.
Worked Examples
| Expression | Working | Result |
|---|---|---|
| |7| | Positive, so |7| = 7 | 7 |
| |-12| | Negative, so |-12| = -(-12) = 12 | 12 |
| |0| | Special case: zero distance from zero | 0 |
| |-3.5| | Remove sign from decimal | 3.5 |
| |-3/4| | Remove sign from fraction | 3/4 |
| |5 - 11| | First evaluate: 5 - 11 = -6, then |-6| = 6 | 6 |
Properties of Absolute Value
These properties are fundamental to algebra, calculus, and analysis.
Non-negativity
Example: |-100| = 100 >= 0. Verified.
Identity
Example: |9| = 9. For non-negative numbers, absolute value returns the same number.
Negation (Symmetry)
Example: |-7| = 7 = |7|. The absolute value of a number and its opposite are equal.
Multiplicative Property
Example: |-3 * 4| = |-12| = 12 = |-3| * |4| = 3 * 4 = 12. Verified.
Division Property
Example: |-15 / 3| = |-5| = 5 = |-15| / |3| = 15 / 3 = 5. Verified.
Power Property
Example: |(-3)^2| = |9| = 9 = |-3|^2 = 3^2 = 9. Verified.
Triangle Inequality
Example: |3 + (-7)| = |-4| = 4 <= |3| + |-7| = 3 + 7 = 10. Verified.
This is profound: the direct path is never longer than going through an intermediate point. Fundamental to geometry, vector mathematics, and analysis.
Reverse Triangle Inequality
The difference in magnitudes is bounded by the magnitude of the difference.
Properties Reference Table
| Property | Formula | Example |
|---|---|---|
| Non-negativity | |x| >= 0 | |-5| = 5 >= 0 |
| Identity | |x| = x if x >= 0 | |8| = 8 |
| Symmetry | |-x| = |x| | |-7| = |7| = 7 |
| Multiplicative | |xy| = |x||y| | |-2*5| = 10 = 2*5 |
| Division | |x/y| = |x|/|y| | |-12/4| = 3 = 12/4 |
| Triangle | |x+y| <= |x|+|y| | |2+(-5)| = 3 <= 7 |
Absolute Value of Expressions
Definition
Evaluate the expression inside the absolute value bars first, then apply absolute value to the result. The bars act as grouping symbols — always simplify everything inside before applying absolute value.
Rules
- Simplify everything inside |...| completely.
- Apply absolute value to the final result.
- Do NOT apply absolute value to individual terms before simplifying.
Worked Examples
Example 1: |3 - 8|
- First: evaluate 3 - 8 = -5
- Then: |-5| = 5
- Result: 5
- NOT |3| - |8| = 3 - 8 = -5 (wrong method)
Example 2: |2^2 - 10|
- First: 2^2 = 4, so 4 - 10 = -6
- Then: |-6| = 6
- Result: 6
Example 3: |-4 * (3 - 5)|
- First: 3 - 5 = -2
- Then: -4 * (-2) = 8
- Then: |8| = 8
- Result: 8
Example 4: |(-3)^2 + (-4)^2|
- First: (-3)^2 = 9, (-4)^2 = 16
- Then: 9 + 16 = 25
- Then: |25| = 25
- Result: 25
Critical Warning
|a + b| does NOT equal |a| + |b| in general. They're equal only when a and b have the same sign. |a - b| does NOT equal |a| - |b|. Always evaluate the full expression inside bars before applying absolute value.
Absolute Value Equations
Definition
Equations containing absolute value expressions with an unknown variable require special handling because one absolute value can correspond to two different numbers.
Key Principle
- |x| = a (where a > 0): TWO solutions: x = a OR x = -a
- |x| = 0: ONE solution: x = 0
- |x| = negative: NO solution (impossible)
Step-by-Step Process
- Isolate the absolute value expression on one side.
- Check if the other side is negative — if so, no solution exists.
- Split into two cases: expression = +value AND expression = -value.
- Solve each case separately.
- Verify both solutions by substituting back into the original equation.
Worked Examples
Basic: |x| = 5
- Two solutions: x = 5 or x = -5
Linear: |x - 3| = 7
- Case 1: x - 3 = 7, so x = 10
- Case 2: x - 3 = -7, so x = -4
- Solutions: x = 10 or x = -4
- Verify: |10 - 3| = |7| = 7 ✓ and |-4 - 3| = |-7| = 7 ✓
With coefficient: |2x + 1| = 9
- Case 1: 2x + 1 = 9, so 2x = 8, x = 4
- Case 2: 2x + 1 = -9, so 2x = -10, x = -5
- Solutions: x = 4 or x = -5
No solution: |x + 3| = -2
- Absolute value cannot equal a negative number.
- No solution exists.
One solution: |3x - 6| = 0
- Only zero has absolute value zero.
- 3x - 6 = 0, so x = 2
- Single solution: x = 2
Both sides absolute: |2x - 1| = |x + 4|
- Case 1: 2x - 1 = x + 4, so x = 5
- Case 2: 2x - 1 = -(x + 4), so 2x - 1 = -x - 4, thus 3x = -3, x = -1
- Solutions: x = 5 or x = -1
Extraneous Solutions Warning
Always substitute answers back into the original equation. Some algebraic manipulations can introduce false solutions that don't actually work.
Absolute Value Inequalities
Definition
Inequalities containing absolute value expressions have two fundamental types with opposite solution behaviors.
Type A: Less Than (|x| < a)
This is an AND condition. "Within a distance of a from zero."
Example: |x| < 4 means -4 < x < 4. Solution is the bounded interval (-4, 4).
Example: |x - 2| < 5 means -5 < x - 2 < 5, so -3 < x < 7.
Type B: Greater Than (|x| > a)
This is an OR condition. "Outside a distance of a from zero."
Example: |x| > 3 means x < -3 or x > 3. Solution is two separate rays.
Example: |x + 1| > 4 means x + 1 < -4 or x + 1 > 4, so x < -5 or x > 3.
Worked Examples
Less than or equal: |x - 3| <= 7
- -7 <= x - 3 <= 7
- Add 3: -4 <= x <= 10
- Solution: [-4, 10] (closed interval)
Strictly less than: |2x + 4| < 8
- -8 < 2x + 4 < 8
- Subtract 4: -12 < 2x < 4
- Divide by 2: -6 < x < 2
- Solution: (-6, 2)
Greater than: |x - 5| > 2
- x - 5 < -2 or x - 5 > 2
- x < 3 or x > 7
- Solution: Two rays (-inf, 3) U (7, inf)
Greater or equal: |3x - 1| >= 5
- 3x - 1 <= -5 or 3x - 1 >= 5
- 3x <= -4 or 3x >= 6
- x <= -4/3 or x >= 2
No solution case: |x + 2| < -1
- Absolute value cannot be less than a negative number.
- No solution.
All real numbers: |x - 3| > -2
- Absolute value is always non-negative, so always > -2.
- Solution: All real numbers.
Memory Trick
Less than = "lEss thAn" = AND = between (bounded interval).
Greater than = "grEATer" = OR = outside (two rays).
Absolute Value on the Number Line
The geometric interpretation makes absolute value intuitive:
- |x| = distance from x to 0
- |x - a| = distance from x to point a
- |x - a| < r = all points within distance r of a (bounded interval)
- |x - a| > r = all points more than distance r from a (two rays)
Example: |x - 5| < 3 means all points within 3 units of 5 on the number line: (2, 8).
Absolute Value in Coordinate Geometry
Distance Between Points
On a number line, distance between two points: d = |x2 - x1|.
Example: Distance between -3 and 7 is |7 - (-3)| = |10| = 10.
Manhattan Distance (Taxicab Geometry)
Used in grid-based city navigation — the distance traveling along city blocks rather than straight-line distance.
Graph of y = |x|
The absolute value function produces a V-shaped graph with vertex at the origin:
- Right side (x >= 0): y = x (line with slope 1)
- Left side (x < 0): y = -x (line with slope -1)
- Vertex at (0, 0)
Transformations: y = |x - h| + k shifts the vertex to (h, k).
Example: y = |x - 3| + 2 has vertex at (3, 2).
Absolute Value in Complex Numbers
For complex number z = a + bi, the absolute value (also called modulus) is:
This represents the distance from origin to point (a, b) in the complex plane.
Examples
- |3 + 4i| = sqrt(9 + 16) = sqrt(25) = 5
- |-5 + 12i| = sqrt(25 + 144) = sqrt(169) = 13
- |-2 - 3i| = sqrt(4 + 9) = sqrt(13) = 3.606...
Why It Matters
The modulus connects to the Pythagorean theorem — it's the hypotenuse of the right triangle formed by real and imaginary parts. In electrical engineering, modulus represents impedance magnitude in AC circuits.
Real-Life Use Cases
Error and Tolerance in Engineering
Absolute error = |measured - actual|. Manufacturing tolerances expressed as +-x use absolute value to specify acceptable deviation in either direction from a target dimension.
Statistics and Data Science
Mean Absolute Error (MAE) averages |predicted - actual| across all predictions. Absolute deviation from the mean is a robust measure of spread less sensitive to outliers than squared deviation.
Physics — Displacement vs. Distance
Distance traveled is always positive, represented by absolute value of displacement. Speed = |velocity| — speed is always non-negative regardless of velocity's sign.
Finance and Economics
Profit/loss magnitude = |revenue - cost|. Absolute return = |ending value - starting value|. Risk models use absolute deviation from expected return as a risk measure.
Computer Science and Programming
Absolute value functions appear in sorting algorithms, distance calculations, error checking, bounds testing, and hash functions. Any comparison of magnitudes requires absolute value.
GPS and Navigation
Deviation from planned route = |actual position - planned position|. Manhattan distance in grid navigation uses |delta_x| + |delta_y| for city-block routing.
Temperature Differences
Temperature change = |T2 - T1| regardless of whether warming or cooling occurred. The magnitude of change matters, not the direction.
Signal Processing
Amplitude of a wave at any point equals absolute value of the signal function. Audio processing, image processing, and telecommunications all rely on amplitude calculations.
Absolute Value in Programming
| Language | Function | Example | Notes |
|---|---|---|---|
| Python | abs(x) | abs(-7) = 7 | Works for int, float, complex |
| JavaScript | Math.abs(x) | Math.abs(-12) = 12 | Returns 0 for null/undefined |
| Java | Math.abs(x) | Math.abs(-5) = 5 | Overloaded for all numeric types |
| C++ | std::abs(x) | std::abs(-3) = 3 | Use |
| Excel | =ABS(number) | =ABS(-10) returns 10 | Simple worksheet function |
| SQL | ABS(column) | ABS(-5) = 5 | Works in all major databases |
| NumPy | np.abs(array) | Element-wise | Array operations |
Edge Case Warning
In Java, Math.abs(Integer.MIN_VALUE) returns a negative number due to integer overflow. The minimum 32-bit integer (-2147483648) has no positive counterpart in signed representation.
Absolute Value vs. Related Concepts
| Concept | Symbol | Definition | For -5 | For 5 |
|---|---|---|---|---|
| Absolute Value | |x| | Distance from zero | 5 | 5 |
| Opposite/Negation | -x | Flip sign | 5 | -5 |
| Sign Function | sgn(x) | Returns -1, 0, or 1 | -1 | 1 |
| Root of Square | sqrt(x^2) | Non-negative root | 5 | 5 |
| Floor Function | floor(x) | Round down | -5 | 5 |
Key distinction: Absolute value is NOT the same as opposite or negation. They give different results for positive inputs.
Key Concepts and Glossary
- Absolute value: The non-negative distance of a number from zero, denoted |x|.
- Modulus: Another term for absolute value, especially for complex numbers or in physics/engineering.
- Number line: Visual representation of real numbers as points on a line.
- Distance: The absolute difference between two values on a number line.
- Piecewise function: A function defined by different formulas for different input ranges.
- Triangle inequality: |x + y| <= |x| + |y|, fundamental in analysis.
- Absolute error: |measured - actual|, magnitude of measurement error.
- Mean Absolute Error (MAE): Average of absolute prediction errors in statistics.
- Solution set: All values satisfying an equation or inequality.
- Bounded interval: An interval with finite endpoints (both ends limited).
- Unbounded interval: An interval extending to infinity in at least one direction.
Tips and Best Practices
- Evaluate inside first: Always simplify the expression inside |...| before applying absolute value.
- Two solutions: |x| = a has two solutions (for a > 0), one (for a = 0), or none (for a < 0).
- Inequality direction: "Less than" means AND (between); "Greater than" means OR (outside).
- Verify solutions: Always substitute back into the original equation.
- Integer overflow: Watch for abs(MIN_VALUE) overflow in programming.
- Complex numbers: Use modulus formula sqrt(a^2 + b^2), not standard absolute value.
Common Mistakes to Avoid
- |a + b| = |a| + |b|: Only true when a and b have the same sign.
- |a - b| = |a| - |b|: Almost never true. Don't distribute absolute value.
- Missing negative case: Absolute value equations have two solutions; don't forget x = -a.
- Unverified solutions: Always check for extraneous solutions after solving.
- Wrong inequality direction: |x| < a is AND; |x| > a is OR. Don't confuse them.
- Premature absolute value: Evaluate inside bars first, then apply absolute value.
- Confusing notation: |x| (absolute value) vs. |A| (determinant of matrix A) — different concepts.
Frequently Asked Questions
Historical Context
Ancient Greek mathematics developed the concept of magnitude as always positive — lengths, areas, and distances had no sign, only size.
Jean-Robert Argand (1806) introduced the concept of modulus for complex numbers, visualizing them in the complex plane with magnitude.
Karl Weierstrass introduced the vertical bar notation |x| in 1841, standardizing the symbol used today.
19th century mathematicians formalized absolute value in real analysis, metric spaces, and field theory, connecting it to distance and convergence.
Modern computing includes abs() in every programming language since FORTRAN (1957), making absolute value one of the most basic and universal mathematical operations in software.
Related Calculators
These tools extend absolute value concepts:
- Distance Calculator: Compute distances using absolute difference.
- Inequality Calculator: Solve various types of inequalities.
- Complex Number Calculator: Operations including modulus calculation.
- Mean Calculator: Use with absolute deviation for MAE.
- Standard Deviation Calculator: Compare with absolute deviation measures.
- Equation Solver: Solve algebraic equations of all types.
Conclusion
Absolute value is a deceptively simple yet profoundly important concept spanning all branches of mathematics. This page covered four major applications: finding absolute value of single numbers (distance from zero), evaluating expressions inside bars (simplify first), solving absolute value equations (two cases for each isolated absolute value), and solving inequalities (less-than means AND, greater-than means OR).
From geometry (distance between points) to algebra (equations and inequalities), from statistics (mean absolute error) to physics (speed from velocity), from programming (abs function) to complex analysis (modulus), absolute value appears wherever magnitude matters regardless of sign.
Use the absolute value calculator above for instant, accurate results. Whether computing simple magnitudes, solving complex equations, or analyzing inequalities, this tool provides step-by-step solutions for learning and verification.