Sets and Operations on Sets

In this post I explain sets, equality, subsets, unions, intersections, differences, and basic set theorems.

Definition of a Set

A set is a collection of unique elements, which may be numbers, symbols, or other objects.

We will denote sets with uppercase letters such as $A$, $B$, ..., $X$, $Y$, $Z$, $\mathfrak{A}$, $\mathfrak{B}$, ..., $\mathfrak{Z}$, and so on.

We will denote elements of a set with lowercase letters such as $a$, $b$, ..., $x$, $y$, $z$, $\mathfrak{a}$, $\mathfrak{b}$, ..., $\mathfrak{z}$, and so on.

If the object $a$ is an element of the set $A$, we write $a \in A$.

If the object $b$ is not an element of the set $B$, we write $b \notin B$.

Writing Sets

The notation $A = \{a, b, c\}$ means that the set $A$ consists of the elements $a$, $b$, and $c$.

The notation $B = \{x : x \text{ has property } P\}$ means that the set $B$ consists of all elements $x$ that have the property $P$.

The notation $C = \{y_\gamma \}, \gamma \in \mathfrak{I}$ means that the set $C$ consists of all elements $y_\gamma$, where $\gamma$ belongs to the set $\mathfrak{I}$.

Example of a Set

Consider the set $A$ consisting of the first five natural numbers:$A = \{1, 2, 3, 4, 5\}$.

In this example the elements of the set $A$ are the numbers $1$, $2$, $3$, $4$, and $5$. We can say that the number $3$ is an element of $A$ by writing $3 \in A$, and that the number $6$ is not an element of $A$ by writing $6 \notin A$.

Definition of Set Equality

Two sets are equal if they contain exactly the same elements.

The equality of sets $A = B$ effectively means that one and the same set is being denoted by two different letters, $A$ and $B$.

Formally, we say that the sets $A$ and $B$ are equal if the following holds for every element $x$:$\forall x \in A \iff x \in B$

$\forall$ is the universal quantifier and means “for every”.

$\iff$ is the logical symbol meaning “if and only if”.

Example of Equal Sets

Consider the sets $A = \{1, 2, 3\}$ and $B = \{3, 2, 1\}$. Even though the elements are written in a different order, they contain the same elements. Therefore, by definition, the sets $A$ and $B$ are equal: $A = B$.

The Empty Set

The empty set is a set that contains no elements.

The empty set is denoted by $\varnothing$.

Definition of a Subset

A subset is a set whose every element is also an element of another set.

If the set $A$ is a subset of the set $B$, we write $A \subseteq B$.

It is customary to consider every set a subset of itself, that is, $A \subseteq A$.

In addition, the empty set is a subset of any set, that is,$\varnothing \subseteq A$ for any set $A$.

Example of a Subset

Consider the sets $A = \{1, 2\}$ and $B = \{1, 2, 3, 4, 5\}$. Every element of $A$ (that is, the numbers $1$ and $2$) is also an element of $B$. Therefore we can say that $A$ is a subset of $B$: $A \subseteq B$.

Theorem on Equality of Sets

Two sets are equal if and only if each of them is a subset of the other.

That is, if $A \subseteq B$ and $B \subseteq A$, then $A = B$.

Proof of the Set Equality Theorem

Proof

Let $A$ and $B$ be two sets such that $A \subseteq B$ and $B \subseteq A$. We need to show that $A = B$.

By the definition of subset, if $A \subseteq B$, then every element $a \in A$ also belongs to $B$. Similarly, if $B \subseteq A$, then every element $b \in B$ also belongs to $A$.

Thus all elements of $A$ are contained in $B$, and all elements of $B$ are contained in $A$. Therefore the sets $A$ and $B$ contain exactly the same elements, which by definition means that $A = B$.

Definition of a Proper Subset

A proper subset is a subset that is not equal to the set itself.

If the set $A$ is a proper subset of the set $B$, we write $A \subset B$.

This means that all elements of $A$ are also elements of $B$, but there exists at least one element $x$ in $B$ that is not in $A$:$\exists x \in B : x \notin A$

$\exists$ is the existential quantifier and means “there exists”.

Example of a Proper Subset

