TExcelTAD
Home › Calculus in Depth › Numbers, Inequalities and Absolute Values

Numbers, Inequalities and Absolute Values

This reference lesson covers the number line, interval notation, the rules for solving inequalities and how absolute values describe distance. They are the language of every ε\varepsilon-δ\delta argument later in the course, and the same idea shows up in code as "close enough" checks with a tolerance.

The real number line

Set Symbol Examples Notes
Natural numbers N\mathbb{N} 1, 2, 3, … counting
Integers Z\mathbb{Z} …, −2, −1, 0, 1, 2, … closed under subtraction
Rationals Q\mathbb{Q} 34,−72,0.125\frac{3}{4}, -\frac{7}{2}, 0.125 pq\frac{p}{q} with q≠0q \ne 0; decimals end or repeat
Reals R\mathbb{R} 2,π,e,0.1010010001…\sqrt{2}, \pi, e, 0.1010010001\ldots every point on the line

The rationals have gaps: 2\sqrt{2} is not a fraction. The reals fill every gap. That is the completeness property: every non-empty set of reals that is bounded above has a least upper bound. Limits, the Intermediate Value Theorem and convergent series all depend on it.

Interval notation

Notation Set Picture
(a,b)(a, b) a<x<ba < x < b open: endpoints excluded
[a,b][a, b] a≤x≤ba \le x \le b closed: endpoints included
[a,b)[a, b) a≤x<ba \le x < b half-open
(a,∞)(a, \infty) x>ax > a ∞\infty is never included
(−∞,b](-\infty, b] x≤bx \le b
(−∞,∞)(-\infty, \infty) all of R\mathbb{R}

Rules for inequalities

1. If a<b, then a+c<b+c(add anything)2. If a<b and c<d, then a+c<b+d(add two inequalities)3. If a<b and c>0, then ac<bc(multiply by a positive)4. If a<b and c<0, then ac>bc(multiply by a negative: FLIP)5. If 0<a<b, then 1a>1b(reciprocals of positives: FLIP)\begin{aligned} &1.\ \text{If } a < b, \text{ then } a + c < b + c && \text{(add anything)} \\ &2.\ \text{If } a < b \text{ and } c < d, \text{ then } a + c < b + d && \text{(add two inequalities)} \\ &3.\ \text{If } a < b \text{ and } c > 0, \text{ then } ac < bc && \text{(multiply by a positive)} \\ &4.\ \text{If } a < b \text{ and } c < 0, \text{ then } ac > bc && \text{(multiply by a negative: FLIP)} \\ &5.\ \text{If } 0 < a < b, \text{ then } \frac{1}{a} > \frac{1}{b} && \text{(reciprocals of positives: FLIP)} \end{aligned}

Rule 4 is the one people forget. To solve a quadratic or rational inequality, move everything to one side, factor, and use a sign chart: the expression can only change sign at its zeros (and at points where it is undefined).

x2−x−6<0(x−3)(x+2)<0zeros at −2 and 3:x<−2:(−)(−)=+−2<x<3:(−)(+)=−x>3:(+)(+)=+solution: (−2,3)\begin{aligned} x^2 - x - 6 &< 0 \\ (x - 3)(x + 2) &< 0 \\ &\text{zeros at } -2 \text{ and } 3: \quad x < -2: (-)(-) = + \qquad -2 < x < 3: (-)(+) = - \qquad x > 3: (+)(+) = + \\ &\text{solution: } (-2, 3) \end{aligned}

SymPy solves inequalities and reports intervals:

python · try it yourself
import sympy as sp

x = sp.symbols('x', real=True)
print(sp.solve_univariate_inequality(x**2 - x - 6 < 0, x, relational=False))
print(sp.solve_univariate_inequality((x - 1) / (x + 4) >= 0, x, relational=False))
print(sp.solve_univariate_inequality(sp.Abs(2*x - 5) <= 3, x, relational=False))
Interval.open(-2, 3)
Union(Interval.open(-oo, -4), Interval(1, oo))
Interval(1, 4)

Note the second answer: x=−4x = -4 is excluded because the expression is undefined there, while x=1x = 1 is included because the fraction equals 0.

Absolute value as distance

