STEMviz
Mathematics · Algebra, Number Theory and Sequences

Number Sets and Operations on Sets

Classify numbers across N, Z, Q and R, and master set notation, set operations and interval notation on the real line.

Number Sets and Operations on Sets

Every branch of mathematics you will meet in this course — sequences, functions, calculus, probability — takes place inside some set of numbers, and a huge number of careless errors on an exam come from forgetting which set is in play: dividing by an integer when a real number was required, or quoting a solution that happens not to exist in the set the question restricted you to. This chapter fixes the vocabulary and notation for talking about collections of numbers precisely: the number sets themselves, the symbols used to relate an element to a set and a set to another set, the operations that combine sets, and the interval notation used to describe continuous stretches of the real line. None of this is difficult, but all of it is used, silently, in every later chapter.

Have to hand: a clear diagram convention for number lines and Venn diagrams, and patience with notation — the ideas are simple, the symbols are the entire content of this chapter.

1. The Hierarchy of Number Sets

Mathematics builds its number systems in layers, each one solving a limitation of the layer below it.

The natural numbers, denoted N\mathbb{N}, are the counting numbers {0,1,2,3,…}\{0, 1, 2, 3, \ldots\} (some authors exclude 00; in this course N={0,1,2,3,…}\mathbb{N} = \{0, 1, 2, 3, \ldots\} unless stated otherwise). They are closed under addition and multiplication, but not under subtraction: 3−53 - 5 has no answer in N\mathbb{N}.

The integers, Z\mathbb{Z} (from German Zahlen), repair this by adjoining the negative whole numbers: Z={…,−2,−1,0,1,2,…}\mathbb{Z} = \{\ldots, -2, -1, 0, 1, 2, \ldots\}. Now subtraction is always possible, but division is not: 23\dfrac{2}{3} has no answer in Z\mathbb{Z}.

The rational numbers, Q\mathbb{Q} (from quotient), repair this again:

Q={pq:p∈Z, q∈Z, q≠0}\mathbb{Q} = \left\{ \frac{p}{q} : p \in \mathbb{Z},\ q \in \mathbb{Z},\ q \neq 0 \right\}

Every rational number has a decimal expansion that either terminates (e.g. 14=0.25\dfrac{1}{4} = 0.25) or recurs — repeats a finite block of digits forever (e.g. 13=0.333…=0.3‾\dfrac{1}{3} = 0.333\ldots = 0.\overline{3}, or 17=0.142857‾\dfrac{1}{7} = 0.\overline{142857}). This is not a coincidence: the long-division algorithm for p÷qp \div q can only ever produce one of finitely many remainders (0,1,…,q−10, 1, \ldots, q-1), so after at most qq steps a remainder must repeat, and from that point the digits repeat too.

Rational versus irrational, by decimal expansion. A number is rational if and only if its decimal expansion terminates or recurs. A number whose decimal expansion is infinite and non-recurring is irrational — it cannot be written as pq\dfrac{p}{q} for any integers p,qp, q with q≠0q \neq 0.

The existence of irrational numbers is itself a fact that needs a demonstration, not just a definition.

Worked example — 2\sqrt{2} is irrational. Suppose, for contradiction, that 2\sqrt{2} were rational, so that 2=pq\sqrt{2} = \dfrac{p}{q} for some integers p,qp, q with no common factor (the fraction is in lowest terms) and q≠0q \neq 0. Squaring,

2=p2q2⟹p2=2q22 = \frac{p^2}{q^2} \quad\Longrightarrow\quad p^2 = 2q^2

so p2p^2 is even, which forces pp itself to be even (the square of an odd number is odd). Write p=2kp = 2k. Then

(2k)2=2q2⟹4k2=2q2⟹q2=2k2(2k)^2 = 2q^2 \quad\Longrightarrow\quad 4k^2 = 2q^2 \quad\Longrightarrow\quad q^2 = 2k^2

so q2q^2 is even, and hence qq is even too. But then pp and qq are both even, contradicting the assumption that pq\dfrac{p}{q} was in lowest terms. The assumption must be false: 2\sqrt{2} cannot be written as a ratio of integers, so 2\sqrt{2} is irrational. (This style of argument — assume the opposite and derive a contradiction — is developed formally in the next chapter; here it only serves to show that irrational numbers genuinely exist and are not a technicality.)

The set of all rationals together with all irrationals is the real numbers, R\mathbb{R} — every point on the number line. Collecting the hierarchy:

N⊂Z⊂Q⊂R\mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R}

