Equations and inequalities with absolute value

Absolute value as a distance, the equations |f(x)| = a, |f(x)| = g(x) (with the condition g ≥ 0) and |f| = |g|, equations with several absolute values by the interval method, the inequalities |f| < g, |f| > g and with two absolute values, and counting the roots of an equation with a parameter from the graphs y = |f(x)| and y = f(|x|) — with DİM’s typical answers: the sum of the roots, the number of integer solutions.

  • Grades 8 and 9
  • 24 min
  • 12 questions
  • Lesson 40 of 92

In this lesson you will learn

  • Read |a − b| as the distance between two points and solve |f(x)| = a, |f(x)| = g(x) and |f| = |g|
  • Solve equations with several absolute values by the interval method and check the roots found
  • Solve |f| < g, |f| > g and |f| ≤ |g| and count the integer solutions
  • Count the roots of an equation with a parameter from the graphs y = |f(x)| and y = f(|x|)

|x − 3| = 2 can be read in two ways: “the absolute value of x − 3 is 2” or “on the number line, the point x is 2 units away from 3”. The second reading gives the answer at once: x = 1 or x = 5. We met |x| = a in “Positive and negative numbers, the number line and absolute value” and |x − a| < b in “Linear inequalities and systems”. DİM asks harder tasks: a quadratic inside the absolute value, an expression with x on the right, two absolute values, a parameter. The answer is often asked as “the sum of the roots” or “the number of integer solutions”.

Absolute value as a distance. |f(x)| = a

Absolute value of a numberDefinition

|a| = a if a ≥ 0 and |a| = −a if a < 0. Geometrically, |a| is the distance from 0 to the point a on the number line, and |a − b| is the distance between the points a and b. An absolute value is never negative.

|x − 3| = 2−10123456722
Two points are 2 units away from 3: 1 and 5.

“Opening” an absolute value means looking at the sign of the expression inside: if it is not negative, simply drop the bars; if it is negative, write the expression with the opposite sign. For example, for x < 3, |x − 3| = −(x − 3) = 3 − x. Everything in equations, inequalities and simplifications rests on this rule. A few properties shorten the work:

Simple explanation

An absolute value is a distance, so it is never negative: |5| = 5 and |−5| = 5. To “open” an absolute value, look at the number inside. If it is positive or zero, nothing changes. If it is negative, change its sign. See what happens to |x − 3| for different x:

xx − 3|x − 3|
522 = x − 3
300
1−22 = 3 − x
−1−44 = 3 − x
To the right of 3 the bars simply disappear: |x − 3| = x − 3. To the left of 3 the inside is negative, so |x − 3| = −(x − 3) = 3 − x. A few properties make the work shorter:
|−a| = |a||a · b| = |a| · |b||a|² = a²√(a²) = |a||a + b| ≤ |a| + |b|

Where

a, b
any real numbers

Because √(a²) = |a|, we write √((x − 3)²) = |x − 3|, not x − 3. |a|² = a² lets us square two absolute values.

Going deeper

Why is |a + b| ≤ |a| + |b|? Both sides are non-negative, so compare their squares: (|a| + |b|)² − (a + b)² = a² + 2|ab| + b² − a² − 2ab − b² = 2(|ab| − ab) ≥ 0. So the inequality holds, and equality holds exactly when ab ≥ 0 — when a and b do not have opposite signs. This fact solves some frightening-looking equations in one line.

Solving with the triangle inequality

Problem

Solve |x − 2| + |x + 5| = |2x + 3|.

Show solutionHide solution

Solution

Note that (x − 2) + (x + 5) = 2x + 3. So the equation says |a| + |b| = |a + b| for a = x − 2, b = x + 5, and that happens exactly when (x − 2)(x + 5) ≥ 0.
Answer: x ≤ −5 or x ≥ 2 — infinitely many roots, without any interval method.
Check: x = 3: 1 + 8 = 9 = |9| ✓; x = 0: 2 + 5 = 7, but |3| = 3 ✗ (0 is not in the answer).

Simplifying under a condition

Problem

1) Simplify √((x − 3)²) + |x + 1| for −1 < x < 3.
2) Simplify |a − b| + |a| − |b| for a < 0 < b.

Show solutionHide solution

Solution

