Use adaptive quiz-based learning to study this topic faster and more effectively.

# Sets

## Sets and elements

A set is a collection of elements. It is described by all its elements.

The set $\N$ of the natural numbers consists of 1, 2, etc.

The set of the letters of ALI BABA consists of the elements A, L, I and B.

When we define the set by listing its elements, we put them in braces (curly brackets { }) separated by commas.

The set of the letters of ALI BABA is written as $\{A,B,I,L\}$.

The set of the integers can be written as $$\Z =\{0, 1, -1, 2, -2, 3, -3, \dots\}$$

The order in which the elements are written does not matter.

$\{0,1,3,5\}$ and $\{3,1,5,0\}$ are the same set.

The set of the primary and secondary colours.

## Set membership

We say that an element belongs to a set if it is part of the set. We use the symbol $\in$.

$$10\in\Z,\;L\in\{A,B,I,\Tred{L}\}$$

When an element does not belong to a set we use $\notin$.

$$O\notin\{A,B,I,L\},\;-1\notin\N,\;\pi\notin\Q$$
The set of the primary and secondary colours contains the element 'green'.

## Subsets

A set $A$ is a subset of $B$ if all the elements of $A$ belong to $B$. We write this $A\subseteq B$.

The set of mammals is a subset of the set of all animals.

The set of the natural numbers $\N$ is a subset of the integers $\Z$. But the set $\Q$ of the irrational numbers is not.

The set of vowels is a subset of the set of all letters.

$A$ is a proper subset if it is a subset different from $B$. It contains some elements of $B$ but not all of them. We write this as $A\subset B$.

$$\N\subset\Z,\;\Z\subseteq\Z,\;\{\Tred{A},\Tred{I}\}\subset\{\Tred{A},B,\Tred{I},L\}$$

The subset of a subset is a subset.

$$\N\subset\Z\subset\Q\subset\R$$
The set of primary colours and the set of secondary colours are both subsets of the set of all colours. They have no elements in common.

$A$ is not a subset of $B$ if $A$ contains an element that is not in $B$. $A$ and $B$ can still have elements in common. We write this $A\not\subset B$.

The set of animals that live in water is not a subset of all fish (whales are mammals).

$$\Z\not\subseteq\N,\quad\Z\not\subset\Z,\quad \{\Tgreen{A}, \Tred{O}, \Tgreen{I}\}\not\subset\{\Tgreen{A}, B, \Tgreen{I}, L\}$$

The empty set has no elements. We write it $\emptyset$. It is a subset of all sets.

The set of all men with a height of 5m or more is an empty set.

The set of primary colours and the set of secondary colours are both subsets of the set of all colours. They are not a subset of one another.

## Finite and infinite sets

A finite set is a set with a finite (limited) number of elements.

The set of the letters in the English alphabet is finite. There are 26 elements (the letters) in the alphabet.

The set of the natural numbers smaller than 10 is finite.

The set of all human beings is finite.

If the number of elements in a set is infinite, we have an infinite set.

The set of the natural numbers is infinite.

The set of the integers smaller than 10 is infinite: it consists of 9, 8, ..., 0, -1, -2, ...

The set of all possible words (whether they mean anything or not) is infinite.

The set of letters and the subset of vowels are finite.

## Number of elements

The number of elements of a finite set $A$ is written as $n(A)$ or $\vert A \vert$. It is also called the cardinality of the set $A$.

$$n(\{A,B,I,L\}) = 4$$

A subset $A$ of a finite set $B$ is finite and has fewer elements than the set $B$. This can be written as $$n(A)\le n(B).$$

A proper subset of a finite set has fewer elements than the original set.

## Complement of a set

The complement of a subset $A$ of $E$ consists of all the elements in $E$ that are not in $A$. It is written as $A'$ or $A^c$.

The complement of the set of the odd numbers is the set of even numbers (with the set of integers as the reference set).

The complement of the set of the vowels is the set of the consonants (with the set of English letters as the reference set).

The reference set $E$ is often omitted when it is clear which set we are referring to.

The complement of the complement of a set is the original set $$(A')' = A.$$

The blue region is the complement of the white region

## Union of two sets

The union of two sets $A$ and $B$ is a set that consists of the elements that are either in $A$ or $B$ or in both. The set is written $A\cup B$.

The union of the odd and even numbers is the set of all the integers.

$$\{\Tblue{1},\Tblue{2},\Tblue{3}\}\cup \{\Tgreen{0},\Tgreen{2},\Tgreen{4}\} = \{\Tgreen{0},\Tblue{1},\Tred{2},\Tblue{3},\Tgreen{4}\}$$

$A$ and $B$ are a subset of $A\cup B$.

Union of two sets

## Intersection of two sets

The intersection of two sets $A$ and $B$ consists of the elements that are in both $A$ and $B$. The set is written $A\cap B$.

$$\{1,\Tred{2},3\}\cap \{0,\Tred{2},4\} = \{\Tred{2}\}$$

The intersection of the odd and even numbers is empty.

The intersection of the multiples of $2$ and of the multiples of $3$ is the set of the multiples of $6$.

The intersection $A\cap B$ is a subset of both $A$ and $B$.

Two sets are mutually exclusive, or disjoint, if they have no elements in common. Their intersection is empty.

The set of the people who lived in the 15th century and the set of the people who live today are mutually exclusive.

Intersection of two sets

## Summary of set operations

Here is a summary of the main set operations with the following subsets $A$ and $B$ of $E$ $$A = \{1,2\},\quad B=\{2,3\},\quad E=\{0,1,2,3\}.$$

Operation Notation Meaning Complement Union Intersection $A'$ $A\cup B$ $A\cap B$ Not in In either or both In both $\{0,3\}$ $\{1,2,3\}$ $\{2\}$