Later in this block (Chapters 13–15) a still larger set, the complex numbers C\mathbb{C}, will be built on top of R\mathbb{R} to give every polynomial a root; it plays no part here.

2. Subsets with a Sign or a Restriction

Several commonly used subsets restrict a number set by sign or by excluding zero. The convention used throughout this course:

  • Z+={1,2,3,…}\mathbb{Z}^{+} = \{1, 2, 3, \ldots\} — positive integers (excludes 00).
  • Z−={−1,−2,−3,…}\mathbb{Z}^{-} = \{-1, -2, -3, \ldots\} — negative integers.
  • Q+,R+\mathbb{Q}^{+}, \mathbb{R}^{+} — positive rationals, positive reals (excluding 00).
  • R0+\mathbb{R}^{+}_{0} or R≥0\mathbb{R}^{\geq 0} — non-negative reals (including 00); notation varies by source, so a question that needs it will state its convention explicitly.
  • Q′\mathbb{Q}' (or R∖Q\mathbb{R} \setminus \mathbb{Q}) — the irrational numbers: real numbers that are not rational.

Note that Q′\mathbb{Q}' is not a subset of Q\mathbb{Q} sitting inside the hierarchy above — it is the complement of Q\mathbb{Q} within R\mathbb{R}, a set operation made precise in Section 4.

3. Set Membership and Subset Relations

A set is a well-defined collection of objects, called its elements. If xx is an element of a set AA, we write x∈Ax \in A (read "xx belongs to AA" or "xx is an element of AA"); if not, x∉Ax \notin A. For example, −3∈Z-3 \in \mathbb{Z} but −3∉N-3 \notin \mathbb{N}, and 2∈R\sqrt{2} \in \mathbb{R} but 2∉Q\sqrt{2} \notin \mathbb{Q}.

A set AA is a subset of a set BB, written A⊆BA \subseteq B, if every element of AA is also an element of BB. If in addition A≠BA \neq B (there is at least one element of BB not in AA), AA is a proper subset of BB, written A⊂BA \subset B. This is exactly the relation used in N⊂Z⊂Q⊂R\mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R}: every natural number is an integer, but not every integer is natural (e.g. −5-5), so the inclusion is proper at each stage.

The empty set, ∅\varnothing (or {}\{\}), is the set with no elements at all. It is a subset of every set, including itself: ∅⊆A\varnothing \subseteq A for any set AA, vacuously, since there is no element of ∅\varnothing that could fail to be in AA.

Sets can be described either by listing their elements, A={2,3,5,7}A = \{2, 3, 5, 7\}, or by set-builder notation, which states a rule:

A={x∈Z:1<x<10, x is prime}A = \{ x \in \mathbb{Z} : 1 < x < 10,\ x \text{ is prime} \}

read "the set of all xx in Z\mathbb{Z} such that 1<x<101 < x < 10 and xx is prime." The colon (sometimes a vertical bar ∣|) separates the variable and its domain from the condition it must satisfy.

4. Operations on Sets

Given two sets AA and BB, usually regarded as subsets of some fixed universal set UU relevant to the problem (for number sets, UU is typically R\mathbb{R}), four operations combine or restrict them.

Union, A∪BA \cup B: all elements in AA, or in BB, or in both.

A∪B={x:x∈A or x∈B}A \cup B = \{ x : x \in A \text{ or } x \in B \}

Intersection, A∩BA \cap B: all elements in both AA and BB.

A∩B={x:x∈A and x∈B}A \cap B = \{ x : x \in A \text{ and } x \in B \}

If A∩B=∅A \cap B = \varnothing, the sets are called disjoint — they share no elements.

Complement, A′A' (also written AcA^c or A‾\overline{A}): everything in the universal set that is not in AA.

A′={x∈U:x∉A}A' = \{ x \in U : x \notin A \}

Set difference, A∖BA \setminus B (also written A−BA - B): elements of AA that are not in BB.

A∖B={x:x∈A and x∉B}=A∩B′A \setminus B = \{ x : x \in A \text{ and } x \notin B \} = A \cap B'

Note that A∖BA \setminus B and B∖AB \setminus A are generally different sets — set difference is not symmetric, unlike union and intersection.

Reading a Venn diagram. With UU as the rectangle and AA, BB as overlapping circles inside it: A∪BA \cup B is everything inside either circle; A∩BA \cap B is only the overlapping lens; A′A' is everything outside circle AA (including outside both circles); A∖BA \setminus B is the part of circle AA outside circle BB — the crescent, not the lens.