1) √((x − 3)²) = |x − 3| = 3 − x, since x − 3 < 0; |x + 1| = x + 1, since x + 1 > 0. Sum: 3 − x + x + 1 = 4 — it does not depend on x.
2) a − b < 0 ⇒ |a − b| = b − a; |a| = −a; |b| = b. Result: (b − a) + (−a) − b = −2a. Check: a = −2, b = 3 ⇒ 5 + 2 − 3 = 4 = −2 · (−2).
|f(x)| = a: a < 0 — no rootsa = 0 ⇒ f(x) = 0a > 0 ⇒ f(x) = a or f(x) = −a

Where

f(x)
the expression inside the absolute value
a
a number (does not depend on x)

If the right-hand side is a number, the absolute value splits into two equations; if it is negative, there is no solution.

Equations |f(x)| = a

Problem

Solve:
1) |2x − 5| = 7;
2) |x² − 5| = 4 (also find the sum of the roots);
3) ||x| − 3| = 2;
4) |3x + 1| = −2.

Show solutionHide solution

Solution

1) 2x − 5 = 7 ⇒ x = 6; 2x − 5 = −7 ⇒ x = −1. Answer: −1, 6.
2) x² − 5 = 4 ⇒ x² = 9 ⇒ x = ±3; x² − 5 = −4 ⇒ x² = 1 ⇒ x = ±1. Four roots: −3, −1, 1, 3, sum 0.
3) |x| − 3 = 2 ⇒ |x| = 5 ⇒ x = ±5; |x| − 3 = −2 ⇒ |x| = 1 ⇒ x = ±1. Answer: ±1, ±5.
4) An absolute value cannot be negative: no roots.

Sign up free to keep reading

The rest of the lesson, the quiz and your notes open with an Educora account. Signing up takes a minute, and your progress is saved on all your devices.

|f(x)| = g(x) and |f(x)| = |g(x)|

|f(x)| = g(x) ⇔ g(x) ≥ 0 and [ f(x) = g(x) or f(x) = −g(x) ]

Where

g(x)
the right-hand side — an expression in x

An absolute value is never negative, so the right-hand side cannot be negative either: first write the condition g(x) ≥ 0, and at the end check every root against it.

Why is this condition important? The equations f = ±g are written without the absolute value, and among their roots there may be some with g(x) < 0 — at such a root the left side (a distance) is positive while the right side is negative. There is another way too: split into the cases f(x) ≥ 0 and f(x) < 0 and open the absolute value in each. If the inside is simple, the second way is shorter; if the right side is simple, the first one is. Whichever you choose, check the roots in the original equation at the end.

Simple explanation

A distance cannot be negative. So in |x − 3| = 2x − 9 the right side 2x − 9 must not be negative either. Look at x = 4, which comes out of the calculation: the left side is |4 − 3| = 1, the right side is 2 · 4 − 9 = −1. A distance equal to −1? Impossible — so x = 4 is thrown out. That is the whole meaning of the condition g(x) ≥ 0. At the end, always substitute the roots into the original equation: x = 6 gives |3| = 3 = 12 − 9 ✓.

x on the right-hand side

Problem

Solve:
1) |x − 3| = 2x − 9;
2) |x² − 4x| = 3x − 6;
3) |x − 1| = 3 − x.

Show solutionHide solution

Solution

1) Condition: 2x − 9 ≥ 0 ⇒ x ≥ 4.5.
x − 3 = 2x − 9 ⇒ x = 6 — fits.
x − 3 = −(2x − 9) ⇒ 3x = 12 ⇒ x = 4 — 4 < 4.5, rejected (check: |4 − 3| = 1, but 2 · 4 − 9 = −1).
Answer: 6.
2) Condition: 3x − 6 ≥ 0 ⇒ x ≥ 2.
x² − 4x = 3x − 6 ⇒ x² − 7x + 6 = 0 ⇒ x = 1 (rejected) or x = 6.
x² − 4x = −3x + 6 ⇒ x² − x − 6 = 0 ⇒ x = −2 (rejected) or x = 3.
Answer: 3, 6 (sum of the roots 9).
3) Condition: x ≤ 3. x − 1 = 3 − x ⇒ x = 2; x − 1 = x − 3 ⇒ −1 = −3 — no solution. Answer: 2.
|f(x)| = |g(x)| ⇔ f(x) = g(x) or f(x) = −g(x)

Where

f, g
the expressions inside the absolute values

Both sides are non-negative, so no extra condition is needed. The only root of |x − a| = |x − b| (a ≠ b) is the midpoint of a and b: x = (a + b)/2.

Two equal absolute values

Problem

1) Solve |2x − 1| = |x + 4| and find the sum of the roots.
2) Solve |x − 2| = |x + 6|.

