SigmaField
Mathematical Foundations for Quant Finance
0 of 256 lessons

Level 0, Orientation and fluency 0.3 Algebra fluency Lesson 3 of 5

ConceptLesson 0.3.3 in Level 0, Orientation and fluency. About 15 minutes.

Inequalities and absolute value

Inequalities

An inequality compares two sides that need not be equal. x<3x < 3 reads "xx is less than 3" and x≤3x \le 3 reads "xx is at most 3", which allows 3 itself. The symbols >> and ≥\ge work the same way the other way round.

The answer to an inequality is usually a whole range of numbers, not one number. Write it as an interval: x<3x < 3 is (−∞,3)(-\infty, 3), and −1≤x<3-1 \le x < 3 is [−1,3)[-1, 3). A square bracket includes its end; a round bracket leaves it out. The symbol ∞\infty (infinity) only says "no end on this side", so it always gets a round bracket.

Solving a linear inequality

Solve an inequality exactly like an equation, with one exception.

Rule: Multiplying by a negative flips the sign

a<b⟹−a>−ba < b \quad\Longrightarrow\quad -a > -b

You may add or subtract anything on both sides, and multiply or divide by a positive number. If you multiply or divide by a negative number, reverse the direction of the sign.

Why? Multiplying by −1-1 mirrors the number line. 2 is less than 5, but −2-2 is greater than −5-5. Here is 3−2x>73 - 2x > 7 solved:

  1. 1
    3−2x>73 - 2x > 7
  2. 2
    −2x>4-2x > 4
  3. 3
    x<−2x < -2

Try it

Test the answer on many numbers at once. The cell makes the whole numbers from −5 to 5 and keeps those that satisfy the original inequality.

Only −5, −4 and −3 pass, which matches x<−2x < -2. Check one by hand: x=−3x = -3 gives 3+6=93 + 6 = 9, and 9>79 > 7.

⌘/Ctrl + Enter runs the cell

Absolute value

The absolute value ∣x∣|x| is the distance from xx to 0 on the number line. Distances are never negative, so ∣−5∣=5|-5| = 5 and ∣3∣=3|3| = 3.

Rule: Absolute value

∣x∣={xif x≥0−xif x<0|x| = \begin{cases} x & \text{if } x \ge 0 \\ -x & \text{if } x < 0 \end{cases}

Keep a positive number as it is; drop the minus sign from a negative one. More usefully, ∣a−b∣|a - b| is the distance between aa and bb, whichever is larger.

Try it

Python's abs is the absolute value, and NumPy's np.abs works on whole arrays.

The last line shows that ∣a+b∣|a + b| is not ∣a∣+∣b∣|a| + |b| when the signs differ: ∣3+(−5)∣=2|3 + (-5)| = 2, but ∣3∣+∣−5∣=8|3| + |-5| = 8.

⌘/Ctrl + Enter runs the cell

Equations with absolute values

∣x−3∣=5|x - 3| = 5 says "xx is at distance 5 from 3". There are two such numbers, one on each side: x−3=5x - 3 = 5 or x−3=−5x - 3 = -5, so x=8x = 8 or x=−2x = -2.

Rule: Absolute value equations

∣x−a∣=b(b≥0)meansx=a+b  or  x=a−b\begin{gathered} |x - a| = b \quad (b \ge 0) \\ \text{means} \quad x = a + b \ \text{ or } \ x = a - b \end{gathered}

Split into two ordinary equations, one for each sign. If bb is negative there is no solution, because a distance cannot be negative.

Inequalities with absolute values

∣x−a∣<b|x - a| < b says "xx is within bb of aa". ∣x−a∣>b|x - a| > b says "xx is further than bb from aa". Read them as distances and the answers follow.

Rule: Absolute value inequalities

∣x−a∣<bmeansa−b<x<a+b∣x−a∣>bmeansx<a−b  or  x>a+b\begin{gathered} |x - a| < b \\ \text{means} \quad a - b < x < a + b \\[12pt] |x - a| > b \\ \text{means} \quad x < a - b \ \text{ or } \ x > a + b \end{gathered}

"Within" gives one interval around aa. "Further than" gives two pieces, one on each side. The same holds with ≤\le and ≥\ge, with the ends included.

For example, ∣x−100∣≤2|x - 100| \le 2 means 98≤x≤10298 \le x \le 102: every number within 2 of 100.

Try it

Check it on the whole numbers from 95 to 105. The ones within 2 of 100 are exactly 98 to 102.

The second line flips the test to "further than 2", which keeps both ends.

⌘/Ctrl + Enter runs the cell

Common mistakes

  1. Forgetting to flip. Dividing by a negative number reverses the sign. Test one number from your answer in the original inequality.
  2. Losing the second answer. ∣x−3∣=5|x - 3| = 5 has two solutions, 8 and −2-2.
  3. Splitting absolute values over a sum. ∣a+b∣≠∣a∣+∣b∣|a + b| \neq |a| + |b| in general.
  4. Solving the impossible. ∣x∣=−3|x| = -3 and ∣x∣<0|x| < 0 have no solutions.

Inequalities and absolute value

0 of 8 correct

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
  6. 6.
  7. 7.
  8. 8.
How to type answers
  • Powers with ^: x^7, 2^(1/3), a^-2.
  • Multiply with * or by writing side by side: 3x^2, 2(x+1).
  • ln(x) is the natural log, log(x, 2) is log base 2, e is Euler's number, sqrt(x) is a square root.
  • sin(x), cos(x) and tan(x) take radians; write pi for π and sin(x)^2 for sin²x.
  • Your first answer to each question is saved: it counts towards your score and brings the question back for review.
  • Exact answers like ln(20)/ln(3) are best. Decimals need about 4 significant figures.

Summary card

  • Solve an inequality like an equation, but flip the sign when you multiply or divide by a negative number.
  • Intervals: square brackets include an end, round brackets leave it out; ∞\infty always gets a round bracket.
  • ∣x∣|x| is the distance from xx to 0, and ∣a−b∣|a - b| is the distance between aa and bb. In Python, abs or np.abs.
  • ∣x−a∣=b|x - a| = b gives x=a±bx = a \pm b. ∣x−a∣<b|x - a| < b gives a−b<x<a+ba - b < x < a + b; ∣x−a∣>b|x - a| > b gives two pieces.
  • Test answers on many numbers at once with a NumPy mask: x[condition].

Free further reading

Optional. This lesson covers what you need; these add more examples and practice. All are free to read.