Worked example — a Venn diagram problem. Let U={1,2,…,12}U = \{1, 2, \ldots, 12\}, A={x∈U:x is even}={2,4,6,8,10,12}A = \{x \in U : x \text{ is even}\} = \{2,4,6,8,10,12\}, and B={x∈U:x is a multiple of 3}={3,6,9,12}B = \{x \in U : x \text{ is a multiple of } 3\} = \{3,6,9,12\}. Find A∪BA \cup B, A∩BA \cap B, A′A', and A∖BA \setminus B.

  • A∩B={6,12}A \cap B = \{6, 12\} — the even multiples of 33.
  • A∪B={2,3,4,6,8,9,10,12}A \cup B = \{2,3,4,6,8,9,10,12\} — every element of AA together with every element of BB, counting the overlap {6,12}\{6,12\} only once.
  • A′={1,3,5,7,9,11}A' = \{1,3,5,7,9,11\} — the odd numbers in UU.
  • A∖B={2,4,8,10}A \setminus B = \{2,4,8,10\} — the even numbers that are not multiples of 33 (remove 66 and 1212 from AA).

A useful check: for finite sets, n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B), where n(⋅)n(\cdot) denotes the number of elements. Here n(A)=6n(A) = 6, n(B)=4n(B) = 4, n(A∩B)=2n(A \cap B) = 2, so n(A∪B)=6+4−2=8n(A \cup B) = 6 + 4 - 2 = 8, matching the eight elements listed above. This counting rule returns in Chapter 11 as the inclusion–exclusion principle.

De Morgan's laws relate complement to union and intersection, and are worth memorising because they are used constantly when negating compound conditions:

(A∪B)′=A′∩B′(A∩B)′=A′∪B′(A \cup B)' = A' \cap B' \qquad\qquad (A \cap B)' = A' \cup B'

In words: "not (in AA or BB)" means "not in AA, and not in BB"; "not (in AA and BB)" means "not in AA, or not in BB."

5. Interval Notation on R\mathbb{R}

A great many sets you will meet are not lists of discrete numbers but entire stretches of the real line, described by an inequality. Interval notation is the shorthand for these.

  • [a,b]={x∈R:a≤x≤b}[a, b] = \{x \in \mathbb{R} : a \leq x \leq b\} — a closed interval: both endpoints included (square bracket = included, solid dot on a number line).
  • (a,b)={x∈R:a<x<b}(a, b) = \{x \in \mathbb{R} : a < x < b\} — an open interval: both endpoints excluded (round bracket = excluded, open circle).
  • [a,b)[a, b) and (a,b](a, b] — half-open (or half-closed) intervals, with one endpoint included and the other excluded.
  • [a,∞)={x∈R:x≥a}[a, \infty) = \{x \in \mathbb{R} : x \geq a\} and (−∞,a]={x∈R:x≤a}(-\infty, a] = \{x \in \mathbb{R} : x \leq a\} — unbounded intervals. The symbol ∞\infty is never an endpoint that can be "included," so it always takes a round bracket.
  • (−∞,∞)=R(-\infty, \infty) = \mathbb{R} itself.

The common slip with brackets. [a,b][a,b] and (a,b)(a,b) describe different sets even when aa and bb are the same two numbers — (a,b)(a,b) is missing exactly two points, aa and bb, that [a,b][a,b] contains. In a question asking for the domain of x−3\sqrt{x-3}, the correct answer is [3,∞)[3, \infty), not (3,∞)(3, \infty), because x=3x=3 gives 0=0\sqrt{0}=0, a perfectly valid real output.

Intervals combine with the same union, intersection and complement operations as any other sets.

Worked example — combining intervals. Let A=[−2,5)A = [-2, 5) and B=(1,8]B = (1, 8], both subsets of U=RU = \mathbb{R}. Find A∩BA \cap B, A∪BA \cup B, and A∖BA \setminus B.

Sketching both on a number line: AA runs from −2-2 (included) to 55 (excluded); BB runs from 11 (excluded) to 88 (included). They overlap between 11 and 55:

A∩B=(1,5)A \cap B = (1, 5)

both endpoints excluded, since 1∉A∩B1 \notin A \cap B (11 is excluded from BB) and 5∉A∩B5 \notin A \cap B (55 is excluded from AA). The union runs continuously from the leftmost included point to the rightmost included point, since the two intervals overlap (no gap):

A∪B=[−2,8]A \cup B = [-2, 8]

