Sets

learningReviewed by Claude Opus 5.5 (LLM)

Take a test
Question types
Number of questions

Nearly all of modern mathematics is written in the language of sets. Numbers, functions, spaces and structures are described as sets, or as sets equipped with extra data. This topic covers the working vocabulary: how sets are described, compared and combined, and how they are used to build new objects.

The approach is naive: a set is taken to be an intuitively understood collection. That is enough for everyday mathematics, and a later section explains where care is needed.

Conventions

Builds on

Informal familiarity with numbers, with proof by induction, and with reading mathematical statements, including “if and only if”, “for all” and “there exists”.

Sets and membership

Definition 1 (Set)

A set is a collection of objects, called its elements. We write x∈Ax \in A if xx is an element of AA, and x∉Ax \notin A otherwise.

A set is determined entirely by which elements it has.

Definition 2 (Equality of sets)

Sets AA and BB are equal, written A=BA = B, if they have exactly the same elements: for every xx, we have x∈Ax \in A if and only if x∈Bx \in B.

Small sets can be described by listing their elements between braces. Since only membership matters, order and repetition make no difference: {1,2,2}={2,1}\{1, 2, 2\} = \{2, 1\}.

The standard number sets are the natural numbers N\mathbb{N}, the integers Z\mathbb{Z}, the rational numbers Q\mathbb{Q} and the real numbers R\mathbb{R}.

Larger sets are usually described by a property.

Definition 3 (Set-builder notation)

For a set AA and a property PP, the set {x∈A:P(x)}\{x \in A : P(x)\} consists of those elements xx of AA for which P(x)P(x) holds.

A related form gives a pattern for the elements, with variables ranging over existing sets: {t(x):x∈A}\{t(x) : x \in A\} consists of the values of the expression t(x)t(x) as xx ranges over AA, and similarly with several variables.

Example 4

{n∈Z:n=2k for some k∈Z}\{n \in \mathbb{Z} : n = 2k \text{ for some } k \in \mathbb{Z}\} is the set of even integers, and {x∈R:x2=−1}\{x \in \mathbb{R} : x^2 = -1\} has no elements. In the pattern form, the even integers are {2k:k∈Z}\{2k : k \in \mathbb{Z}\}.

Definition 5 (Empty set)

The empty set ∅\emptyset is the set with no elements.

There is only one empty set, since any two sets without elements have the same elements. Sets can themselves be elements of sets, so ∅\emptyset and {∅}\{\emptyset\} are different: the first has no elements, while the second has one.

Subsets

Definition 6 (Subset)

AA is a subset of BB, written A⊆BA \subseteq B, if every element of AA is an element of BB. It is a proper subset, written A⊊BA \subsetneq B, if also A≠BA \ne B. The relation ⊆\subseteq is called inclusion.

Example 7

Membership and inclusion are different relations. For B={1,{2}}B = \{1, \{2\}\}, we have {2}∈B\{2\} \in B but {2}⊈B\{2\} \not\subseteq B, since 2∉B2 \notin B. We also have {1}⊆B\{1\} \subseteq B but {1}∉B\{1\} \notin B.

Proposition 8 (Basic properties of subsets)

For all sets AA, BB and CC:

  1. ∅⊆A\emptyset \subseteq A;
  2. A⊆AA \subseteq A;
  3. if A⊆BA \subseteq B and B⊆CB \subseteq C, then A⊆CA \subseteq C.
Proof

A counterexample to (1) would be an element of ∅\emptyset that is not in AA. Since ∅\emptyset has no elements, there is none, so the statement holds vacuously. For (2), every element of AA is an element of AA. For (3), if x∈Ax \in A, then x∈Bx \in B because A⊆BA \subseteq B, and so x∈Cx \in C because B⊆CB \subseteq C.

Proposition 9 (Double inclusion)

A=BA = B if and only if A⊆BA \subseteq B and B⊆AB \subseteq A.

Proof

Each side says that x∈Ax \in A and x∈Bx \in B imply one another for every xx.

Remark 10

This is the standard way to prove that two sets are equal. Take an arbitrary x∈Ax \in A and show x∈Bx \in B, then take an arbitrary x∈Bx \in B and show x∈Ax \in A.

Operations on sets

Definition 11 (Union and intersection)

