One must always be able to say, instead of ‘points, straight lines, and planes’, ‘tables, chairs, and beer mugs’.
How would you convince someone over the phone that a doughnut has a hole and a ball does not? There is no picture to point at.
You have to say what a doughnut is — which points belong to it — and what it would mean to deform one shape into
another: where each point goes. Those are the two words of this chapter. A set says what belongs; a function says where everything goes. Every object in this book — a triangle, a doughnut, a family of loops, a group of symmetries — is a
set with some extra structure, and every comparison between two objects is a function. The words are easy. Using them with
care is what will let us count the holes in shapes that nobody can draw.
Sets: collections of things
A set is a collection of things, called its elements (or members). That sounds like the whole story,
but the word “collection” hides two decisions:
A set knows only who is in it. Order does not matter, and neither does repetition. The only question you
can ask a set is “is this thing one of your elements?”, and the answer is always yes or no.
Anything can be an element. Numbers, points, words, shapes, functions — even other sets. This is Hilbert’s
point in the epigraph: mathematics never cares what its objects are, only how they are related. A set of beer mugs is
as good a set as a set of numbers.
The simplest way to describe a small set is to list its elements between curly braces, separated by commas. This is called roster notation:
X={1,2,3},2∈X,7∈/X.
Because a set only records membership, {1,2,3},{3,1,2} and {1,1,2,3} are three names for the same
set: each has exactly the elements 1,2 and 3. Listing an element twice does not put it in twice.
For large or infinite sets we use “…” to say “continue the obvious pattern,” as in {1,2,3,…,100} or the set of
all integers {…,−2,−1,0,1,2,…}. Use the dots only when the pattern really is obvious.
The empty set
There is exactly one set with no elements at all. It is called the empty set and written ∅ (or
sometimes {}). It may seem like a joke, but it is indispensable: it is the answer to questions such as “which real
numbers satisfy x2=−1?”, and it will later play the role of zero for sets. Careful: {∅} is not empty — it is an empty box inside a box, a set with one element.
The number systems
Set-builder notation
Most sets are described not by listing their elements but by a property the elements share. The notation for this is called set-builder notation:
{x∈X∣P(x)}
read “the set of all x in X such that P(x).” The vertical bar means “such that”; some books use a colon instead,
writing {x∈X:P(x)}. Here X is a set we already know, and P(x) is a statement about x that is either true
or false. The new set contains exactly those elements of X for which P(x) is true.
Subsets
Shapes sit inside shapes. The rim of a disk is a circle inside the disk; the equator is a circle inside the sphere. The central
question of homology will be about exactly this situation: given a loop sitting inside a shape, is it the rim of some piece of
that shape? So the first relationship we need between two sets is “inside”.
{1,3}⊆{1,2,3}, and N⊆Z⊆Q⊆R.
Every set is a subset of itself: A⊆A.
The empty set is a subset of every set: ∅⊆A. Why? The definition demands “every element of ∅ is in A.” Since ∅ has no elements, there is nothing to check, and the statement is true — this is a vacuous truth, as explained in §0.2 How to Read Mathematics.
Since two sets are equal exactly when they have the same elements, A=B means precisely that A⊆BandB⊆A. This gives the standard way to prove that two sets are equal, the double inclusion proof: show that every element of the first is in the second, then that every element of the second is in the first. You
will see this proof shape many times.
Union, intersection, difference, complement
A complicated shape is easier to study in pieces. Cut a circle into two overlapping arcs. The circle is everything that lies in
one arc or the other; the overlap, everything in one arc and the other, is two short arcs, one at each end.
In §3.6 Exact Sequences and Mayer–Vietoris we will compute the holes of a shape from exactly this kind of
information: the pieces and how they overlap. Cutting and combining are done with four operations on sets. In each definition,
read the set-builder notation aloud; the symbols are shorthand for ordinary words.
The “or” in the definition of union is inclusive: an element that is in both A and B is certainly in A∪B. This is the standard meaning of “or” in mathematics (see §0.2 How to Read Mathematics). The pictures that make these
operations vivid are Venn diagrams: draw the universe as a rectangle and each set as a disk; then each operation
shades a region.
A Venn diagram laboratoryChoose an operation · switch on a third set
A={2,4,6,8,10,12}evenB={3,6,9,12}multiples of 3
A∪B={2,3,4,6,8,9,10,12}
Definition: A∪B={x∣x∈A or x∈B}. “Or” in mathematics is inclusive: elements in both count.
Figure 1.1.1 The universe is U={1,…,12}, with A the even numbers and B the multiples of 3. Each button shades a
set and lists its elements. Compare (A∪B)c with Ac∩Bc: they always shade the same region. With three sets,
notice the middle region A∩B∩C is drawn but empty — a picture of a set is not the set.
Playing with the figure, you discover laws — equations between sets that hold no matter what the sets are. The two
most useful are named after Augustus De Morgan:
(A∪B)c=Ac∩Bc,(A∩B)c=Ac∪Bc.
In words: not being in either set is the same as being outside both; not being in both is the same as being outside at least
one. If you have read §0.2 How to Read Mathematics, you will recognise these as the rules for negating “or” and “and.”
That is no coincidence: x∈A∪Bis the statement “x∈A or x∈B,” so set operations are logical
connectives in disguise.
Unions and intersections also make sense for more than two sets — even infinitely many. If A1,A2,A3,… are sets, ⋃nAn is the set of things lying in at least oneAn, and ⋂nAn the set of things lying
in everyAn. For example, the intervals [n1,1] grow as n grows, and their union is ⋃n≥1[n1,1]=(0,1]: every number between 0 and 1 eventually gets included, but 0 itself never does. Such unions
will appear when we glue spaces together out of many pieces.
Ordered pairs and the Cartesian product
A set does not remember order. Very often, though, order matters: the point (2,5) in the plane is not the point (5,2). So we introduce a new kind of object.
The best picture of a product is a grid. Put the elements of A along a horizontal axis and the elements of B along a
vertical axis; then each dot of the grid is one ordered pair. In particular, if A has m elements and B has n, the grid has m columns and n rows, so
∣A×B∣=∣A∣⋅∣B∣,
where ∣X∣ (read “the size of X”) denotes the number of elements of a finite set.
A × B is a gridTap a dot · change the sizes · swap the order
∣A×B∣=∣A∣⋅∣B∣=4⋅3=12
This dot is the ordered pair (3,b): first coordinate 3∈A, second b∈B. Order matters: (b,3) is a different pair, living in B × A.
size of A4
size of B3
Figure 1.1.2 Every dot is an ordered pair. The dashed lines drop from a dot to its two coordinates: reading off the first coordinate and
the second coordinate are the two projectionsA×B→A and A×B→B. Swapping to B×A transposes the grid: (3,b) and (b,3) are different pairs in different sets.
The most famous product is the plane, R2=R×R, the set of all pairs (x,y) of real numbers. Likewise R3 is the set of triples (x,y,z), and Rn the set of n-tuples. The unit square is the product of two unit intervals, I×I=[0,1]×[0,1].
Products of shapes are shapes. Here is the example that matters most for us. A point of the circle S1 can be described by
an angle; a point of S1×S1 is therefore a pair of angles (θ,φ). And there is a surface whose
points are described by exactly such pairs: the torus. Going once around the doughnut’s hole changes the first angle; going once
around its tube changes the second.
The torus is a product of two circlesTurn the dials · drag the torus to rotate
θ=62∘first circle
φ=48∘second circle
(θ,φ)∈S1×S1
Figure 1.1.3 Each point of the torus is an ordered pair: an angle θ on the first circle and an angle φ on the second.
Fixing φ and letting θ vary traces the gold circle — a “row” of the product, just like a row of the grid
above; fixing θ traces the teal “column.” So T2=S1×S1.
Functions: rules with a domain and a codomain
Sets on their own are just bags of elements. Mathematics happens when we compare sets, and the tool for comparing is
the function. You probably met functions as formulas like f(x)=x2. That is one way to describe a function, but the
idea is both simpler and more general.
The definition contains two demands, and both matter. Every element of the domain must be assigned something — no input is left out. And each is assigned exactly one thing — no input gets two outputs. Nothing at all is
demanded of the codomain: some elements of Y may be hit many times, others never.
The best way to see the two demands is an arrow diagram: dots for the elements, an arrow from each x to f(x).
Six arrow diagrams
Not a function3 has no arrow
Not a function2 has two arrows
Injectiveno collisions
Surjectiveno misses
Bijectivea perfect matching
Neithera collision and a miss
Figure 1.1.4 The first two diagrams are not functions: one element of X has no arrow, or two. The other four are functions, sorted by
two questions you will meet in a moment — do two arrows ever land on the same point (amber), and is some point of Y never
hit (dashed violet)?
Injective, surjective, bijective
Two natural questions can be asked of any function, and they are the questions marked in the gallery: do different inputs
ever collide? and is anything in the codomain missed?
Read the definition of injective in its other form, the contrapositive: if x=x′ then f(x)=f(x′). That is the “no collisions” picture. And notice the order of the quantifiers in “surjective”: for
everyythere is an x. The x is allowed to depend on y; swapping the order would say something
quite different (see §0.2 How to Read Mathematics). Injections are sometimes drawn with a hooked arrow, X↪Y, and surjections with a double-headed one, X↠Y.
The arrow-diagram labTap a dot in X, then a dot in Y, to draw or erase an arrow
Functionevery element of X has exactly one arrow
Injective1 and 3 both go to b
Surjectivec is never hit
Bijectiveneeds both of the above
Tap an element of X, then an element of Y, to draw (or erase) an arrow.
size of X4
size of Y4
Load:
Figure 1.1.5 Draw any arrows you like between X and Y. The badges decide whether you have drawn a function and, if so, whether it is
injective, surjective or bijective, naming a witness whenever the answer is no. Can you make a bijection when X and Y have different sizes? (Try, then read the pigeonhole principle below.) The other two modes explore images and preimages.
The pigeonhole principle
For finite sets, injectivity has a famous consequence. If you put 10 pigeons into 9 holes, some hole receives at least two
pigeons. In our language:
For example, among any 367 people, two share a birthday (there are only 366 possible days). Turned around: an injection X→Y between finite sets forces ∣X∣≤∣Y∣, a surjection forces ∣X∣≥∣Y∣, and a bijection forces ∣X∣=∣Y∣. This last fact is the real meaning of counting, as we will see at the end of the chapter.
Images and preimages
A function sends elements to elements. It also sends sets to sets, in two directions — and the backwards direction
turns out to be the more important one.
Images go forward, from subsets of X to subsets of Y. Preimages go backward, from subsets of Y to subsets of X. The notation f−1 suggests an inverse function, but no inverse is needed: as Hammack puts it in Book of Proof, f−1(B) “has a meaning even if f is not invertible.” To compute it, you never undo f; you go through the
elements of X one at a time and ask each one, “do you land in B?”
Image and preimage on a graphDrag the round handles · switch modes
f−1(B)=f−1([1,4])=[−2,−1]∪[1,2]
Two pieces: x and −x have the same square, so every value is reached twice. The function x↦x2 has no inverse, but every set still has a preimage.
Drag the round handles on the vertical axis (or focus one and use the arrow keys).
Figure 1.1.6 The preimage of an interval B on the vertical axis: draw the band, see where it cuts the curve, and drop down to the
horizontal axis. Watch the answer change from two pieces to one piece to nothing as you move B down. In image mode, an
interval A is carried up to f(A).
The arrow-diagram lab above has image and preimage modes too: switch to them and try a function that is not injective. The
preimage of a single point, f−1({y}), is the set of all solutions of the equation f(x)=y. This gives a neat
way to restate the last section: f is surjective when every f−1({y}) is non-empty, and injective when every f−1({y}) has at most one element.
Each one is a one-line check, because membership of x in a preimage is decided by a single question about the single
element f(x). For instance, x∈f−1(B∩C) means f(x)∈B∩C, which means f(x)∈B and f(x)∈C, which means x∈f−1(B) and x∈f−1(C).
Images respect unions, f(A∪A′)=f(A)∪f(A′), but not intersections. Take f(x)=x2,A={−1} and A′={1}. Then A∩A′=∅, so f(A∩A′)=∅; but f(A)=f(A′)={1}, so f(A)∩f(A′)={1}. The collision f(−1)=f(1) is to blame: two different inputs merged, and the image cannot tell
that they came from disjoint sets.
Composition and inverses
If f takes you from X to Y, and g takes you from Y onward to Z, you can do one after the other.
The order looks backwards at first: g∘f means firstf,theng. The reason is that we write
functions on the left of their inputs. In g(f(x)), the function closest to x acts first. Reading “g after f” keeps you right. Notice also the requirement that f lands where g starts: the codomain of f must be the domain of g.
Composition, step by stepStep or play · tap a person to trace them
f:X→Y sends each person to the city they live in. Every person has exactly one arrow.
f: who lives where
Figure 1.1.7f sends each person to their city, g sends each city to its country; the composite g∘f sends each person
directly to their country. The middle set is used and then forgotten. (Rio is in Y but nobody lives there; g still
has to say where it goes, and g∘f does not care.)
Composition has two properties that make it behave like multiplication of numbers (except that the order matters):
Associativity. For f:X→Y,g:Y→Z,h:Z→W:h∘(g∘f)=(h∘g)∘f, because both send x to h(g(f(x))). So we can drop the parentheses and write h∘g∘f.
Identities.f∘idX=f and idY∘f=f: doing nothing before or after f changes
nothing.
Undoing a function: inverses
Some functions can be undone. Doubling, x↦2x on R, is undone by halving. Squaring on R cannot be undone:
from the output 4 you cannot tell whether the input was 2 or −2.
In the arrow picture, inverting a bijection simply means reversing every arrow. That only produces a function when
every element of Y receives exactly one arrow, which is exactly bijectivity.
Bijections are the mathematical meaning of “the same, up to renaming.” If there is a bijection between two sets, then as sets they are indistinguishable: rename each element of X by its partner in Y. Every later notion of sameness —
isomorphic groups, homeomorphic spaces — is a bijection that also respects some extra structure.
Dots and arrows: commutative diagrams
Later chapters juggle many maps at once: a shape, its pieces, the groups that record their holes, and maps between all of them.
Keeping track in sentences is hopeless, so mathematicians draw a diagram: a dot (or a letter) for each set, an arrow
for each function. A path of arrows stands for the composite of its functions.
“Commutes” here has nothing to do with a+b=b+a. It means “all roads lead to the same place”: start with any element of
the top-left set, follow either path, and you arrive at the same element of the bottom-right set — whichever element you
started with. Two roads that agree for one traveller can still disagree for the next, as the figure shows.
All roads lead to the same placePick x · change the bottom map · press the gold button
Top road: g(f(x))=2(x+1)=2x+2. Bottom road: k(h(x))=2x+2.
The formulas agree for every x: the square commutes, g∘f=k∘h.
starting number x3
bottom map k:
Figure 1.1.8 Four copies of Z and four maps. With k(y)=y+2 both roads send x to 2x+2, for every x: the square
commutes. With k(y)=2y the roads agree at x=1 but nowhere else — and agreeing at one input is not enough.
These pictures come with a vocabulary that you will meet again. Sets are the objects, functions are the arrows, arrows can be composed when they meet end to end, composition is
associative, and every object has an identity arrow. A collection of objects and arrows with these properties is called a category; sets and functions form the most basic one. In §5.1 Categories and Functors we will make this precise,
and in §3.5 Maps, Invariance, and First Triumphs we will see homology turn a commutative diagram of spaces into a commutative diagram of
groups — which is how it proves theorems.
Counting: finite and infinite
What does it mean to say a set has five elements? When a child counts five apples, they point at the apples one at a time
while saying “one, two, three, four, five.” They are building a bijection between the apples and the set {1,2,3,4,5}. That is the definition.
For finite sets, a few counting rules will be used constantly:
∣A∪B∣=∣A∣+∣B∣−∣A∩B∣: add the sizes, then subtract what was counted twice.
∣A×B∣=∣A∣⋅∣B∣, the grid.
There are ∣Y∣∣X∣ functions X→Y: each of the ∣X∣ elements of X independently chooses one of the ∣Y∣ possible destinations.
A set with n elements has 2n subsets. Each subset is decided by n independent yes/no switches, one per element
(“in or out?”). The set of all subsets of X is called its power set, P(X). This “subsets are
strings of switches” idea will reappear when we compute holes with on/off labels in §3.2 Chains and the Boundary Operator.
Infinite sets
The definition “same size means there is a bijection” makes sense for infinite sets too, and it leads to surprises. The map n↦2n is a bijection from N to the even natural numbers, so there are “as many” even numbers as natural
numbers, although the evens are a proper subset. Infinite sets can have the same size as a part of themselves.
A set is called countable if it is finite or has the same cardinality as N: if its elements can be listed as a
first, a second, a third, and so on, with every element appearing somewhere in the list. The integers are countable, even
though they stretch infinitely far in both directions: just alternate.
Listing the integers
Figure 1.1.9 Hop outward from 0, alternating sides: 0,1,−1,2,−2,…. Every integer is reached after finitely many hops, so
this listing is a bijection N→Z: position 2k−1 holds k, and position 2k holds −k.
With more cleverness, the rational numbers Q can be listed too (the exercise “Listing all pairs” below shows the key
trick). But not everything is
countable. In 1891 Georg Cantor gave a famously short argument that the real numbers cannot be listed. In its modern form with
decimals, it goes like this. Take any list of real numbers between 0 and 1, written as decimals, and build a new
number digit by digit: its n-th digit is 5, unless the n-th digit of the n-th number on the list is 5, in which case it is 4. This new number differs from every number on the list (from the n-th one in the n-th
digit), so the list was incomplete. Using only the digits 4 and 5 avoids a trap: a number such as 0.2000…=0.1999… has two decimal expansions, and differing in one digit would not prove two numbers different. Sets like R are called uncountable.
A short essay on why careful definitions like the ones in this chapter sharpen intuition rather than replace it.
References
Georg Cantor(1878). Ein Beitrag zur Mannigfaltigkeitslehre. Journal für die reine und angewandte Mathematik 84, 242–258.doi
Kurt Gödel(1940). The Consistency of the Axiom of Choice and of the Generalized Continuum-Hypothesis with the Axioms of Set Theory. Annals of Mathematics Studies 3, Princeton University Press.
Paul J. Cohen(1963). The independence of the continuum hypothesis. Proceedings of the National Academy of Sciences 50 (1963), 1143–1148.free online