# 2.2 Set operators

## 2.2.1 Union, intersection, difference, complement

###### Definition 2.2.1.

Let $A$ and $B$ be sets.

• $A\cup B$, the union of $A$ and $B$, is $\{x:x\in A\vee x\in B\}$.

• $A\cap B$, the intersection of $A$ and $B$, is $\{x:x\in A\wedge x\in B\}$.

• $A\setminus B$, the set difference of $A$ and $B$, is $\{x\in A:x\notin B\}$.

• If $A$ is a subset of a set $\Omega$ then $A^{c}$, the complement of $A$ in $\Omega$, is $\{x\in\Omega:x\notin A\}$.

We can express complements using set differences. If $A$ is a subset of $\Omega$ then its complement $A^{c}$ in $\Omega$ is equal to $\Omega\setminus A$.

###### Example 2.2.1.

Suppose $A=\{0,1,2\},B=\{1,2,3\},C=\{4\}$.

• $A\cup B=\{0,1,2,3\}$

• $A\cap B=\{1,2\}$

• $A\cap C=\emptyset$

• $A\setminus B=\{0\}$

• $A\setminus C=A$

• If $\Omega=\{0,1,2,\ldots\}$ then $A^{c}$ would be $\{3,4,\ldots\}$.

The set $\mathbb{N}=\{0,1,2,\ldots\}$ is called the natural numbers. Some people exclude 0 from $\mathbb{N}$ but in MATH0005 the natural numbers include 0.

It’s typical to draw Venn diagrams to represent set operations. We draw a circle, or a blob, for each set. The elements of the set $A$ are represented by the area inside the circle labelled $A$. Here are some examples:

## 2.2.2 Size of a set

###### Definition 2.2.2.

The size or cardinality of a set $X$, written $|X|$, is the number of distinct elements it has.

###### Example 2.2.2.
• $|\{1,2\}|=2$

• $|\emptyset|=0$

• $|\{1,2,1,3\}|=3$

###### Definition 2.2.3.

A set is finite if it has 0, or 1, or 2, or any other natural number of elements. A set that is not finite is called infinite.

$\mathbb{N}$ and $\mathbb{Z}$ are infinite sets while the sets in Example 2.2.2 are all finite.