The union A∪BA \cup B is the set of xx with x∈Ax \in A or x∈Bx \in B, where “or” includes the case of both. The intersection A∩BA \cap B is the set of xx with x∈Ax \in A and x∈Bx \in B. Sets AA and BB are disjoint if A∩B=∅A \cap B = \emptyset.

Definition 12 (Difference and symmetric difference)

The difference is A∖B={x∈A:x∉B}A \setminus B = \{x \in A : x \notin B\}. The symmetric difference is A△B=(A∖B)∪(B∖A)A \mathbin{\triangle} B = (A \setminus B) \cup (B \setminus A), the set of elements belonging to exactly one of AA and BB.

Definition 13 (Complement)

If A⊆UA \subseteq U, the complement of AA in the universe UU is Ac=U∖AA^c = U \setminus A.

Four Venn diagrams of two overlapping circles A and B, shading the union, the intersection, the difference A minus B, and the symmetric difference

Example 14

For A={1,2,3}A = \{1, 2, 3\} and B={3,4}B = \{3, 4\}, we get A∪B={1,2,3,4}A \cup B = \{1, 2, 3, 4\}, A∩B={3}A \cap B = \{3\}, A∖B={1,2}A \setminus B = \{1, 2\}, B∖A={4}B \setminus A = \{4\} and A△B={1,2,4}A \mathbin{\triangle} B = \{1, 2, 4\}.

Claims about sets often reduce to logic, because ∪\cup and ∩\cap correspond to “or” and “and”, and, within a universe, complement corresponds to “not”.

Theorem 15 (Algebraic laws)

For all sets AA, BB and CC:

  1. A∪B=B∪AA \cup B = B \cup A and A∩B=B∩AA \cap B = B \cap A;
  2. (A∪B)∪C=A∪(B∪C)(A \cup B) \cup C = A \cup (B \cup C) and (A∩B)∩C=A∩(B∩C)(A \cap B) \cap C = A \cap (B \cap C);
  3. A∩(B∪C)=(A∩B)∪(A∩C)A \cap (B \cup C) = (A \cap B) \cup (A \cap C) and A∪(B∩C)=(A∪B)∩(A∪C)A \cup (B \cap C) = (A \cup B) \cap (A \cup C);
  4. A∪∅=AA \cup \emptyset = A and A∩∅=∅A \cap \emptyset = \emptyset.
Proof

We prove the first law in (3); the others follow the same pattern. An element xx lies in A∩(B∪C)A \cap (B \cup C) if and only if x∈Ax \in A and either x∈Bx \in B or x∈Cx \in C. By the distributive law of logic, this holds if and only if either xx is in both AA and BB, or xx is in both AA and CC. That says exactly that x∈(A∩B)∪(A∩C)x \in (A \cap B) \cup (A \cap C).

Proposition 16 (Inclusion and the operations)

For all sets AA and BB:

  1. A∩B⊆A⊆A∪BA \cap B \subseteq A \subseteq A \cup B;
  2. the statements A⊆BA \subseteq B, A∪B=BA \cup B = B and A∩B=AA \cap B = A are equivalent;
  3. if AA and BB are subsets of a universe UU, then A∖B=A∩BcA \setminus B = A \cap B^c.
Proof

Statement (1) is immediate from the definitions.

For (2), suppose A⊆BA \subseteq B. Every element of A∪BA \cup B then lies in BB, and B⊆A∪BB \subseteq A \cup B by (1) with AA and BB interchanged and commutativity, so A∪B=BA \cup B = B. Every element of AA also lies in A∩BA \cap B, and A∩B⊆AA \cap B \subseteq A by (1), so A∩B=AA \cap B = A. Conversely, if A∪B=BA \cup B = B, then A⊆A∪B=BA \subseteq A \cup B = B. If A∩B=AA \cap B = A, then A=A∩B⊆BA = A \cap B \subseteq B, again by (1) with AA and BB interchanged and commutativity.

For (3), an element x∈Ax \in A lies in UU, so x∉Bx \notin B if and only if x∈Bcx \in B^c.

Proposition 17 (Complement laws)

For a subset AA of a universe UU:

  1. (Ac)c=A(A^c)^c = A;
  2. A∪Ac=UA \cup A^c = U;
  3. A∩Ac=∅A \cap A^c = \emptyset.