Show solutionHide solution

Solution

1) 2x − 1 = x + 4 ⇒ x = 5; 2x − 1 = −x − 4 ⇒ 3x = −3 ⇒ x = −1. Sum: 5 + (−1) = 4.
2) x − 2 = x + 6 ⇒ −2 = 6 — no solution; x − 2 = −x − 6 ⇒ 2x = −4 ⇒ x = −2. Geometric check: −2 is exactly halfway between 2 and −6.

Several absolute values: the interval method

  1. 1. Zeros

    Set the inside of each absolute value to zero: x = 1 for |x − 1|, x = 5 for |x − 5|.

  2. 2. Intervals

    The zeros cut the number line into intervals; on each interval the insides keep their signs.

  3. 3. Open the absolute values

    Write an absolute value with a positive inside as it is, one with a negative inside with the opposite sign.

  4. 4. Solve and check

    Solve on each interval and check that the root lies in that interval; drop it if it does not.

  5. 5. Combine

    Write the roots from all intervals together.

Simple explanation

The interval method in one picture: the points where the insides become 0 cut the number line into pieces, and in each piece every absolute value opens in one definite way. See how the sum |x − 1| + |x − 5| behaves:

x−1013567
|x − 1| + |x − 5|8644468
Between 1 and 5 the sum is always 4 (there it is just the distance from 1 to 5); outside it grows by 2 with every step. So the sum equals 6 only at x = 0 and x = 6 — the roots of the example below.

With the interval method

Problem

Solve:
1) |x − 1| + |x − 5| = 6;
2) |x − 2| − |x + 1| = 1.

Show solutionHide solution

Solution

1) Zeros: 1 and 5.
x < 1: (1 − x) + (5 − x) = 6 ⇒ 6 − 2x = 6 ⇒ x = 0 — 0 < 1, fits.
1 ≤ x ≤ 5: (x − 1) + (5 − x) = 4 ≠ 6 — no root.
x > 5: (x − 1) + (x − 5) = 6 ⇒ 2x = 12 ⇒ x = 6 — fits.
Answer: 0, 6.
2) Zeros: −1 and 2.
x < −1: (2 − x) − (−x − 1) = 3 ≠ 1 — no root.
−1 ≤ x ≤ 2: (2 − x) − (x + 1) = 1 − 2x = 1 ⇒ x = 0 — fits.
x > 2: (x − 2) − (x + 1) = −3 ≠ 1 — no root.
Answer: 0.

DİM style: a closed task

Problem

Find the sum of the roots of |x − 2| + |x + 3| = 9.
A) −1 B) 1 C) 9 D) −9 E) 0

Show solutionHide solution

Solution

The zeros are −3 and 2; the distance between them is 5 < 9, so there are two roots.
x < −3: (2 − x) + (−x − 3) = −2x − 1 = 9 ⇒ x = −5 ✓.
x > 2: (x − 2) + (x + 3) = 2x + 1 = 9 ⇒ x = 4 ✓.
On −3 ≤ x ≤ 2 the sum is 5, not 9.
Sum: −5 + 4 = −1. The shortcut: the roots are symmetric about the midpoint −1/2, so their sum is 2 · (−1/2) = −1.
Answer: A.
Going deeper

The sum of distances has a beautiful property: F(x) = |x − a₁| + |x − a₂| + … + |x − aₙ| is smallest at the median of the points a₁, …, aₙ (for an even number of points — anywhere between the two middle ones). The reason: if more points lie to the right of x than to the left, moving x to the right shortens more distances than it lengthens. That is why in statistics the median minimizes the sum of absolute deviations, while the mean minimizes the sum of squared deviations.

Where should the shop be built?

Problem

Five houses stand along a road at kilometres 1, 3, 4, 9 and 13. Where should a shop be built so that the total distance to all the houses is as small as possible?

Show solutionHide solution

Solution

The median of 1, 3, 4, 9, 13 is 4. F(4) = 3 + 1 + 0 + 5 + 9 = 18 km.
Compare: F(3) = 2 + 0 + 1 + 6 + 10 = 19, F(5) = 4 + 2 + 1 + 4 + 8 = 19, and at the mean, (1 + 3 + 4 + 9 + 13)/5 = 6, the total is F(6) = 5 + 3 + 2 + 3 + 7 = 20.
Answer: at kilometre 4.

Inequalities with absolute value

|f| < g ⇔ −g < f < g|f| > g ⇔ f > g or f < −g|f| < |g| ⇔ (f − g)(f + g) < 0

