Every proof so far has spoken of "the even integers" or "the primes" as collections, and none has said what a collection is, when two of them are the same, or how to build new ones from old.
The previous lesson completed the stock of proof methods with induction, and it leaned on collections throughout: the set of natural numbers where a statement fails, groups of horses, the collection of all formulas. This lesson makes those words exact. It sets up the language of sets that the rest of the course, and most of mathematics, is written in: how to describe a set, how to prove that one set lies inside another and that two sets are equal, the operations that build new sets from old and the laws they obey, power sets and Cartesian products, and unions and intersections of infinitely many sets at once. It ends with the paradox that showed the naive idea of a set to be contradictory, and with the axioms that repaired it. The lesson assumes the connectives, including the rule that a conditional with a false hypothesis is vacuously true, the quantifiers and , and induction. As before, starts at .
Sets and membership
A set is a collection of objects, called its elements or members, and it is determined by nothing except which objects those are. " is an element of " is written , and its negation . So and , with , , and standing as before for the natural numbers, the integers, the rationals and the reals.
This is not a definition in the strict sense, since "collection" is only another word for "set". Like "point" in geometry, "set" and "is an element of" are taken as basic, and what matters is the rules they obey. The first and most important rule says what it means for two sets to be the same.
Axiom of extensionality. Two sets are equal exactly when they have the same elements: means .
A small set can be written by listing its elements between braces, in roster notation: is the set of primes below . By extensionality, order and repetition in a list make no difference. , since each side has exactly the elements and ; writing twice names the same element twice. Longer sets are sometimes listed with dots, as in or , when the pattern cannot be mistaken.
Elements can be anything, including other sets. The set has exactly two elements, the number and the set ; the number is not one of them, since it is an element of an element, not an element. A set with no elements at all is the empty set, written . By extensionality there is only one: two sets with no elements have the same elements. And is not empty. It has one element, which happens to be the empty set, in the way that a box containing an empty box is not an empty box.
Subsets of the real line have their own notation. For real numbers , the open interval is the set of reals with , and the closed interval is the set with . Mixed ones such as include one end and not the other, and is the set of all reals greater than . The notation also means an ordered pair, met later in the lesson, and context decides which is meant.
Set builder notation
Most sets are too large to list, and are described by a property instead, in set builder notation:
read "the set of in such that ". Here is a set already known and an open sentence, in the sense of the lesson on quantifiers, and the result is the set of those elements of that make true. So
since is below and is not. Some books write a vertical bar for the colon, ; the meaning is the same.
The notation comes with one rule, and every proof about such a set uses it.
The membership rule. An object belongs to exactly when and is true.
The letter is a dummy, like the in a sum: and are the same set, . The surrounding set matters: is empty, because the previous lesson's descent argument, or the lesson on contradiction, shows that no rational squares to .
A second form puts an expression first. For a set and an expression ,
is the set of all values as runs through . So is the set of even integers, and is the set of perfect squares. Its membership rule has a hidden quantifier: exactly when . To show that is in the first set, name the witness, . To show that is not, show that no witness exists: would make even. Several variables are allowed, and then each gets its own quantifier: means that there are integers and with .
The insistence on a surrounding set in the first form looks like pedantry, since ", the set of all with property " seems just as clear. A later section shows that it is not pedantry: without the surrounding set, the notation produces a contradiction.
Subsets and equality
is a subset of , written , when every element of is an element of :
So , and . is a proper subset of when and , that is, when has at least one element that lacks. Notation for this varies between books, so this course writes it out in words.
The definition is a universal conditional, and it fixes the method of proof. To prove , let be an arbitrary element of , unpack what membership of says about , and show from that alone that satisfies the condition for membership of . This is called element chasing, and it is the direct proof of the lesson on direct proof, applied to the statement "". To disprove , the negation says what is needed: one element of that is not in .
For example, . Let be an element of the left side. By the membership rule, is an integer and , so for some integer . Then with an integer, so , and belongs to the right side. The reverse inclusion fails, and shows it: is an even integer and does not divide .
Keep and apart. The first relates an object to a set that contains it; the second relates two sets. So and , but , since the set is neither of the numbers and . Yet , and there , since the element of is not an element of . Whether a set is an element or a subset of another depends on the other set, and each claim is checked against its own definition.
The empty set is a subset of every set . The claim means . The hypothesis is false for every , so each instance of the conditional is vacuously true, and so is the universal statement. A disproof would need an element of outside , and there is no element of at all.
Three properties of are used constantly. For all sets , and : ; if and then ; and if and then . The first holds because is always true. For the second, let ; then because , and then because . The third is extensionality: together, the two inclusions say for every . The lesson on order relations names these three properties reflexivity, transitivity and antisymmetry.
The third property is the method this lesson is built round. To prove that two sets are equal, prove two subset statements, and , each by element chasing. This is a proof by double inclusion. Checking a few elements of each set is not a proof of equality, for the same reason that checking examples is not a proof of a universal statement: each inclusion is a claim about every element.
Example. Prove that .
Call the two sides and .
First, . Let . By the membership rule there are integers and with . Then , and is an integer, so has the form with , and .
Second, . Let , so for some integer . The task is to find integers and with , and it is enough to write itself in the form : since , take and . Then , so .
Each side is a subset of the other, so .
The two halves were different in kind. The first unpacked an existential hypothesis ("there are and ") and needed only algebra. The second had an existential goal, and needed a witness to be constructed. The same shape recurs whenever a set is described by a formula: showing that the formula's values lie in a set is usually routine, and showing that it reaches every element of the set is where the work is. The equation , where is the greatest common divisor of and , is Bézout's identity from the Discrete Mathematics course, and , and are its simplest instance.
Now you. Prove that .
Answer
Call the left side , and note that for every real .
First, . Let , so . A product of two real numbers is negative only when one factor is positive and the other negative. Since , the positive factor must be and the negative one . So and , and .
Second, . Let . Then and , so their product is negative, and .
Each set contains the other, so . This is the same as "solving the inequality", but written as two inclusions it is clear that both directions were checked: every solution lies in , and every point of is a solution.
Union, intersection, difference and complement
Four operations build new sets from old, and each is a connective in disguise. For sets and :
The union collects everything in either set, with the inclusive "or", so an element of both belongs to it. The intersection keeps what the two sets share. The difference , read " minus ", keeps what is in and not in . With and these are , and , and , so difference, unlike union and intersection, depends on the order. Two sets are disjoint when , that is, when they have no element in common.
The complement of is everything not in , and "everything" needs a limit. Fix a universe , a set containing every set under discussion, and define the complement of a subset of as . The universe is part of the meaning: the complement of the even integers is the odd integers when , but it also contains and when . When no universe has been fixed, write the difference and name the universe.
A fifth operation is less familiar but just as natural. The symmetric difference is the set of elements in exactly one of and :
where is exclusive "or". With the sets above, . A later section studies it.
These operations are pictured by Venn diagrams, with each set drawn as a region inside a rectangle standing for : the union is the area covered by either region, the intersection the overlap, the complement everything outside. The pictures are the best way to guess an identity. Whether they can prove one is a fair question.
Can a Venn diagram prove a set identity?
For identities built from , , and complement, a complete diagram can, and the reason is the same as the reason truth tables work. Whether an element belongs to a set built from , and by these operations depends only on the three answers to "is in ?", "in ?", "in ?". There are patterns of answers, and the eight regions of the standard three-circle diagram are exactly the eight patterns, including the region outside all three circles. So two expressions give the same set, for all choices of , and , exactly when they contain the same regions of the diagram. Checking regions is checking a finite list of cases that provably covers everything, which is a proof by cases in the sense of the lesson on direct proof.
Written as a table rather than a picture, this is a membership table: one column per set, one row per pattern of and , and a column for each expression. It is literally a truth table, with "" in place of a propositional variable, and an identity between sets holds exactly when the matching statement of logic is a tautology. That is why De Morgan's laws, the distributive laws and the rest hold for sets: each is a logical equivalence with "" written in front.
The method has limits. A picture that leaves out a region, for instance by drawing inside , checks only the special case where that region is empty, and a claim can hold there and fail in general. With four sets there are patterns, and four circles cannot show them all, since four circles in the plane make at most regions; John Venn, who introduced the diagrams in 1880, used ellipses for four sets. And the method does not reach statements about unions of infinitely many sets, or claims mixing sets with arithmetic, where element chasing is the only general tool. So this course proves identities by double inclusion, and uses diagrams and tables to find and check them.
For finite sets, size interacts with these operations in a simple way. Write for the number of elements of a finite set . If and are disjoint, then , since counting the union counts each element once and the two sets share none. In general the elements of are counted twice in , which gives
To prove it from the disjoint case, split into the disjoint sets and , and split into the disjoint sets and . Then and , and subtracting gives the formula. Of students, if study French, study German and study both, then study at least one, and study neither. The formula for three or more sets, with its alternating signs, is the subject of the Discrete Mathematics lesson on inclusion and exclusion.
The laws of set algebra
Because each operation is a connective in disguise, each law of logic from the lesson on statements and connectives becomes a law of sets. For all subsets , and of a universe :
together with De Morgan's laws, which get a section of their own below. The associative laws make brackets unnecessary in and . Each law is proved by double inclusion, and each proof is the matching law of logic applied to the statements , and . One example shows the pattern.
Example. Prove that for all sets , and , .
First, the left side is contained in the right. Let . Then , and , so or . If , then and , so . If , then in the same way . In either case belongs to .
Second, the right side is contained in the left. Let . If , then and ; since , also , so . If , the same argument with in place of gives .
Each side contains the other, so they are equal.
An "or" in the hypothesis became a proof by cases, while an "or" in the conclusion needed only one of its parts to be established. That is the pattern of most identity proofs, and knowing it in advance makes them quick to write.
Now you. Prove the other distributive law: for all sets , and , .
Answer
First, left in right. Let . If , then and , so is in the right side. If , then , so , and , so ; again is in the right side.
Second, right in left. Let . Either or . If , then . If , then forces , and forces , so , and again .
The sets are equal. The second half split on whether , a case split that the hypothesis did not offer directly; the law of excluded middle supplies it.
Once the laws are proved, they can be used like the rules of algebra, and identities can be derived without chasing elements. The useful link between difference and complement is (for subsets of ), which follows at once from the membership conditions. Then, for example,
using, in turn, the link twice, De Morgan's law with , the distributive law, a complement law and an identity law. Both styles are proofs. Element chasing is more robust, since it needs no list of laws and works for operations not on the list; algebra is shorter once the laws are available.
The subset relation can itself be expressed through the operations, and the result is a list of equivalent conditions.
Theorem. For all sets and , the following are equivalent: (i) ; (ii) ; (iii) .
Proof. We prove (i) (ii) (iii) (i), a cycle of three implications, as the lesson on direct proof recommends for such lists.
(i) (ii). Suppose . Always . Conversely, let ; if then because , and if there is nothing to show. So , and .
(ii) (iii). Suppose . Always . Conversely, let . Then , so and , that is, . So .
(iii) (i). Suppose , and let . Then , so . Hence .
Set algebra looks like the algebra of numbers, with as addition and as multiplication, and the resemblance misleads in one respect: there is no cancellation. From nothing follows about and : take , and the equation holds for every and . The same goes for , with . Problem 6 shows what does allow cancellation.
De Morgan's laws
Augustus De Morgan stated his laws for statements in his Formal Logic of 1847: is equivalent to , and to . They are proved by truth table in the lesson on statements and connectives. Since union is "or", intersection "and" and complement "not", the same laws hold for subsets and of a universe :
In words: what lies outside the union lies outside both sets, and what lies outside the intersection lies outside at least one of them.
Example. Prove that for all subsets and of .
First, left in right. Let , so and . If were in , it would be in , so ; in the same way . Hence and , so .
Second, right in left. Let , so , and . Then " or " is false, so , and .
The sets are equal. The middle of each half is De Morgan's law for statements, applied to "" and "".
Now you. Prove that for all subsets and of .
Answer
First, left in right. Let , so and . Then " and " is false, so by De Morgan's law for statements, or . In the first case and in the second , so either way .
Second, right in left. Let . If , then and , so , since every element of is in . If , the same holds with . Either way .
The sets are equal. Alternatively, the second law follows from the first by algebra: apply the first law to and to get , then take complements of both sides.
The laws hold with any set in place of the universe, since complement is only difference from : for all sets , and ,
by the same proofs with "" in place of "".
Symmetric difference
The symmetric difference , the set of elements in exactly one of and , is the set-theoretic "exclusive or". It can be built from the other operations in two standard ways.
Example. Prove that for all sets and , , and deduce that .
First, left in right. Let , so is in exactly one of and . Then . And is not in both, so . Hence .
Second, right in left. Let . Then is in at least one of and , and not in both, so in exactly one, and .
For the second description: is in exactly one of the two sets when either and , or and , and those two conditions say and . So , and the two sets in this union are disjoint.
Now you. Prove that intersection distributes over symmetric difference: for all sets , and , .
Answer
First, left in right. Let . Then , and is in exactly one of and . If and , then and , so is in exactly one of and . If and , the same holds with the roles exchanged. Either way .
Second, right in left. Let be in exactly one of and . Either way . If and , then, since , it must be that ; so and , and . The other case is the same with and exchanged. So .
The sets are equal. Union does not distribute over symmetric difference: with , the left side is , while .
Symmetric difference has the algebra of addition with remainders mod , and the reason is a counting fact.
Proposition. For all sets , and , an object belongs to exactly when it belongs to an odd number of the sets , , . Consequently .
Proof. Let be any object, and let be the number of the sets and containing , so is , or . By definition, exactly when , that is, exactly when is odd. Now exactly when is in exactly one of and . If , that means , that is, is odd, and then the number of sets among , , containing is , which is odd. If , it means , that is, is even, and then the number of the three sets containing is , which is odd. In each case, exactly when lies in an odd number of the three sets.
For associativity, note that is commutative, straight from its definition, so . By what was just proved, applied to , and in that order, this set consists of the objects lying in an odd number of , , . That is the same condition as before, since it does not depend on the order of the three sets. So the two sets have the same elements.
With associativity in hand, symmetric difference behaves like addition. The empty set is a zero, , and every set is its own negative, . So equations can be solved: if , then applying to both sides gives , and the left side is . So is the only solution, and it is one, by the same computation read backwards. This is the cancellation that union and intersection lacked. In the language of algebra, the subsets of form a group under , and with as multiplication they form a ring in which every element is its own square; this is the setting in which Boole's algebra of logic is studied today.
Power sets
The power set of a set , written , is the set of all subsets of . Its membership rule is: exactly when . For it has eight elements,
namely the empty set, three sets of one element, three of two, and itself. The elements of a power set are sets, which is where the distinction between and earns its keep: , while . The smallest cases are worth doing once by hand. The empty set has exactly one subset, itself, so , a set with one element. Then has two.
Theorem. If a finite set has elements, then has elements.
Proof. By induction on , starting at , as the induction lesson allows. Let be the statement that every set with elements has exactly subsets. For the set is , whose only subset is , and .
For the step, suppose every set with elements has subsets, and let have elements. Choose an element and let , a set with elements. Every subset of either omits or contains it, and not both. If it omits , then is a subset of , and every subset of arises this way. If it contains , then where is a subset of , and different subsets of give different sets , since can be recovered by removing . So there are subsets of each kind by the inductive hypothesis, and has subsets. By induction the theorem holds for every .
A second proof counts choices: a subset of is determined by deciding, for each in turn, whether to include it, and independent yes or no choices can be made in ways. The two proofs are the same argument; the induction is what makes "and so on for each " precise. Either way, the power set of a set of elements has elements, and its elements are themselves sets.
Example. Prove that for all sets and , .
Here the elements are sets, so let stand for one.
First, left in right. Let . Then and , that is, and . To show , let ; then and , so . Hence .
Second, right in left. Let , so . Since , transitivity of gives , and likewise . So and , and .
The sets are equal. The proof chased elements at two levels: the outer chase was over subsets , and inside it a second, ordinary chase over elements proved a subset statement.
Now you. Prove that for all sets and , and show by an example that the two sets need not be equal.
Answer
Let . If , then , so by transitivity. If , then in the same way . Either way .
For the example, take and . Then , so . But is a subset of neither nor , so it is not in . Counting confirms the gap: has elements, while has .
A subset of may take some elements from and some from , and that is exactly what misses. Equality holds precisely when one of and contains the other.
For infinite sets the question "how many subsets?" has a startling answer. Georg Cantor proved in 1891 that no set, finite or infinite, can be matched one to one with its power set, so is a larger infinity than , and there is an endless ladder of larger ones. The lesson on countable and uncountable sets proves it, and the section on Russell's paradox below shows how closely the two arguments are related.
Cartesian products
In a set, order does not matter: . Coordinates need order, and so does most of mathematics. An ordered pair is an object with a first coordinate and a second coordinate , governed by one rule:
So , and is a perfectly good pair, while . Ordered pairs can be defined from sets alone, and the lesson on functions gives the standard definition; for now the rule is all that is needed.
The Cartesian product of sets and is the set of all ordered pairs with first coordinate in and second in :
It is named after René Descartes, because , written , is the coordinate plane of his La Géométrie (1637). With and ,
and consists of the pairs the other way round, so here: the product is not commutative. Products of three or more sets are formed from ordered triples and so on. In the same way is the set of ordered -tuples of elements of . For any set , , since there is no second coordinate to choose.
Proposition. If and are finite, then .
Proof. Let and , and list as . Sort the pairs by first coordinate: for each , the pairs with first coordinate are for , which are different pairs, since pairs with different second coordinates differ. These rows are disjoint, since pairs with different first coordinates differ, and together they make up . So with terms, which is . (The step "adding disjoint rows gives the sum of their sizes" is the disjoint case of the union formula, extended to sets by induction on .)
This is the product rule of counting, and repeated, it gives . The lesson on functions uses it to count the functions between two finite sets.
The product interacts with the other operations in the expected way on one side. For all sets , and ,
To prove it: a pair lies in the left side exactly when and ( or ), and in the right side exactly when ( and ) or ( and ), and these conditions are equivalent by the distributive law of logic. Every element of either side is a pair, so the sets are equal. The same argument works with or in place of . The analogous claim for unions in both coordinates at once is false, and Problem 8 shows why.
Unions and intersections of families
Two sets have a union and an intersection, and by associativity so do any finite number. Analysis and probability need more: the union of infinitely many sets at once. The tool is an indexed family of sets, a set for each in some index set . Its union and intersection are defined by the quantifiers, as the two-set versions were defined by the connectives:
So the union collects everything that lies in at least one , and the intersection keeps what lies in every . When these are and , since "there is an among and " is an "or", and "for every among and " is an "and". When one also writes and . The symbol there is notation only; there is no set .
Proofs about families are element chasing with a quantifier in the membership condition. To show is in a union, produce an index with . To show is in an intersection, let be an arbitrary index and show . To show is not in an intersection, produce one index with . Arguments about intervals of reals often need one fact about , the Archimedean property: for every real number there is a natural number with . It is proved from the completeness of in the lesson on the real numbers, and used here freely.
Example. Prove that .
Write , so , , , and the intervals grow towards both ends of .
First, the union is contained in . Let be in the union. Then for some natural number , so . Since , this gives .
Second, is contained in the union. Let . The task is to produce one with and , and since and are both positive, it is enough to take at least as large as and as . By the Archimedean property there is a natural number greater than the larger of these two numbers. Then and , so , and is in the union.
The sets are equal. Each contains its end points, while the union contains neither nor . So a union of infinitely many closed intervals need not be a closed interval, a first sign that infinite operations behave differently from finite ones.
Now you. Prove that .
Answer
First, is contained in the intersection. For every natural number , , so . As was arbitrary, lies in the intersection.
Second, the intersection is contained in . We prove the contrapositive: if , then is not in the intersection. Let , so . By the Archimedean property there is a natural number , and then . So , since the members of that interval have absolute value less than . One index where fails is enough to keep out of the intersection.
The sets are equal. Each interval in the family is open, and the intersection is the closed interval : the mirror image of the Example.
The same technique shows that : a real in every interval would satisfy , and then some gives , so . Yet the intersection of any finite number of these intervals is the smallest of them, for the largest index present, which is not empty. What holds at every finite stage can fail for the whole family, and this is the reason the lesson on the real numbers needs closed intervals in its nested interval theorem.
De Morgan's laws extend to families, with the quantifier rules of the lesson on quantifiers doing the work that De Morgan's laws for "and" and "or" did before. For subsets of a universe ,
For the first: an element of is outside the union exactly when , which is equivalent to , that is, for every , which is membership of the intersection of the complements. Each step is an equivalence, so both inclusions are proved at once. The second law is the same argument with turned into . The distributive laws extend too: , since " and there is an with " says the same as "there is an with and ".
Russell's paradox
Georg Cantor, who created the theory of sets, described a set in 1895 as any collection into a whole of definite, distinct objects of our intuition or thought. Read literally, that allows a set for every property , with no surrounding set: the collection of all objects with the property. Gottlob Frege built his logical foundation of arithmetic, the Grundgesetze der Arithmetik, on a principle of exactly this kind. In 1901 Bertrand Russell found that it is contradictory.
Take the property "", " is not an element of itself". Most sets have it: the set of even integers is not an even integer, and is not an element of . If every property defines a set, then there is a set
and its membership rule says that for every object , exactly when . Now ask whether is an element of itself, by taking :
No statement can be equivalent to its own negation. If , the rule gives ; if , the rule gives . Either way there is a contradiction, and there is no third case. So the assumption that every property defines a set is false.
Russell wrote to Frege on 16 June 1902, as the second volume of the Grundgesetze was going to press. Frege added an appendix to that volume, published in 1903, acknowledging that the paradox struck at the foundation of his system. The episode is one of the turning points in the history of mathematics: it showed that intuition about collections, however clear it feels, can be inconsistent, and that the rules for forming sets have to be stated explicitly.
The popular version is the village barber who shaves exactly those villagers who do not shave themselves: does he shave himself? The same reasoning shows he does if and only if he does not, and the resolution is simply that no such barber exists. That is the right reading of Russell's argument too. It is a proof, by contradiction, that no set has the property .
The repair used in this lesson from the start is to form sets by a property only inside a set already known, as . Run Russell's argument on
for an arbitrary set . Its membership rule is: exactly when and . Suppose . Then taking gives , the same contradiction. So . Nothing is contradictory any more: the argument has become a proof.
Theorem. For every set there is a set not belonging to . In particular, there is no set of all sets.
Proof. Let be a set. By the argument just given, the set is not an element of . If there were a set containing every set, then would be a set not in , a contradiction.
This is why a complement needs a universe. The "set of everything" that would make meaningful without a universe does not exist.
What does Russell's paradox have to do with Cantor's theorem?
They are the same argument. Cantor's theorem, proved in the lesson on countable and uncountable sets, says that for every set there is no function that assigns to each element of a subset of in such a way that every subset is assigned to some element. The proof builds the subset
and shows that no element has : if it did, then would hold exactly when , which is impossible. The set differs from each at the element , like a diagonal.
Russell arrived at his paradox, by his own account, by thinking about this proof. If there were a set of all sets, then every subset of would itself be a set, hence an element of , so . In pure set theory every object is a set, so every element of is also a subset of , and the rule assigns to each element of a subset of ; every subset of is assigned to something, namely to itself. Cantor's theorem says that cannot happen, and his set becomes , which is Russell's . Cantor's contradiction has become Russell's paradox. In Cantor's hands the argument proves that power sets are bigger; in Russell's, that some collections are too big to be sets.
The same diagonal shape appears again and again in logic. Kurt Gödel's first incompleteness theorem (1931) builds a sentence that says of itself that it is not provable, and Alan Turing's proof (1936) that no program can decide whether every program halts builds a program that does the opposite of what the supposed decider predicts about it. Each time, an object is defined by disagreeing with the entry on the diagonal of a table that was supposed to be complete.
The axioms of set theory
Russell's paradox showed that sets cannot be formed by any property whatever. Some other rule for forming sets is needed, strong enough to build everything mathematics uses and restrained enough to avoid contradiction. Ernst Zermelo proposed the first such list of axioms in 1908. Abraham Fraenkel and Thoralf Skolem each added an axiom of replacement in 1922, and John von Neumann proposed the axiom of foundation in the 1920s. The result, called Zermelo and Fraenkel set theory, or ZF, and ZFC when the axiom of choice is included, is the standard foundation of mathematics today. Informally, its axioms say:
Extensionality. Sets with the same elements are equal.
Empty set. There is a set with no elements.
Pairing. For any objects and there is a set . With this gives .
Union. For any set whose elements are sets, there is a set whose elements are exactly the elements of the elements of . With this is , and with it is .
Power set. For any set there is a set of all its subsets.
Separation. For any set and any property expressible in the language of sets, there is a set .
Replacement. For any set and any rule assigning an object to each , there is a set .
Infinity. There is a set that contains and, with each element , also contains .
Foundation. Every non-empty set has an element with . One consequence is that no set is an element of itself.
Choice. For every family of non-empty sets there is a way of choosing one element from each.
Every construction in this lesson comes from these axioms. Intersection and difference come from separation, as and , and so does a complement inside a universe. Union needs an axiom of its own, since there is no larger set given in advance to carve it out of; so does the power set. Russell's set is forbidden because separation only ever carves a subset from a set already available, which is exactly the repair of the previous section. The Cartesian product comes from separation inside , once ordered pairs are defined as sets, as the lesson on functions does. And the axiom of infinity supplies the natural numbers, as the first deeper explanation below describes.
What the axioms cannot do is prove themselves consistent. Gödel's second incompleteness theorem, of 1931, shows that a consistent system of this strength cannot prove its own consistency, so the evidence for ZF is of another kind: the axioms describe a clear picture, in which sets are built up in stages from the empty set, and more than a century of intensive use has produced no contradiction. In practice mathematicians rarely cite the axioms. They form sets as this lesson has, by separation, unions, power sets and products, confident that each step could be justified from the list if anyone asked.
How can numbers be built out of sets?
If sets are the foundation of mathematics, the natural numbers must be sets too. John von Neumann's definition of 1923 is the one used today. It starts at and builds each number as the set of all the numbers before it:
and in general the successor of is . Each number is then a set with exactly elements, and means simply , which also gives . The axiom of infinity says precisely that some set contains and is closed under , and the intersection of all subsets of that set with this property is the smallest such set: the set of all natural numbers.
Now induction, which the previous lesson derived from the well-ordering principle, a property of this course takes as basic, becomes a theorem about sets. Let be a subset of that contains and contains whenever it contains . Then is one of the sets whose intersection defined , so , and hence . That is the induction axiom of Peano, derived from the axioms of sets.
The rest of the number system follows. Integers are built from pairs of natural numbers, with standing for and two pairs identified when they stand for the same difference; rationals are built from pairs of integers in the same way, which is the construction in the lesson on equivalence relations; and real numbers are built from sets of rationals. So every object in this course, from to a function on , can be modelled as a set built from in stages. Nobody thinks of as when adding, and nobody needs to; the point is that the foundation holds.
(This course starts at , the convention of number theory and analysis; set theory starts it at . Nothing of substance depends on the choice.)
What is the axiom of choice, and why was it controversial?
For a finite family of non-empty sets, choosing one element from each needs no axiom: pick an element of the first set, then of the second, and so on, which is an induction on the number of sets. For infinite families, no finite process makes all the choices, and the axiom asserts that a choice function exists anyway. Russell's illustration: from infinitely many pairs of shoes one can choose a shoe from each pair without the axiom, by the rule "take the left one", but from infinitely many pairs of socks, where the two members of a pair are indistinguishable, no rule is available, and only the axiom supplies a choice.
Zermelo stated the axiom in 1904, to prove that every set can be well ordered, that is, given an order in which every non-empty subset has a least element, as has. The proof was controversial, because the axiom asserts that something exists without saying what it is, the objection the constructivists raised against non-constructive proofs in the lesson on direct proof. It also has strange consequences. Stefan Banach and Alfred Tarski showed in 1924, using choice, that a solid ball can be cut into finitely many pieces that can be moved rigidly and reassembled into two balls of the same size as the first; the pieces are so irregular that they have no volume at all.
The question was settled as far as it can be. Kurt Gödel showed in 1938 that if ZF is consistent, it stays consistent when choice is added, and Paul Cohen showed in 1963 that it also stays consistent when the negation of choice is added. So choice can be neither proved nor refuted from the other axioms. Most mathematicians accept it, because much of mathematics depends on it: that every vector space has a basis, and many results in analysis and algebra, are equivalent to it or need it. Its most used form in practice is Zorn's lemma, stated in the lesson on order relations.
Sets now have a precise language, a method of proof and a foundation. A set on its own does nothing, though. Mathematics is mostly about processes that turn one thing into another, a number into its square or a point into its reflection, and the next lesson makes those processes precise as functions, built, like everything else, out of sets.
Problems
Work each problem on paper before opening anything; for Core and Challenge problems, try the hint before the solution.
Warm-up
1. In the universe , let and . List the elements of , , , , , , and .
Solution
, , , , and , the elements in exactly one of the two sets.
. . Since , , the same set, as De Morgan's law requires.
2. Decide which statements are true: (a) ; (b) ; (c) ; (d) ; (e) ; (f) ; (g) ; (h) .
Solution
(a) False: has no elements at all. (b) True: the empty set is a subset of every set. (c) True: is the one element of . (d) True: every set is a subset of itself.
(e) True: is one of the two elements, and . (f) True: the only element of is , which is an element of . (g) True: the only element of is , which is an element of . (h) False: the elements of are and , and is neither, since its only element is while the only element of is , and .
3. Write out , and in full, and find the number of elements of .
Solution
, with elements.
, with element.
, with elements.
has elements, so by the theorem on power sets has elements.
4. List the elements of each set: (a) ; (b) ; (c) ; (d) ; (e) .
Solution
(a) , since and .
(b) The values of for are , so the set is .
(c) , since the square of a real number is never negative.
(d) If with integers and , then one square is and the other . So the set is , four pairs.
(e) , four pairs, as requires; and are different.
Core
5. Let , and be sets. (a) Prove that . (b) Prove or disprove that . (c) Prove that .
Hint
Write each membership condition with "and", "or" and "not", and simplify with the laws of logic. For (b), try sets with a single element.
Solution
(a) For every object : exactly when , and . And exactly when and , that is, and not ( or ), which by De Morgan's law for statements is , and . The conditions are the same, so each set is contained in the other and they are equal.
(b) False. Take . Then , so , while , so . Difference is not associative.
(c) For every object , exactly when and not ( and ). By De Morgan's law for statements, the second part is ( or ). So the condition is: , and or . By the distributive law of logic this is: ( and ) or ( and ), which says . Each step is an equivalence, so the sets are equal. With the sets of (b), the right side is , as it should be.
6. Let , and be sets. (a) Show that does not imply . (b) Prove that if and , then . (c) Prove that if , then .
Hint
For (b), take and split into the cases and ; each case uses one of the two hypotheses. For (c), use the algebra of symmetric difference from the lesson.
Solution
(a) Take , and . Then , but .
(b) Suppose and . We show . Let . If , then , so . If , then , so or , and since , . In both cases , so . The hypotheses are unchanged when and are exchanged, so the same argument gives , and .
(c) Suppose , and take the symmetric difference of both sides with . Using associativity, and ,
So . Symmetric difference cancels where union and intersection alone do not, and (b) shows that union and intersection together do.
7. Find the flaw in this proof, and show that the claim is false.
Claim. For all sets , and , if , then or .
Proof. Suppose , and let . Then , so or . If , then since was an arbitrary element of , . If , then in the same way . So or .
Hint
Which of and contains depends on . Compare "for every , or " with "every is in , or every is in ".
Solution
The claim is false. Take , and . Then , but because , and because .
The flaw is in the case split. Once the proof splits into cases according to whether , the element is no longer arbitrary: in the first case it is an element of that happens to lie in . Concluding "" from that case generalises from a restricted , the misuse of "arbitrary" discussed in the lesson on direct proof. What the argument actually proves is , which is just the hypothesis again. The claim needs , and a universal quantifier does not distribute over "or", as the lesson on quantifiers showed.
The correct statement in the other direction is true: if or , then , since and are both subsets of .
8. Let , , and be sets. (a) Prove that . (b) Prove that , and show by an example that equality can fail.
Hint
Every element of each side is an ordered pair, so let be an arbitrary pair and compare the conditions on and . For the example, draw the sets as rectangles in the plane.
Solution
(a) Every element of either side is an ordered pair, so it is enough to compare the conditions for a pair to belong. The pair is in exactly when ( and ) and ( and ). Rearranging the "and"s, this is ( and ) and ( and ), that is, and , which is the condition for . So the sets are equal.
(b) Let . If , then and , so . If , the same argument applies with and . So the inclusion holds.
For the example, take and . Then , while also contains and . In pictures, the union of two squares on a diagonal is smaller than the square that spans both.
9. Prove that for all sets and , if and only if . Deduce that if and only if .
Hint
For the forward direction, find an element of that tells you about itself.
Solution
() Suppose . Since , we have , so , which means .
() Suppose , and let , so . By transitivity of , , so . Hence .
For the deduction: holds exactly when and . By the first part this holds exactly when and , which by double inclusion is .
10. Prove that and that .
Hint
Each needs the Archimedean property in exactly one of the two inclusions. For a real number that is supposed to be kept out, find one index that excludes it; for a real number that is supposed to be let in, find one index that includes it.
Solution
The intersection. First, is contained in it. Let and let be any natural number. Then , so . As was arbitrary, is in the intersection.
Second, the intersection is contained in . Let be in every . Taking gives . Suppose, for contradiction, that . Then , and by the Archimedean property there is a natural number , so , that is, . Then , a contradiction. So .
The union. First, it is contained in . If for some , then .
Second, is contained in it. Let . Then , and by the Archimedean property there is a natural number , so , that is, . Hence , and is in the union.
So an intersection of half-open intervals can be closed, and a union of closed intervals can be half-open.
11. Using only the formula for finite sets and the laws of set algebra, prove that for all finite sets , and ,
Use it to count the integers from to that are divisible by at least one of , and .
Hint
Apply the two-set formula with and , then use the distributive law on and apply the two-set formula again.
Solution
By the two-set formula with and ,
The first term is , by the two-set formula again. For the last term, the distributive law gives , and the intersection of these two sets is , by the associative, commutative and idempotent laws. So, by the two-set formula once more,
Substituting both into the first display gives the formula.
For the count, let , and be the multiples of , and in . A number is a multiple of both and exactly when it is a multiple of (proved in the lesson on direct proof), and similarly for the other pairs and for all three, since , and are distinct primes. The number of multiples of from to is the quotient of by . So , , , , , , , and
So of the numbers are divisible by at least one of , and , and by none of them.
Challenge
12. Prove that there is no set with . Deduce again that there is no set of all sets.
Hint
Russell's set, carved out of , is a subset of .
Solution
Suppose, for contradiction, that is a set with . By separation there is a set
and , so , and therefore . Now apply the membership rule to itself. Since , the rule says exactly when . If , then ; if , then . Either way there is a contradiction, so no such exists.
If were a set containing every set, then every subset of , being a set, would be an element of , so , which has just been shown impossible. So there is no set of all sets.
For finite sets the result is also a matter of counting, since a set with elements has subsets. The argument above works for every set, finite or infinite, and it is a special case of Cantor's theorem that is always strictly larger than .
13. Let , and be subsets of a universe . Call a subset of generated if it can be built from , and by finitely many applications of , and complement. For each of the choices of , and , call an atom. (a) Prove that the atoms are pairwise disjoint and that their union is . (b) Prove that every generated set is a union of some collection of atoms. (c) Deduce that there are at most generated sets, and exactly when every atom is non-empty.
Hint
For (b), use structural induction on how a generated set is built. The union of the atoms in a collection , the union of those in , and the intersection of the two, correspond to and ; by (a), the complement corresponds to the atoms not in .
Solution
(a) Let . Exactly one of , holds, and likewise for and . So lies in exactly one atom, namely the one whose factors are the sets containing . Every element of is in some atom, so the union of the atoms is ; no element is in two atoms, so the atoms are pairwise disjoint.
(b) For a collection of atoms, write for the union of the atoms in (with when is empty). By (a), for every , exactly when the unique atom containing belongs to . We prove by structural induction that every generated set has the form .
Base cases: is the union of the four atoms whose first factor is , since an element of lies in one of them and each of them lies inside . Likewise for and .
Steps: suppose and . For , let be the atom containing . Then exactly when or , that is, , so . In the same way , and exactly when , so , where is the collection of atoms not in . So every rule preserves the property, and every generated set is a union of atoms.
(c) There are atoms, hence collections of atoms by the theorem on power sets, and by (b) each generated set is for one of them. So there are at most generated sets.
Conversely, every is generated: each atom is generated, as an intersection of generated sets; unions of generated sets are generated; and is generated. If every atom is non-empty, then different collections give different sets: if , some atom lies in one and not the other, say in and not in , and an element of that atom is in but, by (a), not in . So there are exactly generated sets in that case.
The count matches the truth tables in three variables, and (b) is the set version of the fact from the lesson on statements and connectives that every formula is equivalent to a disjunction of conjunctions, its disjunctive normal form.