# Lecture 3

### Equality

Two sets $A$ and $B$ are equal if they have the same members.

A straightforward way of proving this is often to show that $A\subset B$ and $B\subset A$. That is, in words, two sets $A$ and $B$ are equal if every element of $A$ is an element of $B$ and every element of $B$ is an element of $A$.

Here’s an example of this proof strategy:

#### Proposition

1 Let $A$, $B$ and $C$ be three sets. We have $A\cap(B\cup C) = (A\cap B)\cup(A\cap C).$

#### Proof

We’ll show that each side is contained in the other: first we’ll prove that $A\cap(B\cup C) \subset (A\cap B)\cup(A\cap C),$ and then that $(A\cap B)\cup(A\cap C) \subset A\cap(B\cup C).$

For the first one, suppose that $x\in A\cap(B\cup C)$; we must prove that $x\in (A\cap B)\cup (A\cup C)$.

Since $x\in A\cap(B\cup C)$, we have both $x\in A$ and $x\in B\cup C$, which in turn means that $x\in B$ or $x\in C$. In either case, the desired result holds:

• If $x\in B$, then since $x\in A$ also, then $x\in A\cap B$, and so $x\in (A\cap B)\cup(A\cap C)$.

• If $x\in C$, then, similarly, since $x\in A$, we have $x\in A\cap C$, and hence $x\in (A\cap B)\cup(A\cap C)$.

So we’ve proved that containment.

Now let’s prove the other containment: that $(A\cap B)\cup(A\cap C)\subset A\cap(B\cup C)$. We suppose that $x\in(A\cap B)\cup(A\cap C)$ and must prove that $x\in A\cap(B\cup C)$.

Since $x\in (A\cap B)\cup(A\cap C)$, we have either $x\in A\cap B$ or $x\in A\cap C$. In either case, we get what we want.

• If $x\in A\cap B$, then $x\in A$ and $x\in B$. From the latter, we get that $x\in B\cup C$ and hence $x\in A\cap(B\cup C)$.

• If $x\in A\cap C$, then, as before, $x\in A$ but now $x\in C$. But we still have $x\in B\cup C$, and so $x\in A\cap(B\cup C)$.

That was the first example of a formal proof in this course. You’ll have to write many proofs like this yourself, in assessed homework and in the exam. Though we’ll discuss it in depth later, it may be worth observing the style from the beginning. One big mistake that many beginner mathematicians make is not using words to explain the flow of the argument.

### A warning

What we are practising here is called naı̈ve set theory. What’s so naı̈ve about it?

The Welsh mathematician Bertrand Russell realised in 1901 that there are serious problems with being allowed to form sets carelessly:

Suppose there is a set $S$ of all sets which are not elements of themselves: $S = \left\{A\mid A\notin A\right\}.$ This creates a contradiction.

#### Proof

Is $S$ a member of itself? If $S\in S$, then by the definition of $S$, we have $S\notin S$. On the other hand, if $S\notin S$, then again by the definition of $S$ we have $S\in S$.

As a result of this paradox, modern set theorists impose strict rules on what sets can be formed, with the aim of banning this particular beast and everything like it.

## Functions

A function is to be thought of as a machine that takes an element of one set and gives you an element of another. Here’s a formal definition:
Definition: Given sets $A$ and $B$, a function (sometimes called a map) $f:A\rightarrow B$ gives for each element $a\in A$ a unique element $f(a)\in B$.

Examples include:

• the function $f:\mathbb{Z}\rightarrow\mathbb{Z}$ defined by $f(n)=n^2-7$.

• the function $g:\mathbb{Q}\rightarrow\{4,6\}$ defined by $g(x) = \begin{cases} 4, & \text{if x=3/7 or x=-14/17;}\\ 6, & \text{otherwise.} \end{cases}$

The set $A$ is called the domain of $f$, and $B$ is called the codomain of $f$. We call $f(a)$ the value of $f$ at $a$, or the image of $a$ under $f$.

Consider the “age in years” function from the set of people watching this lecture to the natural numbers.

The domain of this function is the set of values you’re permitted to apply it to. This is the set of people watching the lecture, because I said so.

The codomain of this function is the set of values it is permitted to take. This is the set $\mathbb{N}$ of natural numbers, because I said so.

Some people like to talk about the image of this function, being the set of values it actually takes in practice. This might (perhaps) be the set $\left\{18,19,20,{37}\right\}.$

The range is not a phrase that’s used consistently:

• some people use it to mean the codomain;

• some people use it to mean the image;

• some (confused) people, who don’t know the difference, use it inconsistently to mean both.

When you’re trying to work out whether something’s a function, there are three bits of the definition where things can go wrong:

“each $a\in A$

A function must be defined for every single element of the domain. Why does $\alpha(x) = 1/x$ not define a function $\alpha:\mathbb{Q}\rightarrow\mathbb{Q}$?

$\alpha$ is not defined at zero

“unique element”

A function must have only one value at any given element of the domain. If we set $\beta(n)$ to be the real number $x$ whose square is $n$, why does that not define a function $\beta:\mathbb{N}\rightarrow\mathbb{R}$?

$\beta(3)$ could be $+\sqrt{3}$ or $-\sqrt{3}$.

$f(a)\in B$

A function must return values within its codomain. Why does $\gamma(n) = n-7$ not define a function $\gamma:\mathbb{N}\rightarrow\mathbb{N}$?

$\gamma(4)=-3$ does not lie inside $\mathbb{N}$.

Two functions are equal if:

• they have the same domain and codomain, as $f,g:A\rightarrow B$; and

• their values are equal, for every point in the domain: in other words, for all $a\in A$, we have $f(a) = g(a)$.

1. In this course, we’ll be numbering results by lecture, so that Theorem 15.3 will be the third result in the 15th lecture.↩︎