∣a∣={aif a≥0−aif a<0∣a−b∣=distance between a and b\lvert a \rvert = \begin{cases} a & \text{if } a \ge 0 \\ -a & \text{if } a < 0 \end{cases} \qquad \lvert a - b \rvert = \text{distance between } a \text{ and } b
Property Statement
Product ∣ab∣=∣a∣⋅∣b∣\lvert ab \rvert = \lvert a \rvert \cdot \lvert b \rvert
Quotient ∣a/b∣=∣a∣/∣b∣\lvert a/b \rvert = \lvert a \rvert / \lvert b \rvert (b≠0b \ne 0)
Square root a2=∣a∣\sqrt{a^2} = \lvert a \rvert
Within aa ∣x∣<a  ⟺  −a<x<a\lvert x \rvert < a \iff -a < x < a (a>0a > 0)
Outside aa ∣x∣>a  ⟺  x<−a\lvert x \rvert > a \iff x < -a or x>ax > a
Triangle inequality ∣a+b∣≤∣a∣+∣b∣\lvert a + b \rvert \le \lvert a \rvert + \lvert b \rvert

The triangle inequality is the workhorse of limit proofs: if ff is within ε/2\varepsilon/2 of LL and gg within ε/2\varepsilon/2 of MM, then f+gf + g is within ε\varepsilon of L+ML + M. Proof: −∣a∣≤a≤∣a∣-\lvert a \rvert \le a \le \lvert a \rvert and −∣b∣≤b≤∣b∣-\lvert b \rvert \le b \le \lvert b \rvert; add them to get −(∣a∣+∣b∣)≤a+b≤∣a∣+∣b∣-(\lvert a \rvert + \lvert b \rvert) \le a + b \le \lvert a \rvert + \lvert b \rvert, which is ∣a+b∣≤∣a∣+∣b∣\lvert a + b \rvert \le \lvert a \rvert + \lvert b \rvert by the "within" rule.

python · try it yourself
import numpy as np

rng = np.random.default_rng(7)
a, b = rng.uniform(-10, 10, 100_000), rng.uniform(-10, 10, 100_000)
gap = np.abs(a) + np.abs(b) - np.abs(a + b)
print("violations:", int(np.sum(gap < 0)))
print("equality cases (same sign) fraction:", round(float(np.mean(gap < 1e-12)), 3))
violations: 0
equality cases (same sign) fraction: 0.5

Equality holds exactly when aa and bb have the same sign (or one is 0), which happens for half of the random pairs.

In software

  • Tolerance comparisons. abs(a - b) <= tol is the statement ∣a−b∣≤tol\lvert a - b \rvert \le \text{tol}: "aa lies in the interval [b−tol,b+tol][b - \text{tol}, b + \text{tol}]". Floating-point code needs it because 0.1+0.2≠0.30.1 + 0.2 \ne 0.3 exactly. Python's math.isclose combines a relative and an absolute tolerance.
  • Bounds and clamping. Range checks (0 <= i < n), clamp(x, lo, hi) and axis-aligned bounding boxes are interval membership tests, one per axis.
  • Error budgets. Numerical code splits a total allowed error ε\varepsilon into pieces, exactly as the triangle inequality does in proofs.
python · try it yourself
import math

a = 0.1 + 0.2
print(a == 0.3, abs(a - 0.3))
print(math.isclose(a, 0.3), math.isclose(1e-12, 0.0), math.isclose(1e-12, 0.0, abs_tol=1e-9))
False 5.551115123125783e-17
True False True

A purely relative tolerance never accepts anything as close to 0, so comparisons with 0 need abs_tol. See The Precise Definition of a Limit for how these intervals become ε\varepsilon and δ\delta.

Exercises

Exercise 1: A rational inequality

Solve 2x+1x−3<1\frac{2x + 1}{x - 3} < 1.

Answer

−4<x<3-4 < x < 3, the interval (−4,3)(-4, 3).

Solution

Do not multiply by x−3x - 3 (its sign is unknown). Move everything to one side:

2x+1x−3−1<02x+1−x+3x−3<0x+4x−3<0sign chart: zeros/poles at −4 and 3; negative only between them→(−4,3)\begin{aligned} \frac{2x + 1}{x - 3} - 1 &< 0 \\ \frac{2x + 1 - x + 3}{x - 3} &< 0 \\ \frac{x + 4}{x - 3} &< 0 \\ &\text{sign chart: zeros/poles at } -4 \text{ and } 3;\ \text{negative only between them} \to (-4, 3) \end{aligned}

Exercise 2: Absolute value inequality

Solve ∣3−2x∣≥5\lvert 3 - 2x \rvert \ge 5.

Answer

x≤−1x \le -1 or x≥4x \ge 4, i.e. (−∞,−1]∪[4,∞)(-\infty, -1] \cup [4, \infty).

Solution
3−2x≥5  →  −2x≥2  →  x≤−1(dividing by −2 flips)3−2x≤−5  →  −2x≤−8  →  x≥4\begin{aligned} 3 - 2x \ge 5 &\;\to\; -2x \ge 2 \;\to\; x \le -1 && \text{(dividing by } -2 \text{ flips)} \\ 3 - 2x \le -5 &\;\to\; -2x \le -8 \;\to\; x \ge 4 \end{aligned}

Exercise 3: A bound used in limit proofs

Show that if ∣x−2∣<1\lvert x - 2 \rvert < 1 then ∣x+2∣<5\lvert x + 2 \rvert < 5, and hence ∣x2−4∣<5∣x−2∣\lvert x^2 - 4 \rvert < 5\lvert x - 2 \rvert.

Answer

From 1<x<31 < x < 3 we get 3<x+2<53 < x + 2 < 5, so ∣x+2∣<5\lvert x + 2 \rvert < 5, and ∣x2−4∣=∣x−2∣⋅∣x+2∣<5∣x−2∣\lvert x^2 - 4 \rvert = \lvert x - 2 \rvert \cdot \lvert x + 2 \rvert < 5\lvert x - 2 \rvert.

Solution
∣x−2∣<1  ⟺  1<x<3  ⟹  3<x+2<5  ⟹  ∣x+2∣<5∣x2−4∣=∣(x−2)(x+2)∣=∣x−2∣⋅∣x+2∣<5∣x−2∣\begin{aligned} &\lvert x - 2 \rvert < 1 \iff 1 < x < 3 \implies 3 < x + 2 < 5 \implies \lvert x + 2 \rvert < 5 \\ &\lvert x^2 - 4 \rvert = \lvert (x - 2)(x + 2) \rvert = \lvert x - 2 \rvert \cdot \lvert x + 2 \rvert < 5\lvert x - 2 \rvert \end{aligned}

This is the standard trick for proving lim⁡x→2x2=4\lim_{x \to 2} x^2 = 4: choose δ=min⁡(1,ε/5)\delta = \min(1, \varepsilon/5).

Exercise 4: Check with code

Test the claim of Exercise 3 on 10 000 random xx in (1,3)(1, 3) and print the largest ratio ∣x2−4∣/∣x−2∣\lvert x^2 - 4 \rvert / \lvert x - 2 \rvert.

Answer

The ratio equals x+2x + 2, so its largest value is just under 5 (about 5.0).

Solution
python · try it yourself
import numpy as np

x = np.random.default_rng(1).uniform(1, 3, 10_000)
ratio = np.abs(x**2 - 4) / np.abs(x - 2)
print(round(float(ratio.max()), 4), bool(ratio.max() < 5))
4.9997 True

Test yourself

What is the solution set of x2<9x^2 < 9?

  1. x<3x < 3
  2. (−3,3)(-3, 3)
  3. x<−3x < -3 or x>3x > 3
  4. [−3,3][-3, 3]

If a<ba < b, which is always true?

  1. a2<b2a^2 < b^2
  2. 1a>1b\frac{1}{a} > \frac{1}{b}
  3. −2a>−2b-2a > -2b
  4. ∣a∣<∣b∣\lvert a \rvert < \lvert b \rvert

Which statement is the triangle inequality?

  1. ∣a−b∣=∣a∣−∣b∣\lvert a - b \rvert = \lvert a \rvert - \lvert b \rvert
  2. ∣ab∣≤∣a∣+∣b∣\lvert ab \rvert \le \lvert a \rvert + \lvert b \rvert
  3. ∣a+b∣≥∣a∣+∣b∣\lvert a + b \rvert \ge \lvert a \rvert + \lvert b \rvert
  4. ∣a+b∣≤∣a∣+∣b∣\lvert a + b \rvert \le \lvert a \rvert + \lvert b \rvert