2 Sets and functions

2.1 Introduction to set theory

2.1.1 Definition of a set

A set is a collection of (mathematical) objects. There is an entire field of mathematics called set theory dedicated to the study of sets and to their use as a foundation for mathematics, but in MATH0005 we are going to give only an informal introduction to sets and their properties. If you want to know more, see the further reading section at the end of this chapter.

We use curly brackets to denote sets and commas to separate the things in the set. {1,2,3} is the set containing 1, 2, and 3.

Sets are what we use for reasoning about unordered collections of objects, ignoring repetition. Unordered means that we consider {1,2} and {2,1} the same set, ignoring repetition means that {1,1}={1}. You will see why this is true when we make a definition of set equality shortly.

2.1.2 Elements of a set

The things in a set are called its elements or members. We write aX to mean that a is an element or member of the set X, and aX to mean that a is not an element or member of X.

There is a unique set with no elements, called the empty set and written or {}. No matter what a is, a.

We allow any kind of mathematical object, including sets themselves, as elements of sets. Sets can contain functions, matrices, vectors, numbers, and sets themselves.

Example 2.1.1.
{,1,{2},{{3}}}

is a set whose four elements are the empty set, the number 1, the set containing the number 2, and the set containing the set containing 3.

Example 2.1.2.

Let X={1,2,{3}}. Then 1X, 0X, 3X, {3}X.

2.1.3 Subsets and set equality

We need vocabulary for talking about one set being contained in another.

Definition 2.1.1.
  • X is a subset of Y, written XY, if and only if every element of X is also an element of Y.

  • If X is not a subset of Y we write XY.

  • X is equal to Y, written X=Y, if and only if for any a we have aX if and only if aY.

  • X is a proper subset of Y, written XY, if and only if XY but XY.

Thus X being a proper subset of Y means that X is a subset of Y and Y contains something that X does not contain.

There is an important way to rephrase the definition of two sets being equal: X=Y if and only if XY and YX. This is sometimes useful as a proof technique, as you can split a proof of X=Y into first checking XY and then checking YX.

Example 2.1.3.
  • {0}{0,1}

  • {0}{0,1}

  • {0,1}{1,2}

  • {1,2,1}={2,1}

Why is the last equality true? The only things which are elements of {1,2,1} are 1 and 2. The only things which are elements of element of {1,2} are 1 and 2. So the two sets are equal according to our definition. There’s no concept of something being an element of a set “more than once.”

This is the way in which our definition of set equality captures the idea of sets being unordered collections of objects which disregard repetition.

The definition of subset means that the empty set is a subset of any set. X for any set X, because x:xxX is vacuously true: there’s nothing in which could fail to be in the set X in order to make X false.

2.1.4 Set builder notation

Suppose we have a set X and a property P(x) that is true or false for each element x of X. For example, X might be the set ={,2,1,0,1,2,} of all integers and P(x) might be the property “x is even”. We write

{xX:P(x)} (2.1)

for the set of all elements of X for which the property P(x) is true. This is called set-builder notation. In our example,

{x:x is even}

is the set {,4,2,0,2,4,}. In other texts you may see a | in place of a : in set builder notation; they mean exactly the same thing.

We sometimes use the notation {x:P(x)} to mean the set of all things for which the property P(x) is true.11 1 You have to be slightly careful with this kind of unrestricted comprehension because it can lead to contradictions. You can ignore this for the purposes of MATH0005, but if you want to know more then check out the Further Reading section at the end.