with both endpoints now included, since −2∈A-2 \in A and 8∈B8 \in B. Finally A∖BA \setminus B keeps only the part of AA that lies before BB begins — everything in AA from 11 onwards (exclusive) is removed, because (1,5)⊂B(1,5) \subset B:

A∖B=[−2,1]A \setminus B = [-2, 1]

Here the right endpoint 11 is now included, because 1∈A1 \in A (since −2≤1<5-2 \leq 1 < 5) and 1∉B1 \notin B (since BB excludes 11) — removing BB from AA does not remove the single point 11, which BB never contained.

This last result is the one students most often get wrong, which is why it is worth a second look: set difference does not simply "cut the interval at the same place as the other endpoint and copy its bracket type." Each endpoint of the answer must be checked individually against the definitions of AA and BB.

6. Interval Notation versus Inequality Notation

Every interval can equally be written as a compound inequality, and IB exams move freely between the two, so fluency with both is required:

x∈[−2,5)⟺−2≤x<5x \in [-2, 5) \quad\Longleftrightarrow\quad -2 \leq x < 5

A set defined by a union of disjoint conditions, such as x<−1x < -1 or x≥4x \geq 4, is written as a union of intervals since no single interval can express it:

(−∞,−1)∪[4,∞)(-\infty, -1) \cup [4, \infty)

This situation arises constantly when solving inequalities (quadratic inequalities, rational inequalities — Block B) whose solution set is not a single connected stretch of the line.

7. Common Exam Pitfalls

  • Treating N\mathbb{N} as including or excluding 00 inconsistently. Different textbooks disagree; state the convention you are using (or follow the one given in the question) and apply it consistently within a single solution.
  • Confusing ⊂\subset with ∈\in. 2∈Z2 \in \mathbb{Z} is correct; {2}⊂Z\{2\} \subset \mathbb{Z} is correct; but 2⊂Z2 \subset \mathbb{Z} is meaningless — a single number cannot be a subset of anything, only an element.
  • Swapping bracket types when writing an interval from an inequality. x≤7x \leq 7 becomes (−∞,7](-\infty, 7], not (−∞,7)(-\infty, 7) — the included endpoint of the inequality must carry a square bracket.
  • Getting the endpoint of a set difference wrong. As in the worked example above, A∖BA \setminus B requires checking each boundary point individually against both sets' own inclusion rules, not just copying brackets.
  • Assuming every real number is "rational or irrational" is itself in doubt. It is a definitional fact, not something to verify case by case — but students sometimes try to classify a number like π+1\pi + 1 by decimal inspection alone, which cannot establish irrationality (a calculator only ever shows finitely many digits, which can never distinguish "eventually recurring" from "never recurring").
  • Forgetting that ∞\infty always takes a round bracket. Writing [4,∞][4, \infty] is not standard notation; infinity is not a number that an interval can "contain."

Summary

  • The number sets nest: N⊂Z⊂Q⊂R\mathbb{N} \subset \mathbb{Z} \subset \mathbb{Q} \subset \mathbb{R}, each layer repairing an operation the smaller set could not perform (subtraction, then division, then roots/limits).
  • A number is rational exactly when its decimal expansion terminates or recurs; otherwise it is irrational. 2\sqrt{2} is irrational, proved by contradiction from the assumption that it equals pq\dfrac{p}{q} in lowest terms.
  • x∈Ax \in A means xx is an element of AA; A⊆BA \subseteq B means every element of AA is in BB; A⊂BA \subset B adds that A≠BA \neq B. The empty set ∅\varnothing is a subset of every set.
  • Set operations: A∪BA \cup B (in either), A∩BA \cap B (in both), A′A' (not in AA, within UU), A∖B=A∩B′A \setminus B = A \cap B' (in AA but not BB). De Morgan: (A∪B)′=A′∩B′(A \cup B)' = A' \cap B' and (A∩B)′=A′∪B′(A \cap B)' = A' \cup B'.
  • For finite sets, n(A∪B)=n(A)+n(B)−n(A∩B)n(A \cup B) = n(A) + n(B) - n(A \cap B).
  • Interval notation: square brackets include an endpoint, round brackets exclude it; ∞\infty always takes a round bracket. [a,b][a,b], (a,b)(a,b), [a,b)[a,b), (a,b](a,b], [a,∞)[a,\infty), (−∞,a](-\infty,a] cover every bounded or one-sided unbounded case.
  • Combining intervals under ∪\cup, ∩\cap, ∖\setminus requires checking each resulting endpoint's inclusion individually against the original sets — it cannot be read off by a shortcut.