# Set Theory

## Sets

A set is a well-defined collection of objects. These objects are called elements or members of the set, and they can be anything, including numbers, letters, people, cities, and even other sets. By convention, sets are usually denoted by capital letters and can be described or defined by listing its elements and surrounding the list by curly braces. For example, we can describe the set $$A$$ to be the set whose members are the first five prime numbers, or we can explicitly write: $$A = \{2, 3, 5, 7, 11\}$$.

If $$x$$ is an element of $$A$$, then we write $$x \in A$$. Similarly, if $$y$$ is not an element of $$A$$, then we write $$y \not\in A$$. Two sets $$A$$ and $$B$$ are said to be equal, written as $$A = B$$, if they have the same elements. The order and repetition of elements do not matter, so $$\{\text{red}, \text{white}, \text{blue}\} = \{\text{blue}, \text{white}, \text{red}\} = \{\text{red}, \text{white}, \text{white}, \text{blue}\}$$. Sometimes, more complicated sets can be defined by using a different notation. For example, the set of all rational numbers, denoted by $$\mathbb{Q}$$, can be written as: $$\{a/b \mid a,b \text{ are integers}, b \not= 0\}$$. In English, this is read as “the set of all fractions such that the numerator is an integer and the denominator is a non-zero integer".

## Cardinality

We can also talk about the size of a set, or its cardinality. If $$A = \{1,2,3,4\}$$, then the cardinality of $$A$$, denoted by $$|A|$$, is $$4$$. It is possible for the cardinality of a set to be $$0$$. This set is called the empty set, denoted by the symbol $$\varnothing$$. A set can also have an infinite number of elements, such as the set of all integers, prime numbers, or odd numbers.

## Subsets and Proper Subsets

If every element of a set $$A$$ is also in set $$B$$, then we say that $$A$$ is a subset of $$B$$, written $$A \subseteq B$$. Equivalently we can write $$B \supseteq A$$, or $$B$$ is a superset of $$A$$. A proper subset is a set $$A$$ that is strictly contained in $$B$$, written as $$A \subset B$$, meaning that $$A$$ excludes at least one element of $$B$$. For example, consider the set $$B = \{1,2,3,4,5\}$$. Then $$\{1,2,3\}$$ is both a subset and a proper subset of $$B$$, while $$\{1,2,3,4,5\}$$ is a subset but not a proper subset of $$B$$. Here are a few basic properties regarding subsets:

• The empty set, denote by $$\{\}$$ or $$\varnothing$$, is a proper subset of any nonempty set $$A$$: $$\{\} \subset A$$.

• The empty set is a subset of every set $$B$$: $$\{\} \subseteq B$$.

• Every set $$A$$ is a subset of itself: $$A \subseteq A$$.

## Intersections and Unions

The intersection of a set $$A$$ with a set $$B$$, written as $$A \cap B$$, is a set containing all elements which are in both $$A$$ and $$B$$. Two sets are said to be disjoint if $$A \cap B = \varnothing$$. The union of a set $$A$$ with a set $$B$$, written as $$A \cup B$$, is a set of all elements which are in either $$A$$ or $$B$$ or both. For example, if $$A$$ is the set of all positive even numbers, and $$B$$ is the set of all positive odd numbers, then $$A \cap B = \varnothing$$, and $$A \cup B = \mathbb{Z}^{+}$$, or the set of all positive integers. Here are a few properties of intersections and unions:

• $$A \cup B = B \cup A$$

• $$A \cup \varnothing = A$$

• $$A \cap B = B \cap A$$

• $$A \cap \varnothing = \varnothing$$

## Complements

If $$A$$ and $$B$$ are two sets, then the relative complement of $$A$$ in $$B$$, written as $$B - A$$ or $$B \setminus A$$, is the set of elements in $$B$$, but not in $$A$$: $$B \setminus A = \{x \in B \mid x \not\in A\}$$. For example, if $$B = \{1,2,3\}$$ and $$A = \{3,4,5\}$$, then $$B \setminus A = \{1,2\}$$. For another example, if $$\mathbb{R}$$ is the set of real numbers and $$\mathbb{Q}$$ is the set of rational numbers, then $$\mathbb{R} \setminus \mathbb{Q}$$ is the set of irrational numbers. Here are some important properties of complements:

• $$A \setminus A = \varnothing$$

• $$A \setminus \varnothing = A$$

• $$\varnothing \setminus A = \varnothing$$

## Significant Sets

In mathematics, some sets are referred to so commonly that they are denoted by special symbols. Some of these numerical sets include:

• $$\mathbb{N}$$ denotes the set of all natural numbers: $$\{0,1,2,3,...\}$$.

• $$\mathbb{Z}$$ denotes the set of all integer numbers: $$\{\ldots,-2,-1,0,1,2,\ldots\}$$.

• $$\mathbb{Q}$$ denotes the set of all rational numbers: $$\{a/b \mid a,b \in \mathbb{Z}$$, $$b \not= 0$$}.

• $$\mathbb{R}$$ denotes the set of all real numbers.

• $$\mathbb{C}$$ denotes the set of all complex numbers.

In addition, the Cartesian product (also called the cross product) of two sets $$A$$ and $$B$$, written as $$A \times B$$, is the set of all pairs whose first component is an element of $$A$$ and whose second component is an element of $$B$$. In set notation, $$A \times B = \{(a,b) \mid a \in A, b \in B\}$$. For example, if $$A = \{1,2,3\}$$ and $$B = \{u,v\}$$, then $$A \times B = \{(1,u),(1,v),(2,u),(2,v),(3,u),(3,v)\}$$. Given a set $$S$$, another significant set is the power set of $$S$$, denoted by $$\mathcal{P}(S)$$, is the set of all subsets of $$S$$: $$\{T \mid T \subseteq S\}$$. For example, if $$S = \{1,2,3\}$$, then the power set of $$S$$ is: $$\mathcal{P}(S) = \{\{\},\{1\},\{2\},\{3\},\{1,2\},\{1,3\},\{2,3\},\{1,2,3\}\}$$. It is interesting to note that, if $$|S| = k$$, then $$|\mathcal{P}(S)| = 2^k$$.

# Mathematical Notation

## Sums and Products

There is a compact notation for writing sums or products of large numbers of items. For example, to write $$1 + 2 + \cdots + n$$, without having to say dot dot dot, we write it as $$\sum_{i = 1}^{n} i$$. More generally we can write the sum $$f(m) + f(m+1) + \cdots + f(n)$$ as $$\sum_{i = m}^{n} f(i)$$. Thus, $$\sum_{i = 5}^{n} i^2 = 5^2 + 6^2 + \cdots + n^2$$.
To write the product $$f(m) f(m+1) \cdots f(n)$$, we use the notation $$\prod_{i = m}^{n} f(i)$$. For example, $$\prod_{i = 1}^{n} i = 1 \cdot 2 \cdots n$$.

## Universal and Existential Quantifiers

Consider the statement: For all natural numbers $$n$$, $$n^2 + n + 41$$ is prime. Here, $$n$$ is quantified to any element of the set $$\mathbb{N}$$ of natural numbers. In notation, we write $$(\forall n\in \mathbb{N})(n^2 + n + 41 \text{ is prime})$$. Here we have used the universal quantifier $$\forall$$ (“for all”). Is the statement true? If you try to substitute small values of $$n$$, you will notice that $$n^2 + n + 41$$ is indeed prime for those values. But if you think harder, you can find larger values of $$n$$ for which it is not prime. Can you find one? So the statement $$(\forall n\in \mathbb{N})(n^2 + n + 41 \text{ is prime})$$ is false.

The existential quantifer $$\exists$$ (“there exists”) is used in the following statement: $$\exists x \in \mathbb{Z} \; x < 2 \text{ and } x^2 = 4$$. The statement says there is an integer $$x$$ which is less than $$2$$, but its square is equal to $$4$$. This is a true statement.

We can also write statements using both kinds of quantifiers:

1. $$\forall x \in \mathbb{Z} \; \exists y \in \mathbb{Z} \; y > x$$

2. $$\exists y \in \mathbb{Z} \; \forall x \in \mathbb{Z} \; y > x$$

The first statement says that, given an integer, we can find a larger one. The second statement says something very different: that there is a largest integer! The first statement is true, the second is not.