How this calculation works
If the distance is zero, the two linear equations coincide and produce one root when the slope is nonzero.
|ax+b| = c gives ax+b = ±cA worked example
|2x−3| = 5 has roots −1 and 4.
Good to know
A zero slope makes the equation constant.
Reference: OpenStax Algebra and Trigonometry (opens in a new tab) ↗
Split the distance equation into two branches
For |2x − 3| = 5, the expression inside the bars can equal either 5 or −5. Solving 2x − 3 = 5 gives x = 4. Solving 2x − 3 = −5 gives x = −1. Substitution confirms both roots because their inside values have the same absolute value.
The graph of y = |2x − 3| is V-shaped with its lowest point at x = 1.5. The horizontal line y = 5 crosses the two arms at −1 and 4. This picture explains why a positive distance generally gives two roots when the coefficient of x is nonzero.
Check the zero-distance and zero-slope cases
When the requested distance is zero, the branches coincide. The equation |2x − 3| = 0 has the single root 1.5. The field requires a nonnegative distance because the absolute value of a real expression is nonnegative.
If the slope is zero, the left side becomes the constant |b|. Every real x then works when |b| equals the requested distance, and no x works otherwise. The Absolute value calculator helps inspect this constant. For a nonzero slope, the general roots are (c − b)/a and (−c − b)/a. Their numerical ordering can reverse when a is negative, so the calculator sorts the results before assigning lower and upper labels.
A few questions, answered
Why are there sometimes two roots?
Both a positive and a negative inside value can have the requested magnitude. Each linear branch can therefore produce a root.
Can I verify the roots by squaring?
Squaring both sides is valid here when the requested distance is nonnegative. Substitution into the original absolute-value equation still gives the most direct check.