Consider the sets $A = \{1, 2\}$ and $B = \{1, 2, 3\}$. All elements of $A$ are also elements of $B$, and the set $A$ is not equal to the set $B$. Therefore $A$ is a proper subset of $B$: $A \subset B$.

Union of Sets

The union of sets is the set containing all elements from both sets.

The union of the sets $A$ and $B$ is denoted by $A \cup B$.

Set union diagramTwo overlapping circles A and B, both shaded, showing the union of A and B.ABA ∪ B
$A \cup B$ means all elements from $A$ or $B$.

Example of a Union

If $A = \{1, 2, 3\}$ and $B = \{3, 4, 5\}$, then their union is$A \cup B = \{1, 2, 3, 4, 5\}$.

For any set $A$, we have $A \cup \varnothing = A$.

Intersection of Sets

The intersection of sets is the set containing only the elements that belong to both sets.

The intersection of the sets $A$ and $B$ is denoted by $A \cap B$.

Set intersection diagramTwo overlapping circles A and B, with only the overlap shaded, showing the intersection of A and B.ABA ∩ B
$A \cap B$ means only the elements that belong to both $A$ and $B$.

Example of an Intersection

If $A = \{1, 2, 3\}$ and $B = \{3, 4, 5\}$, then their intersection is$A \cap B = \{3\}$.

Disjoint Sets

Disjoint sets are sets that have no common elements.

If the sets $A$ and $B$ are disjoint, then their intersection equals the empty set:$A \cap B = \varnothing$

Example of Disjoint Sets

Consider the sets $A = \{1, 2\}$ and $B = \{3, 4\}$. Since they have no common elements, they are disjoint sets, and their intersection is the empty set:$A \cap B = \varnothing$.

Properties of the Empty Set

For any set $A$, we have $A \cap \varnothing = \varnothing$. Thus the empty set is equal to itself,$\varnothing = \varnothing$, and it does not intersect with any set, including itself:$A \cap \varnothing = \varnothing$.

The empty set is a subset of every set, that is, $\varnothing \subseteq A$ for any set $A$.

Set Difference

The difference of sets is the set containing elements that belong to the first set but not to the second.

The difference of the sets $A$ and $B$ is denoted by $A \setminus B$.

Example of a Set Difference

If $A = \{1, 2, 3, 4\}$ and $B = \{3, 4, 5\}$, then their difference is$A \setminus B = \{1, 2\}$.

Set Complement

The complement of the set $A$ in $B$ is the set of all elements that belong to $B$ but do not belong to $A$.

The complement of $A$ in $B$ is denoted by $B \setminus A$.
In other words, this is just the set difference with a more specific name in this particular case.

Example of a Complement

If $A = \{1, 2\}$ and $B = \{1, 2, 3, 4\}$, then the complement of $A$ in $B$ is$B \setminus A = \{3, 4\}$.

By the definition of set difference, the difference of a set with itself is the empty set:$A \setminus A = \varnothing$

Theorem on Decomposing the Union of Sets

The union of two sets can be decomposed into three disjoint sets: elements belonging only to the first set, elements belonging only to the second set, and elements belonging to both sets.

Formally, this can be written as:$A \cup B = (A \setminus B) \cup (B \setminus A) \cup (A \cap B)$

Proof of the Union Decomposition Theorem

Proof

Let $x$ be an arbitrary element of the union $A \cup B$. That is, $x \in A \cup B$. By the definition of the union, this means that $x$ belongs either to $A$, or to $B$, or to both. We will prove that$x \in (A \setminus B) \cup (B \setminus A) \cup (A \cap B)$. This proves the equality of sets by definition.

Consider three possible cases:

  1. If $x$ belongs only to $A$ (that is, $x \in A$ and $x \notin B$), then by the definition of set difference $x$ belongs to the set $A \setminus B$.
  2. If $x$ belongs only to $B$ (that is, $x \in B$ and $x \notin A$), then by the definition of set difference $x$ belongs to the set $B \setminus A$.
  3. If $x$ belongs to both sets (that is, $x \in A$ and $x \in B$), then by the definition of intersection $x$ belongs to the set $A \cap B$.