Where

f, g
expressions in x (g may also be a constant)

“Less than” is a system (both conditions together), “greater than” is a union (at least one holds). With two absolute values both sides are non-negative, so we may square: f² < g².

Simple explanation

“Less than” means inside, “greater than” means outside. |x| < 3 is about the numbers closer than 3 to zero: −3 < x < 3. |x| > 3 is about those farther than 3: x < −3 or x > 3. A quick test: x = 0 gives |0| = 0 < 3, so 0 belongs to the first answer; x = 5 gives |5| = 5 > 3, so 5 belongs to the second. It works the same with a shift: |x − 4| ≤ 3 means 4 − 3 ≤ x ≤ 4 + 3, that is, 1 ≤ x ≤ 7.

The language of distance helps here too: |x − a| < b means the points closer to a than b (an interval centred at a), |x − a| > b means the points farther than b (two rays). |x − a| < |x − b| means “x is closer to a than to b”: all points on a’s side of the midpoint of a and b.

Solving with distances

Problem

1) Solve |x − 1| + |x − 5| ≤ 6 and count the integer solutions.
2) Solve |x + 3| > |x − 1|.

Show solutionHide solution

Solution

1) Equality holds at 0 and 6; between them the sum of distances is less than 6, outside it is greater. Solution: [0, 6], integer solutions 0, 1, …, 6 — seven.
2) x is closer to 1 than to −3. The midpoint is (−3 + 1)/2 = −1, so x > −1. Algebraic check: (x + 3)² > (x − 1)² ⇒ 8x + 8 > 0 ⇒ x > −1. Answer: (−1, +∞).

Solving inequalities

Problem

1) Solve |x² − 5x| < 6 and find the number of integer solutions.
2) Solve |x − 3| > 2x.
3) Find the sum of the integer solutions of |2x − 1| ≤ |x + 4|.

Show solutionHide solution

Solution

1) −6 < x² − 5x < 6 — a system:
x² − 5x + 6 > 0 ⇒ (x − 2)(x − 3) > 0 ⇒ x < 2 or x > 3;
x² − 5x − 6 < 0 ⇒ (x + 1)(x − 6) < 0 ⇒ −1 < x < 6.
Intersection: (−1, 2) ∪ (3, 6). Integer solutions: 0, 1, 4, 5 — four of them.
2) A union: x − 3 > 2x ⇒ x < −3; or x − 3 < −2x ⇒ 3x < 3 ⇒ x < 1. The union is x < 1: (−∞, 1). Check: x = 0 ⇒ 3 > 0 ✓; x = 1 ⇒ 2 > 2 ✗.
3) Square: (2x − 1)² ≤ (x + 4)² ⇒ (2x − 1 − x − 4)(2x − 1 + x + 4) ≤ 0 ⇒ (x − 5)(3x + 3) ≤ 0 ⇒ −1 ≤ x ≤ 5.
Integer solutions −1, 0, 1, 2, 3, 4, 5; their sum is 14.
Going deeper

A subtle point: the rule |f| < g ⇔ −g < f < g needs no separate condition g > 0. If g ≤ 0, the system −g < f < g has no solutions by itself (−g ≥ g), just like |f| < g. Likewise, |f| > g ⇔ f > g or f < −g is correct for negative g too: then one of the two conditions always holds. So these rules can be used even when g contains x.

x on the right-hand side

Problem

Solve |x² − 2x − 3| < 3x − 3.

Show solutionHide solution

Solution

System: −(3x − 3) < x² − 2x − 3 < 3x − 3.
Right part: x² − 5x < 0 ⇒ 0 < x < 5.
Left part: x² + x − 6 > 0 ⇒ (x + 3)(x − 2) > 0 ⇒ x < −3 or x > 2.
Intersection: (2, 5). Notice that the answer lies where 3x − 3 > 0 — the condition took care of itself.
Check: x = 3: |0| = 0 < 6 ✓; x = 2: |−3| = 3 < 3 ✗; x = 5: |12| = 12 < 12 ✗.

For solving quadratic inequalities see “Quadratic inequalities and the interval method”. The interval method works for inequalities too: open the absolute values on each interval, solve the resulting inequality and intersect the result with that interval.

Graphs and a parameter: y = |f(x)| and y = f(|x|)

To draw y = |f(x)|, reflect the part of y = f(x) below the x-axis upwards. For y = f(|x|), keep the part of the graph with x ≥ 0 and reflect it to the left in the y-axis — the function becomes even (graph transformations: “Functions and their properties”). The number of roots of F(x) = a is the number of points where the graph y = F(x) meets the horizontal line y = a. In a parameter task we “slide” this line up and down.

