# Sets and functions

Having spent the best part of an hour trying to persuade you that mathematics is not about numbers, most of this semester will now be about numbers.

But in order to study them properly, we’ll need to start at the beginning, by talking about sets.

## Sets of numbers

One problem with numbers is that there are several different sorts of them.

We’re probably used to several sorts already:

natural numbers

integers

rational numbers

real numbers

complex numbers

We’ll go into more detail later in the course.

We often need to say which we mean, in order to avoid confusion and error. For example, it’s certainly possible that I might invite $3$ friends over for dinner, but it’s hard to invite $-5$ friends or $3/4$ friends or $\sqrt{2}$ friends over.

### The natural numbers

The natural numbers are all the numbers you might find by counting.

The set of natural numbers is written $\mathbb{N}$ (that’s just a letter N, written in a style called “blackboard bold”); in set notation, we might write $\mathbb{N}= \left\{ 0, 1, 2, 3, \ldots \right\}.$

That “$\ldots$” is often pronounced “dot-dot-dot”, but it has the meaning of “and so on”. When we use this symbol, we must be sure that the reader will be sure how to go on from here. Here I hope it really is clear: we go on with $4$, $5$, $6$, adding one each time as we go, and we are to go on without end.

We’ll see many more of those curly brackets later!

Actually, some mathematicians use the phrase “natural numbers” slightly differently, to denote the set $\left\{ 1, 2, 3, \ldots \right\}.$ In other words, they leave out 0.

Our convention in this module will be that $0\in\mathbb{N}$: that zero is a natural number.

If we’re trying to work inside the natural numbers, we can add and multiply all we want, but subtraction and division are a pain: for example we can’t do

$3-5$, or $2/7$.

Working with a bigger system of numbers can cure this.

### The integers

The integers are all the whole numbers, positive, negative and zero. The set of integers is denoted by $\mathbb{Z}$ (why Z? The German word for “number” is “Zahl”). So we might write $\mathbb{Z}= \left\{ \ldots, -2, -1, 0, 1, 2, \ldots \right\}.$ Here we have to go on in both directions without end.

Every natural number is an integer. This means that $\mathbb{N}\subset \mathbb{Z},$ or, in words, “the set of naturals is contained in the set of integers”.

We often use the handy words non-negative, meaning “not negative” (in other words, positive or zero) and non-positive, meaning “not positive” (in other words, negative or zero).

So the natural numbers are the same thing as the nonnegative integers.

If we’re working in the integers, we can add, subtract and multiply all we want. Division is still a problem: for example, we can’t do

$-4/9$.

### The rational numbers

The rational numbers (sometimes just called the rationals), are the numbers that can be written as fractions $\frac{a}{b}$, where $a$ and $b$ are integers and $b\neq 0$.

Fractions can be written in many different ways: for example, we have $\frac{1}{2} = \frac{2}{4} = \frac{5}{10} = \frac{-3}{-6}.$

In general, fractions $\frac{a}{b} = \frac{c}{d}$ are equal if

$ad=bc$.

We write $\mathbb{Q}$ for the set of rational numbers (Q stands for “quotient”, which is a name for what you get when you do division).

Of course, any integer $n$ can be regarded as a rational (we can take $\frac{n}{1}$), so $\mathbb{Z}\subset\mathbb{Q}.$

If we’re working in the rationals, we can add, subtract, multiply and divide all we want. (Well, we can’t divide by zero, but who wants to divide by zero?).

There are still many things we might want to do but can’t do in the rationals though: square roots, logarithms, trigonometry, and suchlike.

### The real numbers

The real numbers $\mathbb{R}$ are perhaps the most general sort of numbers you’ll have used by now (or perhaps not). They contain lots of the numbers you care about, for example: $\pi\in\mathbb{R},\qquad \log 1729\in\mathbb{R},\qquad \sqrt{5}\in\mathbb{R},\qquad \sin(37^\circ)\in\mathbb{R}.$

One could define $\mathbb{R}$ as the set of all possible decimal expansions, but there are problems with this:

• It requires some adjustment, because $0.999999\cdots = 1.000000\cdots.$

• Proving things about decimal expansions — even simple things like arithmetic — is a big pain.

• The idea of digits is, mathematically, an unnatural one. It is okay for the way we write mathematics to depend on the fact that we have ten fingers, but our understanding of fundamental mathematical constructions shouldn’t depend on how many fingers we have.

Producing a good and useful definition of $\mathbb{R}$ is quite tricky, and there wasn’t one until about 1870. We’ll see one later in the course.

## Sets in general

Now we have all these collections of numbers, it’s good to have a language to discuss them with.

A set is a collection of objects. The objects in a set are often called its elements.

Given a set $S$, we write:

• $a\in S$ to mean “$a$ is in $S$”.

• $a\notin S$ to mean “$a$ is not in $S$”.

• $|S|$ to denote the size of $S$: the number of elements in it. (Of course, some sets are infinite, but this works well for finite ones, at least.)

### Listing elements

If we have a small set, it might be practical to define it by listing its elements; we do so in curly brackets. Here’s an example set: $T = \left\{ \textrm{Tinky Winky}, \textrm{Dipsy}, \textrm{Laa-Laa}, \textrm{Po}\right\}.$ Let’s write some examples of facts about $T$ using our notation:

$\textrm{Po}\in T, \qquad \textrm{Noo-noo}\notin T, \qquad |T| = 4$

Note that sets don’t have any ordering on them. If we find it more convenient to list Teletubbies according to alphabetic order, we can write $T = \left\{ \textrm{Dipsy}, \textrm{Laa-Laa}, \textrm{Po}, \textrm{Tinky Winky}\right\},$ and in doing so we are defining exactly the same set $T$.

Also note that an element is either in a set, or not in it. So we could, if we wanted, define exactly the same set again by writing $T = \left\{ \textrm{Dipsy}, \textrm{Laa-Laa}, \textrm{Po}, \textrm{Po}, \textrm{Po}, \textrm{Po}, \textrm{Po}, \textrm{Tinky Winky}, \textrm{Dipsy} \right\}.$ However, there are few good reasons to write something like that.

### Empty sets

The empty set, which could be written $\left\{\right\}$, is more commonly written $\emptyset$. It has size given by $|\emptyset|=0$.

Note that $\emptyset$ is very different to $\left\{ \emptyset \right\}$. The former, as I mentioned, has no elements; the latter has exactly one element.

That shouldn’t confuse you. They’re different for pretty much the same reason that “an empty bag” is not the same thing as “a bag which contains an empty bag and nothing else”.

### Containment

If $A$ and $B$ are sets, we write $A\subset B$ to mean “if $x$ is a member of $A$ then $x$ is also a member of $B$”. We say that $A$ is a subset of $B$, or that $A$ is contained in $B$.

The symbols “$\in$” and “$\subset$” are different, and using the wrong one tends to result in nonsense.

For example, we might write $\textrm{Mathematicians}\subset\textrm{People},$ which says “all mathematicians are people”. If we used the symbol “$\in$” instead, that would mean that “mathematicians is a person”. It’s not a mistake you’d make speaking English, and if you’re using symbols you should aim to be no less precise.

Notice that, for every set $A$ we have $A\subset A\qquad\text{and}\qquad \emptyset\subset A.$