Proof

Each x∈Ux \in U lies in exactly one of AA and AcA^c. All three laws follow, since AA, AcA^c and (Ac)c(A^c)^c are subsets of UU.

Theorem 18 (De Morgan's laws)

For subsets AA and BB of a universe UU:

(A∪B)c=Ac∩Bc,(A∩B)c=Ac∪Bc.\begin{aligned} (A \cup B)^c &= A^c \cap B^c, \\ (A \cap B)^c &= A^c \cup B^c. \end{aligned}
Proof

For the first law, let x∈Ux \in U. Then x∈(A∪B)cx \in (A \cup B)^c if and only if x∉A∪Bx \notin A \cup B, which holds if and only if x∉Ax \notin A and x∉Bx \notin B. That says exactly that x∈Ac∩Bcx \in A^c \cap B^c. Both sides are subsets of UU, so they are equal.

For the second law, apply the first to AcA^c and BcB^c. By the complement laws, this gives (Ac∪Bc)c=(Ac)c∩(Bc)c=A∩B(A^c \cup B^c)^c = (A^c)^c \cap (B^c)^c = A \cap B. Taking complements of both sides and using the same laws gives Ac∪Bc=(A∩B)cA^c \cup B^c = (A \cap B)^c.

Remark 19

An element-wise argument gives, for any sets AA, BB and CC, the identities C∖(A∪B)=(C∖A)∩(C∖B)C \setminus (A \cup B) = (C \setminus A) \cap (C \setminus B) and C∖(A∩B)=(C∖A)∪(C∖B)C \setminus (A \cap B) = (C \setminus A) \cup (C \setminus B), with no universe needed.

Adding the sizes of two finite sets counts the elements they share twice, which gives a simple formula for the size of a union.

Proposition 20 (Inclusion-exclusion for two sets)

If AA and BB are finite, then ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣\lvert A \cup B \rvert = \lvert A \rvert + \lvert B \rvert - \lvert A \cap B \rvert.

Proof

The sum ∣A∣+∣B∣\lvert A \rvert + \lvert B \rvert counts each element of A∩BA \cap B twice and every other element of A∪BA \cup B once. Subtracting ∣A∩B∣\lvert A \cap B \rvert leaves each element of A∪BA \cup B counted once.

Power sets

Definition 21 (Power set)

The power set P(A)\mathcal{P}(A) of a set AA is the set of all subsets of AA.

Example 22

P({1,2})={∅,{1},{2},{1,2}}\mathcal{P}(\{1, 2\}) = \{\emptyset, \{1\}, \{2\}, \{1, 2\}\}. Also P(∅)={∅}\mathcal{P}(\emptyset) = \{\emptyset\}, which has one element.

Proposition 23

A finite set with nn elements has exactly 2n2^n subsets.

Proof

We use induction on nn. The empty set has exactly one subset, and 20=12^0 = 1.

Now suppose every set with nn elements has 2n2^n subsets, let ∣A∣=n+1\lvert A \rvert = n + 1, choose a∈Aa \in A and let A0=A∖{a}A_0 = A \setminus \{a\}, which has nn elements. The subsets of AA not containing aa are exactly the subsets of A0A_0. The subsets containing aa are exactly the sets S∪{a}S \cup \{a\} with S⊆A0S \subseteq A_0. Different SS give different sets, because a∉Sa \notin S means that S=(S∪{a})∖{a}S = (S \cup \{a\}) \setminus \{a\}. By the induction hypothesis, there are 2n2^n of each kind, for a total of 2n+12^{n+1}.

Indexed families

We often need to combine many sets at once, such as one set for each natural number.

Definition 24 (Indexed family)

Let II be a set, called the index set. A family of sets (Ai)i∈I(A_i)_{i \in I} assigns a set AiA_i to each i∈Ii \in I. Different indices may be assigned the same set, so a family carries more information than the set {Ai:i∈I}\{A_i : i \in I\}.

Definition 25 (Union and intersection of a family)

For a family (Ai)i∈I(A_i)_{i \in I}, the union ⋃i∈IAi\bigcup_{i \in I} A_i is the set of xx with x∈Aix \in A_i for at least one i∈Ii \in I. If I≠∅I \ne \emptyset, the intersection ⋂i∈IAi\bigcap_{i \in I} A_i is the set of xx with x∈Aix \in A_i for every i∈Ii \in I.

Example 26

For n∈Nn \in \mathbb{N}, let An=[0,1/n]A_n = [0, 1/n]. Then ⋃nAn=[0,1]\bigcup_{n} A_n = [0, 1] and ⋂nAn={0}\bigcap_{n} A_n = \{0\}. If instead Bn=(0,1/n)B_n = (0, 1/n), then ⋂nBn=∅\bigcap_{n} B_n = \emptyset. Both intersections rest on the Archimedean property of R\mathbb{R}: for every x>0x > 0 there is an nn with 1/n<x1/n < x.

Remark 27

For an empty index set, the union is ∅\emptyset. The intersection is a problem: every xx vacuously belongs to all AiA_i, and there is no set of everything. So the intersection requires I≠∅I \ne \emptyset, unless a universe UU is fixed, in which case the empty intersection is taken to be UU.

Theorem 28 (De Morgan's laws for families)

For a family (Ai)i∈I(A_i)_{i \in I} of subsets of a universe UU, with I≠∅I \ne \emptyset:

(⋃i∈IAi)c=⋂i∈IAic,(⋂i∈IAi)c=⋃i∈IAic.\begin{aligned} \Bigl(\bigcup_{i \in I} A_i\Bigr)^c &= \bigcap_{i \in I} A_i^c, \\ \Bigl(\bigcap_{i \in I} A_i\Bigr)^c &= \bigcup_{i \in I} A_i^c. \end{aligned}
Proof

For x∈Ux \in U, we have x∉⋃iAix \notin \bigcup_i A_i if and only if there is no ii with x∈Aix \in A_i, which holds if and only if x∈Aicx \in A_i^c for every ii. Likewise, x∉⋂iAix \notin \bigcap_i A_i if and only if x∉Aix \notin A_i for some ii, which holds if and only if x∈⋃iAicx \in \bigcup_i A_i^c. In each law both sides are subsets of UU, so they are equal.

Proposition 29 (Inclusion and distributivity for families)

For a family (Ai)i∈I(A_i)_{i \in I} with I≠∅I \ne \emptyset, a set BB and any j∈Ij \in I:

  1. ⋂i∈IAi⊆Aj⊆⋃i∈IAi\bigcap_{i \in I} A_i \subseteq A_j \subseteq \bigcup_{i \in I} A_i;
  2. B∩⋃i∈IAi=⋃i∈I(B∩Ai)B \cap \bigcup_{i \in I} A_i = \bigcup_{i \in I} (B \cap A_i);
  3. B∪⋂i∈IAi=⋂i∈I(B∪Ai)B \cup \bigcap_{i \in I} A_i = \bigcap_{i \in I} (B \cup A_i).
Proof

Statement (1) is immediate from the definitions. For (2), xx lies in the left side if and only if x∈Bx \in B and x∈Aix \in A_i for some ii, which says exactly that x∈B∩Aix \in B \cap A_i for some ii. For (3), every x∈Bx \in B lies in both sides. If x∉Bx \notin B, then xx lies in the left side if and only if x∈Aix \in A_i for every ii, and that holds if and only if x∈B∪Aix \in B \cup A_i for every ii.

Sets that pairwise do not overlap are especially useful, since each element of their union then lies in exactly one of them.

Definition 30 (Pairwise disjoint families and partitions)

A family (Ai)i∈I(A_i)_{i \in I} is pairwise disjoint if Ai∩Aj=∅A_i \cap A_j = \emptyset whenever i≠ji \ne j. A set that is the union of a pairwise disjoint family is called the disjoint union of that family.

A partition of a set AA is a set of nonempty subsets of AA such that every element of AA lies in exactly one of them.

Example 31

The even integers and the odd integers form a partition of Z\mathbb{Z}, and the intervals [n,n+1)[n, n + 1) for n∈Zn \in \mathbb{Z} form a partition of R\mathbb{R}. The sets {1,2}\{1, 2\}, {2,3}\{2, 3\} and {1,3}\{1, 3\} have empty intersection taken all together, but they are not pairwise disjoint.

Ordered pairs and Cartesian products

Sets ignore order, but coordinates and many other constructions depend on it.

Definition 32 (Ordered pair)

An ordered pair (a,b)(a, b) is an object determined by its first and second entries, in the sense that (a,b)=(c,d)(a, b) = (c, d) if and only if a=ca = c and b=db = d.

So {1,2}={2,1}\{1, 2\} = \{2, 1\}, but (1,2)≠(2,1)(1, 2) \ne (2, 1).

Remark 33

Ordered pairs can be built from sets alone. Kuratowski’s definition (a,b)={{a},{a,b}}(a, b) = \{\{a\}, \{a, b\}\} has the required property. Only the property matters in practice, not the particular construction.

Definition 34 (Cartesian product)

The Cartesian product of AA and BB is A×B={(a,b):a∈A and b∈B}A \times B = \{(a, b) : a \in A \text{ and } b \in B\}. More generally, for n≥1n \ge 1, an nn-tuple (a1,…,an)(a_1, \dots, a_n) is an object determined by its entries in order, in the sense that (a1,…,an)=(b1,…,bn)(a_1, \dots, a_n) = (b_1, \dots, b_n) if and only if ai=bia_i = b_i for every ii. The product A1×⋯×AnA_1 \times \dots \times A_n is the set of nn-tuples with each ai∈Aia_i \in A_i, and AnA^n is the product of nn copies of AA. A 2-tuple is an ordered pair, and A1A^1 is identified with AA.

Remark 35

Depending on how tuples are constructed, ((a,b),c)((a, b), c) and (a,b,c)(a, b, c) may or may not be the same object. It is standard to identify them, and so to treat (A×B)×C(A \times B) \times C and A×B×CA \times B \times C as the same set.

Example 36

{1,2}×{x,y}={(1,x),(1,y),(2,x),(2,y)}\{1, 2\} \times \{x, y\} = \{(1, x), (1, y), (2, x), (2, y)\}, and R2\mathbb{R}^2 is the coordinate plane. In general A×B≠B×AA \times B \ne B \times A, and A×∅=∅A \times \emptyset = \emptyset.

Proposition 37

For all sets AA, BB and CC:

  1. A×(B∪C)=(A×B)∪(A×C)A \times (B \cup C) = (A \times B) \cup (A \times C);
  2. A×(B∩C)=(A×B)∩(A×C)A \times (B \cap C) = (A \times B) \cap (A \times C).

The corresponding laws hold with the union or intersection in the first factor.

Proof

Since a pair determines its entries, a pair (a,b)(a, b) lies in A×(B∪C)A \times (B \cup C) if and only if a∈Aa \in A and either b∈Bb \in B or b∈Cb \in C. That says exactly that (a,b)(a, b) lies in A×BA \times B or in A×CA \times C. The other laws are proved the same way.

Proposition 38

If AA and BB are finite, then ∣A×B∣=∣A∣ ∣B∣\lvert A \times B \rvert = \lvert A \rvert \, \lvert B \rvert.

Proof

For each a∈Aa \in A, the pairs in A×BA \times B with first entry aa are the pairs (a,b)(a, b) with b∈Bb \in B. By the defining property of pairs, different bb give different pairs, so there are ∣B∣\lvert B \rvert of them, and pairs with different first entries are different. Summing over the ∣A∣\lvert A \rvert elements of AA gives the result.

Why naive set theory needs care

It is tempting to assume that every property defines a set. That assumption is inconsistent.

Theorem 39 (Russell's paradox)

There is no set RR whose elements are exactly the sets that are not elements of themselves.

Proof

Suppose such an RR exists. By its defining property, R∈RR \in R if and only if R∉RR \notin R, which is a contradiction.

Corollary 40 (No set of all sets)

There is no set that contains every set. In particular, there is no set of everything.

Proof

If VV were such a set, then {x∈V:x is a set and x∉x}\{x \in V : x \text{ is a set and } x \notin x\} would be the impossible set RR.

This is why set-builder notation draws on existing sets, why a complement needs a universe, and why an intersection over an empty index set causes trouble. For the complement, if {x:x∉A}\{x : x \notin A\} were a set, then its union with AA would be a set of everything. Axiomatic systems such as Zermelo-Fraenkel set theory with the axiom of choice (ZFC) state precisely which constructions are allowed. The constructions used in everyday mathematics, including those in this topic, are among them.

Summary

Referenced by