Homology
Part I · Foundations
Chapter 1.1

Sets and Functions

Collections and the arrows between them

about 45 min Builds on 0.2 How to Read Mathematics

One must always be able to say, instead of ‘points, straight lines, and planes’, ‘tables, chairs, and beer mugs’.

— David Hilbert, as reported by Otto Blumenthal (1935), translated from the German

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:

Because a set only records membership, and are three names for the same set: each has exactly the elements and 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 or the set of all integers 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 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:

read “the set of all in such that The vertical bar means “such that”; some books use a colon instead, writing Here is a set we already know, and is a statement about that is either true or false. The new set contains exactly those elements of for which 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”.

  • and
  • Every set is a subset of itself:
  • The empty set is a subset of every set: Why? The definition demands “every element of is in Since has no elements, there is nothing to check, and the statement is true — this is a , as explained in §0.2 How to Read Mathematics.

Since two sets are equal exactly when they have the same elements, means precisely that and This gives the standard way to prove that two sets are equal, the 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 and is certainly in 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 laboratory Choose an operation · switch on a third set
even multiples of 3
123456789101112
Definition: “Or” in mathematics is inclusive: elements in both count.
Figure 1.1.1 The universe is with the even numbers and the multiples of Each button shades a set and lists its elements. Compare with they always shade the same region. With three sets, notice the middle region 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:

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: is the statement “ or so set operations are logical connectives in disguise.

Unions and intersections also make sense for more than two sets — even infinitely many. If are sets, is the set of things lying in at least one and the set of things lying in every For example, the intervals grow as grows, and their union is every number between and eventually gets included, but 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 in the plane is not the point So we introduce a new kind of object.

The best picture of a product is a grid. Put the elements of along a horizontal axis and the elements of along a vertical axis; then each dot of the grid is one ordered pair. In particular, if has elements and has the grid has columns and rows, so

where (read “the size of denotes the number of elements of a finite set.

A × B is a grid Tap a dot · change the sizes · swap the order
AB1234abc(3, b)
This dot is the ordered pair first coordinate second Order matters: is a different pair, living in B × A.
size of A 4
size of B 3
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 projections and Swapping to transposes the grid: and are different pairs in different sets.

The most famous product is the plane, the set of all pairs of real numbers. Likewise is the set of triples and the set of -tuples. The unit square is the product of two unit intervals,

Products of shapes are shapes. Here is the example that matters most for us. A point of the circle can be described by an angle; a point of 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 circles Turn the dials · drag the torus to rotate
first circle
second circle
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

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 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 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 to

Six arrow diagrams
Figure 1.1.4 The first two diagrams are not functions: one element of 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 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 : if then That is the “no collisions” picture. And notice the order of the quantifiers in “surjective”: for every there is an The is allowed to depend on swapping the order would say something quite different (see §0.2 How to Read Mathematics). Injections are sometimes drawn with a hooked arrow, and surjections with a double-headed one,

The arrow-diagram lab Tap a dot in X, then a dot in Y, to draw or erase an arrow
Function every element of X has exactly one arrow
Injective 1 and 3 both go to b
Surjective c is never hit
Bijective needs both of the above
XY1234abcd

Tap an element of then an element of to draw (or erase) an arrow.

size of X 4
size of Y 4
Load:
Figure 1.1.5 Draw any arrows you like between and 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 and 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 between finite sets forces a surjection forces and a bijection forces 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 to subsets of Preimages go backward, from subsets of to subsets of The notation suggests an inverse function, but no inverse is needed: as Hammack puts it in Book of Proof, “has a meaning even if is not invertible.” To compute it, you never undo you go through the elements of one at a time and ask each one, “do you land in

Image and preimage on a graph Drag the round handles · switch modes
−2−11212345
Two pieces: and have the same square, so every value is reached twice. The function 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 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 down. In image mode, an interval is carried up to

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, is the set of all solutions of the equation This gives a neat way to restate the last section: is surjective when every is non-empty, and injective when every has at most one element.

Preimages are better behaved than images

Preimages respect every set operation:

Each one is a one-line check, because membership of in a preimage is decided by a single question about the single element For instance, means which means and which means and

Images respect unions, but not intersections. Take and Then so but so The collision is to blame: two different inputs merged, and the image cannot tell that they came from disjoint sets.

Composition and inverses

If takes you from to and takes you from onward to you can do one after the other.

The order looks backwards at first: means first then The reason is that we write functions on the left of their inputs. In the function closest to acts first. Reading “ after keeps you right. Notice also the requirement that lands where starts: the codomain of must be the domain of

Composition, step by step Step or play · tap a person to trace them
X · peopleY · citiesZ · countriesfAnaBenChloéDevLyonParisKyotoRioFranceJapanBrazil

sends each person to the city they live in. Every person has exactly one arrow.

f: who lives where
Figure 1.1.7 sends each person to their city, sends each city to its country; the composite sends each person directly to their country. The middle set is used and then forgotten. (Rio is in but nobody lives there; still has to say where it goes, and does not care.)

Composition has two properties that make it behave like multiplication of numbers (except that the order matters):

  • Associativity. For because both send to So we can drop the parentheses and write
  • Identities. and doing nothing before or after changes nothing.

Undoing a function: inverses

Some functions can be undone. Doubling, on is undone by halving. Squaring on cannot be undone: from the output you cannot tell whether the input was or

In the arrow picture, inverting a bijection simply means reversing every arrow. That only produces a function when every element of 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 by its partner in 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 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 place Pick x · change the bottom map · press the gold button
88=3
Top road: Bottom road:
The formulas agree for every the square commutes,
starting number x 3
bottom map k:
Figure 1.1.8 Four copies of and four maps. With both roads send to for every the square commutes. With the roads agree at 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 That is the definition.

For finite sets, a few counting rules will be used constantly:

  • add the sizes, then subtract what was counted twice.
  • the grid.
  • There are functions each of the elements of independently chooses one of the possible destinations.
  • A set with elements has subsets. Each subset is decided by independent yes/no switches, one per element (“in or out?”). The set of all subsets of is called its power set, 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 is a bijection from 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 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
……00112−1324−2536−3748−4
Figure 1.1.9 Hop outward from alternating sides: Every integer is reached after finitely many hops, so this listing is a bijection position holds and position holds

With more cleverness, the rational numbers 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 and written as decimals, and build a new number digit by digit: its -th digit is unless the -th digit of the -th number on the list is in which case it is This new number differs from every number on the list (from the -th one in the -th digit), so the list was incomplete. Using only the digits and avoids a trap: a number such as has two decimal expansions, and differing in one digit would not prove two numbers different. Sets like are called uncountable.

Exercises

Summary

Further reading

References

  1. Georg Cantor (1878). Ein Beitrag zur Mannigfaltigkeitslehre. Journal für die reine und angewandte Mathematik 84, 242–258. doi
  2. 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.
  3. Paul J. Cohen (1963). The independence of the continuum hypothesis. Proceedings of the National Academy of Sciences 50 (1963), 1143–1148. free online