Treci la conținut

Lecția 2 · Getting Started

Number Sets and Interval Notation

Learn the number sets from natural numbers to reals, how to write intervals and unions, and how to test membership with runnable Python code.

Before you can describe where a function lives, you need a language for sets of numbers. Mathematicians group numbers into families and write ranges of values in a compact notation called interval notation. You will use this notation in every later lesson, especially when stating the domain and range of a function.

This lesson reviews the number sets, then teaches intervals, unions and how to read them on a number line.

The number sets

Each set contains the one before it.

Symbol Name Examples
ℕ Natural numbers 1, 2, 3, ... (some books include 0)
ℤ Integers ..., -2, -1, 0, 1, 2, ...
ℚ Rational numbers 3/4, -5, 0.2, 1.333... (repeating)
ℝ Real numbers everything on the number line

A rational number is a number that can be written as a fraction p/q of two integers with q ≠ 0. A decimal that stops or repeats is rational. Numbers such as √2 and π are real but irrational: their decimals never stop and never repeat.

flowchart TB
R["Real numbers"] --> Q["Rational numbers"]
R --> I["Irrational numbers"]
Q --> Z["Integers"]
Z --> N["Natural numbers"]

Naturals sit inside integers, integers inside rationals, and rationals plus irrationals make the reals.

Python can test whether a number is exactly a fraction by using the fractions module.

Python Rational numbers as exact fractions

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Interval notation

An interval is all the real numbers between two endpoints. Round brackets mean the endpoint is not included. Square brackets mean it is included.

Interval Inequality Meaning
(a, b) a < x < b between a and b, ends excluded
[a, b] a ≤ x ≤ b between a and b, ends included
[a, b) a ≤ x < b includes a, excludes b
(a, ∞) x > a everything above a
(-∞, b] x ≤ b everything up to and including b

Infinity is not a number, so it always gets a round bracket. The notation (-∞, ∞) means all real numbers.

Reading and writing intervals

  • x ≥ 2 becomes [2, ∞).
  • -1 < x ≤ 5 becomes (-1, 5].
  • x < -3 becomes (-∞, -3).

On a number line, draw a filled dot for an included endpoint and an open dot for an excluded one.

Unions and intersections

The union A ∪ B contains numbers that are in A or in B (or both). The intersection A ∩ B contains numbers in both.

Example: x < -1 or x ≥ 3 is written (-∞, -1) ∪ [3, ∞). There is a gap between -1 and 3, so a single interval cannot describe it.

Example: x > 0 and x ≤ 4 is the intersection (0, ∞) ∩ (-∞, 4] = (0, 4].

The excluded single point deserves a mention. All real numbers except 2 is (-∞, 2) ∪ (2, ∞). You will see this exact pattern constantly when a function is undefined at one input.

Now build a small tool that tests whether a number belongs to an interval. It stores each interval as two endpoints and two flags for the brackets.

Python An interval membership checker

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Absolute value and distance

The absolute value |x| is the distance from x to 0, so it is never negative. More generally |x - a| is the distance between x and a.

  • |x| < 3 means x is within 3 units of 0: (-3, 3).
  • |x| > 3 means x is more than 3 units away: (-∞, -3) ∪ (3, ∞).
  • |x - 2| ≤ 1 means x is within 1 of 2: [1, 3].

Distance language is useful because later, in the limits chapter, "close to" will be written exactly this way.

Python Distance from a point

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Always use a round bracket next to ∞ or -∞. Writing [2, ∞] is a common mistake, because infinity is not a number you can reach.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. Which is the interval notation for x ≥ 2?

    2 is included, so a square bracket. Infinity always takes a round bracket.
  2. 2. Which number is irrational?

    √2 cannot be written as a fraction of integers. The others are all rational.
  3. 3. What is the solution set of |x| > 3 in interval notation?

    Numbers more than 3 units from 0 are below -3 or above 3, which needs a union.
  4. 4. Which describes all real numbers except 2?

    Two open intervals leave out exactly 2. The second option includes 2.

Summary

  • The number sets nest: ℕ inside ℤ inside ℚ inside ℝ; irrational numbers are real but not rational.
  • Interval notation uses round brackets for excluded endpoints and square brackets for included ones.
  • Infinity always gets a round bracket.
  • Use ∪ for "or" and ∩ for "and"; |x - a| < r means within r of a.

Next: The Algebra Toolkit

Urmărește-ți progresul

Creează un cont gratuit ca să bifezi lecțiile și să reiei de unde ai rămas, pe orice dispozitiv.