Simple explanation

Two pictures to remember. y = |f(x)|: fold the paper along the x-axis — everything that was below the axis is now above it, the rest stays. y = f(|x|): erase the left half of the graph and copy the right half to the left, as in a mirror standing on the y-axis. To count the roots of F(x) = a, draw the horizontal line y = a and count the points where it meets the graph.

Interactive

Loading simulation…
The graph of y = |x² − 6|x| + 5| and the line y = a. Move the slider a and count the intersection points: 8 for 0 < a < 4, 6 for a = 4, 3 for a = 5.

y = |f(x)|: the number of roots

Problem

Depending on a, how many roots does |x² − 4| = a have?

Show solutionHide solution

Solution

The part of the parabola y = x² − 4 on (−2, 2) lies below the x-axis; reflecting it up gives a “hump” of height 4 at x = 0.
a < 0 — 0 roots; a = 0 — 2 roots (±2); 0 < a < 4 — 4 roots; a = 4 — 3 roots (0 and ±2√2); a > 4 — 2 roots.
Check, a = 4: x² − 4 = 4 ⇒ x = ±2√2; x² − 4 = −4 ⇒ x = 0.

DİM style: a coded task

Problem

For how many integer values of a does |x² − 6|x| + 5| = a have exactly 8 roots?

Show solutionHide solution

Solution

1) For x ≥ 0, y = x² − 6x + 5: zeros 1 and 5, vertex (3, −4), and y = 5 at x = 0.
2) Reflect this part in the y-axis: the graph of y = x² − 6|x| + 5 is “W”-shaped with minima −4 at x = ±3.
3) Take the absolute value: the parts on (−5, −1) and (1, 5) go up and form two “humps” of height 4 at x = ±3; at x = 0 the value is 5.
4) The line y = a: a < 0 — 0 roots; a = 0 — 4; 0 < a < 4 — 8; a = 4 — 6; 4 < a < 5 — 4; a = 5 — 3; a > 5 — 2 roots.
Exactly 8 roots: 0 < a < 4, integer values 1, 2, 3.
Answer: 3.
Going deeper

With two variables, |x| + |y| = 1 is a square standing on a corner, with vertices (1, 0), (0, 1), (−1, 0), (0, −1): in quadrant I the bars open as x + y = 1, in II as −x + y = 1, in III as −x − y = 1, in IV as x − y = 1. It is the “circle” of radius 1 for the taxicab distance d = |x₁ − x₂| + |y₁ − y₂| — the distance a taxi drives along a grid of streets. At university such distances are called norms; this one (the ℓ₁ norm) is used, for example, in machine learning.

Points with integer coordinates

Problem

How many points with integer coordinates satisfy |x| + |y| ≤ 2?

Show solutionHide solution

Solution

Count column by column: x = 0: y = −2, …, 2 — 5 points; x = ±1: |y| ≤ 1 — 3 points each; x = ±2: y = 0 — 1 point each.
Total: 5 + 2 · 3 + 2 · 1 = 13. In general, |x| + |y| ≤ n holds for 2n² + 2n + 1 integer points (for n = 2: 8 + 4 + 1 = 13).
Coded tasks: write the answer as a number
  1. 1.The sum of the roots of |2x + 3| = 7:
  2. 2.The number of integer solutions of |x − 4| ≤ 3:
  3. 3.The number of integer roots of |x − 2| + |x + 3| = 5:
  4. 4.The product of the roots of |x² − x| = 2:
  5. 5.The number of roots of |x² − 6|x| + 5| = 5:

Remember

  • |a − b| is the distance between the points a and b; |f(x)| = a (a > 0) ⇔ f(x) = ±a, and there are no roots if a < 0.
  • For |f| = g first the condition g ≥ 0, then f = ±g; |f| = |g| ⇔ f = ±g with no condition.
  • Several absolute values: zeros → intervals → open → solve and check the root against its interval.
  • |f| < g is a system, |f| > g is a union, |f| < |g| ⇔ (f − g)(f + g) < 0.
  • With a parameter, the number of roots is the number of intersections of y = F(x) with the line y = a.
Spotted a mistake or something inaccurate in this lesson?

Check yourself

12 questions. Every correct answer earns XP.

Question 1 / 12

Question 1 / 12. What is the geometric meaning of |x − 5|?