Skip to content
Topos Uranos

Summary

This lesson fixes the language in which the course speaks of numbers and functions, together with what is indispensable from the logic of quantifiers. It defines inclusion and the operations on sets, proves equality by double inclusion and De Morgan’s laws, constructs the ordered pair with its characteristic property, and defines the Cartesian product and relations with their properties. It proves that the classes of an equivalence form a partition and that every partition defines an equivalence, anticipating the construction of the integers; it studies orders with their extreme elements and their bounds; and it treats functions as relations, proving that composition is associative and preserves injectivity and surjectivity, and that a function is bijective if and only if it has an inverse, which is unique. The problems count equivalences, pair the natural numbers with the even numbers, find the day of the week of a date, and decompose every function into a surjection, a bijection and an injection.

Learning objectives

  1. Write statements with quantifiers in symbolic language, negate them correctly and choose the proof strategy that their logical form calls for.
  2. Prove equalities and inclusions between sets by double inclusion, and compute unions, intersections, differences, Cartesian products and power sets of finite sets.
  3. Decide whether a relation is reflexive, symmetric, antisymmetric or transitive, and recognize equivalence relations and order relations.
  4. Construct the classes and the quotient set of an equivalence relation, and pass from an equivalence to the partition it defines, and conversely.
  5. Determine the least, greatest, minimal and maximal elements and the bounds of a subset of an ordered set.
  6. Compute images, preimages, compositions and inverses, decide whether a function is injective, surjective or bijective, and prove properties of composition.

The language of the course

The next lesson defines the natural numbers by means of a function, the successor, which is injective and does not reach 11. The next unit constructs the integers and the rational numbers as classes of an equivalence relation; the lesson on combinatorics defines the number of elements by means of bijections; the order of the natural numbers is an order relation; and the third unit composes and inverts real functions. All these words belong to a single language, which should be fixed before it is used, together with the first theorems that the course will invoke later.

It is worth pointing out what is anticipated. The examples use small natural numbers with their order, their addition, their multiplication, divisibility and the remainder of a division, as they are learned at school. The next lesson defines the natural numbers by means of the Peano axioms, and the lessons of the unit define those operations and prove their properties without using any example from this one, so there is no circularity. No theorem of this lesson depends on the examples: the numbers only serve to show the theorems in action.

What is admitted

A set is a collection of objects, its elements; one writes a∈Aa \in A to say that aa belongs to AA, and a∉Aa \notin A to deny it. Set and membership are not defined: they are primitive notions, like 11 and the successor in arithmetic. However, not every property defines a set. If there existed the set RR of all sets that do not belong to themselves, the question whether RR belongs to RR would have no answer, because by the definition of RR one would have R∈R↔R∉RR \in R \leftrightarrow R \notin R. This contradiction, discovered by Russell in 1901, forces a restriction on the formation of sets: a property only selects elements of a set already given.

Admitted fact (rules of naive set theory). The rules of naive set theory that this lesson uses are admitted without proof: two sets with the same elements are equal; from a given set AA and a property PP one forms the set {x∈A:P(x)}\{ x \in A : P(x) \} of the elements of AA that satisfy it; and there exist the empty set, the set {a,b}\{a, b\} whose only elements are aa and bb, the union of the elements of a set of sets, and the set of the subsets of a set. The existence of a set with the properties of the set of natural numbers is admitted in the next lesson.

These rules are part of the axioms of Zermelo and Fraenkel, whose study belongs to set theory and goes beyond this course; that is why they are admitted, and they are stated so that it is known exactly what is used.

The logic of quantifiers

Proofs combine statements with the connectives ¬\neg, ∧\wedge, ∨\vee, →\rightarrow and ↔\leftrightarrow, whose laws are studied in the complementary course Mathematical Logic I: Propositional Logic, starting from its language; here it suffices to recall that the implication p→qp \rightarrow q is false only when pp is true and qq false, that it is equivalent to its contrapositive ¬q→¬p\neg q \rightarrow \neg p, and that De Morgan’s laws negate a conjunction or a disjunction:

¬(p∧q)↔(¬p∨¬q),¬(p∨q)↔(¬p∧¬q)\neg \left( p \wedge q \right) \leftrightarrow \left( \neg p \vee \neg q \right), \qquad \neg \left( p \vee q \right) \leftrightarrow \left( \neg p \wedge \neg q \right)

To speak of sets one also needs statements about all elements or about some of them. If P(x)P(x) is a property of the elements of AA, the statement (∀x∈A) P(x)(\forall x \in A)\,P(x), which is read “for every xx in AA, P(x)P(x)”, asserts that all the elements of AA satisfy it; the statement (∃x∈A) P(x)(\exists x \in A)\,P(x), “there exists an xx in AA such that P(x)P(x)”, asserts that at least one satisfies it; and (∃!x∈A) P(x)(\exists! x \in A)\,P(x) asserts that exactly one satisfies it. The symbols ∀\forall and ∃\exists are called quantifiers, universal and existential.

Admitted fact (negation of quantifiers). To deny that all elements satisfy a property is to assert that some element does not satisfy it, and to deny that some element satisfies it is to assert that none does:
¬(∀x∈A) P(x)↔(∃x∈A) ¬P(x),¬(∃x∈A) P(x)↔(∀x∈A) ¬P(x)\neg (\forall x \in A)\,P(x) \leftrightarrow (\exists x \in A)\,\neg P(x), \qquad \neg (\exists x \in A)\,P(x) \leftrightarrow (\forall x \in A)\,\neg P(x)

These rules, which belong to first-order logic, are admitted; they extend De Morgan’s laws, because if A={a,b}A = \{a, b\} the universal statement is P(a)∧P(b)P(a) \wedge P(b) and the existential one is P(a)∨P(b)P(a) \vee P(b). The order of the quantifiers matters: the statement (∀n∈N)(∃m∈N)(n<m)(\forall n \in \mathbb{N})(\exists m \in \mathbb{N})(n < m) says that every natural number has a greater one, and it is true; the statement (∃m∈N)(∀n∈N)(n<m)(\exists m \in \mathbb{N})(\forall n \in \mathbb{N})(n < m) says that there is a natural number greater than all of them, greater even than itself, and it is false.

The logical form of a statement dictates the way to prove it. The strategies that this lesson uses are the following; their logical justification is studied in the lesson on deduction techniques.

  • To prove (∀x∈A) P(x)(\forall x \in A)\,P(x), take an arbitrary element xx of AA, assuming nothing about it beyond its membership in AA, and prove P(x)P(x).
  • To prove (∃x∈A) P(x)(\exists x \in A)\,P(x), exhibit a specific element of AA that satisfies PP; to refute (∀x∈A) P(x)(\forall x \in A)\,P(x), a counterexample suffices, an element that does not satisfy it.
  • To prove p→qp \rightarrow q, assume pp and deduce qq; or prove the contrapositive ¬q→¬p\neg q \rightarrow \neg p; or assume p∧¬qp \wedge \neg q and reach a contradiction.
  • To prove p↔qp \leftrightarrow q, prove the two implications p→qp \rightarrow q and q→pq \rightarrow p.
ExampleNegating that a set is bounded

A set XX of natural numbers is bounded above when there is a natural number cc greater than or equal to all its elements. Write the definition with quantifiers and negate it step by step.

Proof

  1. (∃c∈N)(∀x∈X)(x≤c)\dato{acot}{(\exists c \in \mathbb{N})(\forall x \in X)(x \leq c)}

    The definition has an existential quantifier followed by a universal one: the same cc must work for all the elements.

  2. ¬(∃c∈N)(∀x∈X)(x≤c)\resaltar{\neg} (\exists c \in \mathbb{N})(\forall x \in X)(x \leq c)

    We negate the whole statement.

  3. (∀c∈N) ¬(∀x∈X)(x≤c)(\resaltar{\forall} c \in \mathbb{N})\,\resaltar{\neg} (\forall x \in X)(x \leq c)

    The negation of an existential statement is the universal statement of the negation.

  4. (∀c∈N)(∃x∈X) ¬(x≤c)(\forall c \in \mathbb{N})(\resaltar{\exists} x \in X)\,\resaltar{\neg} (x \leq c)

    The negation of a universal statement is the existential statement of the negation.

  5. (∀c∈N)(∃x∈X)(x>c)(\forall c \in \mathbb{N})(\exists x \in X)(\resaltar{x > c})

    By the trichotomy of the order of the natural numbers, to deny x≤cx \leq c is to assert x>cx > c: the set is not bounded above when no natural number is an upper bound, because every candidate is exceeded by some element.

Sets

Membership, equality and inclusion

A set is described by listing, enumerating its elements between braces, as {1,2,3}\{1, 2, 3\}, or by set-builder notation, by means of a property, as {n∈N:n≤3}\{ n \in \mathbb{N} : n \leq 3 \}, which is the same set. The rule of extensionality says that a set is determined by its elements:

A=B↔(∀x)(x∈A↔x∈B)A = B \leftrightarrow (\forall x)(x \in A \leftrightarrow x \in B)

It follows that in a description by listing neither the order nor repetitions matter: {1,2,2}\{1, 2, 2\} and {2,1}\{2, 1\} are the same set, because they have the same elements. It also follows that there is only one set without elements, the empty set ∅\emptyset: two sets without elements have the same elements, namely none.

Definition (inclusion). A set AA is contained in a set BB, or is a subset of BB, when every element of AA is an element of BB:
A⊆B↔(∀x)(x∈A→x∈B)A \subseteq B \leftrightarrow (\forall x)(x \in A \rightarrow x \in B)

If, moreover, A≠BA \neq B, one says that AA is a proper subset of BB.

The empty set is contained in every set AA, because the implication x∈∅→x∈Ax \in \emptyset \rightarrow x \in A always has a false antecedent and is therefore true. Membership must be distinguished from inclusion: 1∈{1,2}1 \in \{1, 2\} and {1}⊆{1,2}\{1\} \subseteq \{1, 2\} are true, whereas {1}∈{1,2}\{1\} \in \{1, 2\} is false, because the only elements of {1,2}\{1, 2\} are 11 and 22, and the set {1}\{1\} is equal to neither of them: {1}≠1\{1\} \neq 1, because the set whose only element is 11 is not to be confused with 11, and {1}≠2\{1\} \neq 2.

TheoremProperties of inclusion

For all sets AA, BB and CC, inclusion is reflexive, A⊆AA \subseteq A; transitive, if A⊆BA \subseteq B and B⊆CB \subseteq C, then A⊆CA \subseteq C; and antisymmetric, if A⊆BA \subseteq B and B⊆AB \subseteq A, then A=BA = B. The last property, together with its converse, which is immediate, is the method of double inclusion: to prove that two sets are equal, one proves that each is contained in the other.

A=B↔(A⊆B∧B⊆A)A = B \leftrightarrow \left( A \subseteq B \wedge B \subseteq A \right)

Each property reduces to a law of implication, applied to an arbitrary element. The figure represents the sets as regions of the plane.

Proof

  1. (∀x)(x∈A→x∈A)(\forall x)(x \in A \rightarrow x \in A)

    Reflexivity: for every xx, the implication x∈A→x∈Ax \in A \rightarrow x \in A is true, because its consequent is its antecedent.

  2. x∈A→x∈Bx \in A \rightarrow \dato{xb}{x \in B}

    Transitivity: let xx be an arbitrary element of AA. By the first hypothesis, xx belongs to BB.

  3. x∈B→x∈C\resaltar{x \in B} \rightarrow x \in C

    By the second hypothesis, xx belongs to CC. Since xx was arbitrary, A⊆CA \subseteq C.

  4. (x∈A→x∈B)∧(x∈B→x∈A)↔(x∈A↔x∈B)(x \in A \rightarrow x \in B) \wedge (x \in B \rightarrow x \in A) \leftrightarrow \resaltar{(x \in A \leftrightarrow x \in B)}

    Antisymmetry: the two hypotheses give, for each xx, the two implications between x∈Ax \in A and x∈Bx \in B, that is, their equivalence.

  5. A=BA = B

    By extensionality, AA and BB are equal. Conversely, if A=BA = B, each is contained in the other by reflexivity.

Union, intersection and difference

Definition (operations on sets). The union of AA and BB is the set of the elements that belong to at least one of them; the intersection, the set of those that belong to both; and the difference A∖BA \setminus B, the set of those that belong to AA and not to BB:
x∈A∪B↔x∈A∨x∈B,x∈A∩B↔x∈A∧x∈B,x∈A∖B↔x∈A∧x∉Bx \in A \cup B \leftrightarrow x \in A \vee x \in B, \qquad x \in A \cap B \leftrightarrow x \in A \wedge x \in B, \qquad x \in A \setminus B \leftrightarrow x \in A \wedge x \notin B

If B⊆AB \subseteq A, the difference A∖BA \setminus B is called the complement of BB relative to AA. Two sets are disjoint when their intersection is empty.

Each operation translates a connective: union, disjunction; intersection, conjunction; difference, conjunction with a negation. If this is so, each logical law produces a law of sets: union and intersection are commutative, associative and distributive over each other because the connectives are, and all these laws are proved like the following theorem. The complement is always taken relative to a reference set, because a set of everything that is not in BB would rebuild Russell’s paradox.

ExampleThe divisors of 12 and of 18

Let A={1,2,3,4,6,12}A = \{1, 2, 3, 4, 6, 12\} be the set of the divisors of 1212 and B={1,2,3,6,9,18}B = \{1, 2, 3, 6, 9, 18\} that of the divisors of 1818. Compute their union, their intersection and their two differences.

Proof

  1. A∩B={1,2,3,6}A \cap B = \dato{c}{\{1, 2, 3, 6\}}

    The common elements are the divisors of both numbers, that is, the divisors of 66.

  2. A∖B={1,2,3,4,6,12}∖{1,2,3,6}={4,12}A \setminus B = \{1, 2, 3, 4, 6, 12\} \setminus \resaltar{\{1, 2, 3, 6\}} = \{4, 12\}

    The elements of AA that are not divisors of 1818 are those that remain after removing the common ones from AA.

  3. B∖A={9,18}B \setminus A = \{9, 18\}

    In the same way, the divisors of 1818 that are not divisors of 1212.

  4. A∪B=(A∖B)∪(A∩B)∪(B∖A)={1,2,3,4,6,9,12,18}A \cup B = \left( A \setminus B \right) \cup \left( A \cap B \right) \cup \left( B \setminus A \right) = \{1, 2, 3, 4, 6, 9, 12, 18\}

    The union gathers the three parts, which are pairwise disjoint: each element appears only once, and 4+2+2=84 + 2 + 2 = 8.

TheoremDe Morgan’s laws for sets

For all sets AA, BB and CC, the complement relative to AA of a union is the intersection of the complements, and that of an intersection is the union of the complements:

A∖(B∪C)=(A∖B)∩(A∖C),A∖(B∩C)=(A∖B)∪(A∖C)A \setminus \left( B \cup C \right) = \left( A \setminus B \right) \cap \left( A \setminus C \right), \qquad A \setminus \left( B \cap C \right) = \left( A \setminus B \right) \cup \left( A \setminus C \right)

One proves that an arbitrary element belongs to the left-hand side if and only if it belongs to the right-hand side, translating each operation into its connective. The figure shades on a Venn diagram the regions involved.

Proof

  1. x∈A∖(B∪C)↔x∈A∧¬(x∈B∪C)x \in A \setminus \left( B \cup C \right) \leftrightarrow x \in A \wedge \resaltar{\neg} \left( x \in B \cup C \right)

    Let xx be arbitrary. By the definition of difference, to belong to the left-hand side is to be in AA and not to be in B∪CB \cup C.

  2. ↔x∈A∧¬(x∈B∨x∈C)\leftrightarrow x \in A \wedge \neg \left( x \in B \resaltar{\vee} x \in C \right)

    By the definition of union.

  3. ↔x∈A∧(x∉B∧x∉C)\leftrightarrow x \in A \wedge \left( x \resaltar{\notin} B \resaltar{\wedge} x \resaltar{\notin} C \right)

    By De Morgan’s law of logic, the negation of a disjunction is the conjunction of the negations.

  4. ↔(x∈A∧x∉B)∧(x∈A∧x∉C)\leftrightarrow \left( \resaltar{x \in A} \wedge x \notin B \right) \wedge \left( \resaltar{x \in A} \wedge x \notin C \right)

    Since pp is equivalent to p∧pp \wedge p, we repeat the condition x∈Ax \in A and regroup, by the associativity and commutativity of conjunction.

  5. ↔x∈(A∖B)∩(A∖C)\leftrightarrow x \in \left( A \setminus B \right) \resaltar{\cap} \left( A \setminus C \right)

    By the definitions of difference and intersection, this is belonging to the right-hand side. By extensionality, the first law is proved.

  6. x∈A∖(B∩C)↔x∈A∧(x∉B∨x∉C)↔x∈(A∖B)∪(A∖C)x \in A \setminus \left( B \cap C \right) \leftrightarrow x \in A \wedge \left( x \notin B \resaltar{\vee} x \notin C \right) \leftrightarrow x \in \left( A \setminus B \right) \resaltar{\cup} \left( A \setminus C \right)

    The second law is proved with the same chain, interchanging union with intersection and disjunction with conjunction; the logical law involved is then the other De Morgan law.

The power set

The subsets of a set in turn form a set, whose existence was admitted at the beginning. The power set of AA, denoted P(A)\mathcal{P}(A), is the set whose elements are the subsets of AA:

X∈P(A)↔X⊆AX \in \mathcal{P}(A) \leftrightarrow X \subseteq A

For example, the power set of {1,2,3}\{1, 2, 3\} has eight elements: the empty set, three sets with one element, three with two elements, and {1,2,3}\{1, 2, 3\} itself.

P({1,2,3})={∅,{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3}}\mathcal{P}(\{1, 2, 3\}) = \{ \emptyset, \{1\}, \{2\}, \{3\}, \{1, 2\}, \{1, 3\}, \{2, 3\}, \{1, 2, 3\} \}

For every set AA, the empty set and AA itself are elements of P(A)\mathcal{P}(A), and for each aa in AA one has {a}∈P(A)\{a\} \in \mathcal{P}(A), whereas aa is not, in general, an element of P(A)\mathcal{P}(A). The lesson on combinatorics will prove that a set with nn elements has 2n2^n subsets.

Ordered pairs and the Cartesian product

A point of the plane, a fraction or a subtraction yet to be carried out are described by two objects in a definite order: the pair (3,5)(3, 5) is not the pair (5,3)(5, 3). The set {3,5}\{3, 5\} cannot represent it, because it is equal to {5,3}\{5, 3\}. All that is required of an ordered pair is its characteristic property: two pairs are equal if and only if they have the same first component and the same second component. Kuratowski observed in 1921 that the notion of set suffices to construct an object with that property.

Definition (ordered pair). The ordered pair with first component aa and second component bb is the set
(a,b)={{a},{a,b}}(a, b) = \{ \{a\}, \{a, b\} \}
TheoremCharacteristic property of the ordered pair

For all aa, bb, cc and dd, the pairs (a,b)(a, b) and (c,d)(c, d) are equal if and only if a=ca = c and b=db = d.

(a,b)=(c,d)↔a=c∧b=d(a, b) = (c, d) \leftrightarrow a = c \wedge b = d

If the components are equal, the pairs are the same set. For the converse, one distinguishes whether aa and bb are equal or distinct, and counts how many elements each set involved has. The figure draws each pair as a set of two sets.

Proof

  1. {{a},{a,b}}={{c},{c,d}}\dato{ig}{\{ \{a\}, \{a, b\} \} = \{ \{c\}, \{c, d\} \}}

    Suppose that the pairs are equal. By extensionality, they have the same elements.

  2. {c}={a},{c,d}={a}→c=a,d=a=b\{c\} = \{a\}, \quad \{c, d\} = \{a\} \rightarrow c = a, \quad d = a = b

    First case, a=ba = b. Then {a,b}={a}\{a, b\} = \{a\} and the left-hand side has a single element, {a}\{a\}; the two elements of the right-hand side are therefore equal to it.

  3. {c}={a}→c=a\{c\} = \{a\} \rightarrow \dato{ca}{c = a}

    Second case, a≠ba \neq b. The set {c}\{c\} belongs to the left-hand side, so it is {a}\{a\} or {a,b}\{a, b\}; it cannot be {a,b}\{a, b\}, which has two elements, and therefore it is {a}\{a\}.

  4. {c,d}={a,b}\{c, d\} = \{a, b\}

    Also {c,d}\{c, d\} belongs to the left-hand side. If it were {a}\{a\}, we would have d=a=cd = a = c, and the right-hand side would have a single element, {a}\{a\}, whereas the left-hand side has two: this is impossible. Therefore {c,d}\{c, d\} is {a,b}\{a, b\}.

  5. {a,d}={a,b}→b=d\{a, \resaltar{d}\} = \{a, \resaltar{b}\} \rightarrow b = d

    Since c=ac = a, the element bb of {a,b}={a,d}\{a, b\} = \{a, d\} is aa or dd; it is not aa, because a≠ba \neq b, and therefore it is dd.

  6. (a,b)=(c,d)→a=c∧b=d(a, b) = (c, d) \rightarrow a = c \wedge b = d

    In both cases, the components coincide.

Once the characteristic property is proved, Kuratowski’s construction can be forgotten: everything the course says about pairs follows from it.

Definition (Cartesian product). The Cartesian product of AA and BB is the set of the pairs whose first component belongs to AA and whose second component belongs to BB:
A×B={(a,b):a∈A∧b∈B}A \times B = \{ (a, b) : a \in A \wedge b \in B \}

The expression {(a,b):a∈A∧b∈B}\{ (a, b) : a \in A \wedge b \in B \} is not by itself one of the admitted rules, which only allow one to separate elements of a set already formed. However, that set exists: if a∈Aa \in A and b∈Bb \in B, the sets {a}\{a\} and {a,b}\{a, b\} are contained in A∪BA \cup B, and are therefore elements of P(A∪B)\mathcal{P}(A \cup B); it follows that the pair (a,b)={{a},{a,b}}(a, b) = \{ \{a\}, \{a, b\} \} is contained in P(A∪B)\mathcal{P}(A \cup B), that is, it is an element of P(P(A∪B))\mathcal{P}(\mathcal{P}(A \cup B)). Therefore the Cartesian product is formed by separation inside that set, which exists by the admitted rules: A∪BA \cup B is the union of the elements of {A,B}\{A, B\}, and the power set is taken twice.

A×B={z∈P(P(A∪B)):(∃a∈A)(∃b∈B) (z=(a,b))}A \times B = \{ z \in \mathcal{P}(\mathcal{P}(A \cup B)) : (\exists a \in A)(\exists b \in B)\,(z = (a, b)) \}

The name recalls Descartes: the plane of analytic geometry is R×R\mathbb{R} \times \mathbb{R}. The product is not commutative: {1}×{2}\{1\} \times \{2\} contains only (1,2)(1, 2), and {2}×{1}\{2\} \times \{1\} only (2,1)(2, 1), which is different by the characteristic property.

ExampleA Cartesian product as a grid

Write the product A×BA \times B for A={1,2,3}A = \{1, 2, 3\} and B={1,2}B = \{1, 2\}, and compare its number of elements with those of the factors.

Proof

  1. A={1,2,3},B={1,2}A = \{1, 2, 3\}, \quad B = \{1, 2\}

    We arrange the elements of AA on a horizontal axis and those of BB on a vertical one: each pair is a point of the grid.

  2. (1,1), (2,1), (3,1)(1, 1), \ (2, 1), \ (3, 1)

    The pairs with second component 11 form the first row.

  3. (1,2), (2,2), (3,2)(1, 2), \ (2, 2), \ (3, 2)

    The pairs with second component 22 form the second row.

  4. A×B={(1,1),(2,1),(3,1),(1,2),(2,2),(3,2)}A \times B = \{ (1, 1), (2, 1), (3, 1), (1, 2), (2, 2), (3, 2) \}

    The product has 3⋅2=63 \cdot 2 = 6 elements: as many rows as elements of BB, each with as many pairs as elements of AA. The multiplication principle of combinatorics generalizes this count.

Relations

To say that 22 divides 66, that 33 is less than 55, or that two days fall on the same day of the week is to assert that certain pairs of objects are related. If this is so, a relation is determined by the pairs it relates, and it can be defined as a set of pairs.

Definition (relation). A relation from AA to BB is a subset RR of the product A×BA \times B; a relation on AA is a relation from AA to AA. If (a,b)∈R(a, b) \in R, one says that aa is related to bb by RR.

For example, the relation “less than or equal to” on {1,2,3}\{1, 2, 3\} is the set of pairs {(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)}\{(1, 1), (1, 2), (1, 3), (2, 2), (2, 3), (3, 3)\}. For frequently used relations one writes a symbol between the terms, as a≤ba \leq b or a∣ba \mid b, instead of (a,b)∈R(a, b) \in R. Four properties of a relation on a set recur throughout the course.

Definition (properties of relations). A relation RR on AA is reflexive, symmetric, antisymmetric or transitive when it satisfies, respectively, the following conditions.
  • It is reflexive if every element is related to itself: (∀a∈A) ((a,a)∈R)(\forall a \in A)\,((a, a) \in R);
  • It is symmetric if the relation of aa to bb implies that of bb to aa: (∀a,b∈A) ((a,b)∈R→(b,a)∈R)(\forall a, b \in A)\,((a, b) \in R \rightarrow (b, a) \in R);
  • It is antisymmetric if two elements related in both directions are equal: (∀a,b∈A) ((a,b)∈R∧(b,a)∈R→a=b)(\forall a, b \in A)\,((a, b) \in R \wedge (b, a) \in R \rightarrow a = b);
  • It is transitive if the relation of aa to bb and that of bb to cc imply that of aa to cc: (∀a,b,c∈A) ((a,b)∈R∧(b,c)∈R→(a,c)∈R)(\forall a, b, c \in A)\,((a, b) \in R \wedge (b, c) \in R \rightarrow (a, c) \in R).

On the grid of A×AA \times A, a relation is a set of points. It is reflexive when it contains the whole diagonal, that of the pairs (a,a)(a, a); it is symmetric when its drawing is symmetric with respect to the diagonal; and it is antisymmetric when no point off the diagonal has its mirror image in the relation. Antisymmetric does not mean “not symmetric”: equality is both, and proposed problem 1 asks for a relation that is neither.

ExampleDivisibility and parity on the set from 1 to 6

On A={1,2,3,4,5,6}A = \{1, 2, 3, 4, 5, 6\} consider divisibility, a∣ba \mid b, and the relation “having the same parity”. Draw both on the grid of A×AA \times A and decide which of the four properties each one satisfies.

Proof

  1. {(a,b)∈A×A:a∣b}\dato{div}{\{ (a, b) \in A \times A : a \mid b \}}

    Divisibility relates each number to its multiples within AA: 11 to all of them, 22 to 22, 44 and 66, 33 to 33 and 66, and each of the others to itself. There are 1414 pairs.

  2. a=1⋅a→a∣aa = 1 \cdot a \rightarrow \resaltar{a \mid a}

    It is reflexive, because every number divides itself: the diagonal is complete.

  3. 2∣4,¬(4∣2)2 \mid 4, \quad \neg (4 \mid 2)

    It is not symmetric: one counterexample suffices. On the other hand, it is antisymmetric, because if a∣ba \mid b and b∣ab \mid a, each is less than or equal to the other.

  4. a∣b∧b∣c→a∣ca \mid b \wedge b \mid c \rightarrow \resaltar{a \mid c}

    It is transitive: if b=kab = ka and c=lbc = lb, then c=(lk)ac = (lk)a. For example, from 1∣21 \mid 2 and 2∣62 \mid 6 follows 1∣61 \mid 6.

  5. (1,3)∈R∧(3,1)∈R,1≠3(1, 3) \in R \wedge (3, 1) \in R, \quad 1 \neq 3

    Same parity relates the odd numbers to one another and the even numbers to one another: there are 9+9=189 + 9 = 18 pairs, which form two blocks symmetric with respect to the diagonal. It is reflexive, symmetric and transitive, but not antisymmetric, because it relates 11 and 33, which are distinct.

Equivalence relations

The relation “having the same parity” behaves like a partial equality: it identifies the numbers that agree in one respect, their parity, and forgets the rest. The three properties that make it behave in this way receive a name.

Definition (equivalence relation). A relation on AA is an equivalence relation when it is reflexive, symmetric and transitive. One then writes a∼ba \sim b, and says that aa is equivalent to bb. The class of aa is the set of the elements equivalent to aa, and each of them is a representative of the class:
C(a)={x∈A:x∼a}C(a) = \{ x \in A : x \sim a \}

The set of all the classes is called the quotient set and is denoted A/∼A/{\sim}.

Equivalence relations include equality, whose classes have a single element; same parity, with two classes; having the same remainder on division by 33, with three; and falling on the same day of the week, with seven, which is solved problem 3. In general, if gg is a function defined on AA, the relation g(x)=g(y)g(x) = g(y) inherits the three properties from equality, and solved problem 5 shows that every equivalence is of this form.

LemmaEquivalence classes

Let ∼\sim be an equivalence relation on AA. For all aa and bb in AA: each element belongs to its class; two elements are equivalent if and only if their classes are equal; and two classes with some element in common are equal. Each assertion is obtained from one of the three properties of the equivalence, applied to an arbitrary element of a class.

Proof

  1. a∼a→a∈C(a)a \sim a \rightarrow \resaltar{a \in C(a)}

    By reflexivity, a∼aa \sim a; by the definition of class, aa belongs to C(a)C(a), and no class is empty.

  2. x∼a∧a∼b→x∼bx \sim a \wedge a \sim b \rightarrow \resaltar{x \sim b}

    Suppose a∼ba \sim b and let xx be in C(a)C(a). By transitivity, from x∼ax \sim a and a∼ba \sim b follows x∼bx \sim b; therefore C(a)⊆C(b)C(a) \subseteq C(b).

  3. a∼b→C(a)=C(b)a \sim b \rightarrow \dato{eq}{C(a) = C(b)}

    By symmetry, also b∼ab \sim a, and the same argument gives C(b)⊆C(a)C(b) \subseteq C(a). By double inclusion, the classes are equal.

  4. a∈C(a)=C(b)→a∼ba \in C(a) = C(b) \rightarrow a \sim b

    Conversely, if C(a)=C(b)C(a) = C(b), the element aa, which belongs to C(a)C(a), belongs to C(b)C(b), that is, a∼ba \sim b.

  5. x∈C(a)∩C(b)→C(a)=C(b)x \in C(a) \cap C(b) \rightarrow C(a) = C(b)

    If xx belongs to C(a)C(a) and to C(b)C(b), by symmetry and transitivity a∼xa \sim x and x∼bx \sim b give a∼ba \sim b, and by what precedes the classes are equal.

The classes therefore divide the set into blocks that do not overlap. This way of dividing a set deserves a definition of its own.

Definition (partition). A partition of a set AA is a set of subsets of AA, called blocks, that are nonempty, pairwise disjoint and whose union is AA; equivalently, each element of AA belongs to exactly one block.
TheoremEquivalences and partitions

The classes of an equivalence relation on AA form a partition of AA. Conversely, if Π\Pi is a partition of AA, the relation “belonging to the same block” is an equivalence relation whose classes are exactly the blocks of Π\Pi. The first part is the preceding lemma; the second verifies the three properties using the condition that each element is in a single block. The figure follows the relation “having the same remainder on division by 33” on the set from 11 to 99.

Proof

  1. (∀a∈A) (a∈C(a))(\forall a \in A)\,(a \in \resaltar{C(a)})

    By the lemma, no class is empty and each element belongs to its class, so the union of the classes is AA.

  2. C(a)≠C(b)→C(a)∩C(b)=∅C(a) \neq C(b) \rightarrow C(a) \cap C(b) = \resaltar{\emptyset}

    By the lemma, two distinct classes have no elements in common. Therefore the classes form a partition.

  3. a∼b↔(∃X∈Π)(a∈X∧b∈X)a \sim b \leftrightarrow (\exists X \in \Pi)(a \in X \wedge b \in X)

    Conversely, let Π\Pi be a partition and let us write a∼ba \sim b when aa and bb are in the same block. Each element is in some block, and is therefore in the same block as itself: the relation is reflexive. Symmetry is immediate, because the condition does not depend on the order in which aa and bb are named.

  4. b∈X∩Y→X=Y→a∼cb \in X \cap Y \rightarrow X = Y \rightarrow a \sim c

    Transitivity: if aa and bb are in the block XX, and bb and cc in the block YY, then bb is in XX and in YY; since each element is in a single block, X=YX = Y, and aa and cc are in the same block.

  5. a∈X→C(a)=Xa \in X \rightarrow C(a) = \resaltar{X}

    Finally, if aa is in the block XX, the class of aa consists of the elements that share a block with aa, which are those of XX: the classes are the blocks.

Giving an equivalence on AA and giving a partition of AA are therefore two ways of saying the same thing; solved problem 4 takes advantage of this to count equivalences. The quotient set is the partition seen as a new set: on passing from AA to A/∼A/{\sim}, equivalent elements merge into a single one.

ExampleThe relation that will construct the integers

On the set N×N\mathbb{N} \times \mathbb{N} of pairs of natural numbers one defines (a,b)∼(c,d)(a, b) \sim (c, d) when a+d=b+ca + d = b + c. It is an equivalence relation, as is proved in the lesson on the integers. Compute some representatives of the classes of (5,2)(5, 2), (1,1)(1, 1) and (2,5)(2, 5), and describe the classes on the grid of pairs.

Proof

  1. (a,b)∼(c,d)↔a+d=b+c(a, b) \sim (c, d) \leftrightarrow \resaltar{a + d = b + c}

    The pair (a,b)(a, b) represents the subtraction yet to be carried out a−ba - b, which may not exist among the natural numbers; the condition a+d=b+ca + d = b + c says that two pairs represent the same subtraction without writing any subtraction.

  2. C(5,2)={(4,1),(5,2),(6,3),(7,4),…}C(5, 2) = \{ (4, 1), (5, 2), (6, 3), (7, 4), \ldots \}

    The class of (5,2)(5, 2) contains the pairs that describe the difference 33. For example, (4,1)(4, 1), because 5+1=2+45 + 1 = 2 + 4.

  3. C(1,1)={(1,1),(2,2),(3,3),…}C(1, 1) = \{ (1, 1), (2, 2), (3, 3), \ldots \}

    The class of (1,1)(1, 1) is that of the pairs with equal components, because 1+b=1+a1 + b = 1 + a requires a=ba = b: it is the diagonal of the grid.

  4. C(2,5)={(1,4),(2,5),(3,6),…}C(2, 5) = \{ (1, 4), (2, 5), (3, 6), \ldots \}

    The class of (2,5)(2, 5) describes a difference that does not yet exist, the one that will be −3-3.

  5. Z=(N×N)/∼\mathbb{Z} = \left( \mathbb{N} \times \mathbb{N} \right) / {\sim}

    Each class is the set of the pairs on a line parallel to the diagonal, and by the theorem those lines form a partition of the grid. An integer will be, by definition, one of these classes: Z\mathbb{Z} is the quotient set.

In the same way, in the lesson on the rational numbers two fractions (p,q)(p, q) and (r,s)(r, s) are equivalent when ps=qrps = qr, and a rational number is a class; and in the lesson on congruences, the residues modulo nn are the classes of an equivalence between integers.

Order relations

The divisibility of the previous example is not symmetric but antisymmetric: instead of identifying elements, it orders them. Relations of this kind receive a name of their own.

Definition (order). A relation on AA is an order relation, or partial order, when it is reflexive, antisymmetric and transitive; one then writes a⪯ba \preceq b, and says that aa precedes bb. The order is total when any two elements are comparable, that is, when for all aa and bb one has a⪯ba \preceq b or b⪯ab \preceq a.

Examples of orders are the relation ≤\leq between natural numbers, which is total by the trichotomy proved in the lesson on the operations on natural numbers; inclusion, by the theorem on its properties, which is not total, because {1}\{1\} and {2}\{2\} are not comparable; and divisibility between natural numbers, whose antisymmetry is proved in the lesson on divisibility, which is not total, because neither 2∣32 \mid 3 nor 3∣23 \mid 2. A finite order is drawn with a Hasse diagram: one point per element, with bb higher than aa when aa precedes bb, and a segment when there is no other element between them; transitivity allows the other segments to be omitted.

Definition (bounds and extreme elements). Let ⪯\preceq be an order on AA and XX a subset of AA. The bounds and the extreme elements of XX are defined as follows.
  • An element cc of AA is a lower bound of XX if it precedes all the elements of XX, and an upper bound if all the elements of XX precede it.
  • A least element of XX is a lower bound of XX that belongs to XX, and a greatest element is an upper bound that belongs to XX.
  • An element mm of XX is minimal if no element of XX other than itself precedes it, and maximal if it precedes no element of XX other than itself.
  • The infimum of XX is the greatest element of the set of its lower bounds, and the supremum is the least element of the set of its upper bounds, when they exist.
PropositionThe least element is unique and is the only minimal element

If a subset XX of an ordered set has a least element, that least element is unique, and it is the only minimal element of XX. If the order is total, every minimal element of XX is its least element. The same holds for the greatest element and the maximal elements. Uniqueness rests on antisymmetry, and the last assertion, on comparability.

Proof

  1. m⪯n∧n⪯m→m=nm \preceq n \wedge n \preceq m \rightarrow \resaltar{m = n}

    If mm and nn are least elements of XX, each belongs to XX and precedes all its elements; in particular, each precedes the other, and by antisymmetry they are equal.

  2. x⪯m∧m⪯x→x=mx \preceq m \wedge m \preceq x \rightarrow x = m

    The least element mm is minimal: if xx in XX precedes mm, since also m⪯xm \preceq x, antisymmetry gives x=mx = m.

  3. m⪯n→m=nm \preceq n \rightarrow m = n

    If nn is minimal, since mm precedes nn and belongs to XX, the definition of minimal forces m=nm = n: there are no other minimal elements.

  4. (∀x∈X) (m⪯x)(\forall x \in X)\,(\resaltar{m \preceq x})

    If the order is total and mm is minimal, for each xx in XX one has m⪯xm \preceq x or x⪯mx \preceq m; in the second case, since it is minimal, x=mx = m. In both cases m⪯xm \preceq x, and mm is the least element.

ExampleThe divisors of 12 ordered by divisibility

On the set A={1,2,3,4,6,12}A = \{1, 2, 3, 4, 6, 12\} of the divisors of 1212, ordered by divisibility, consider the subset X={2,3,4,6}X = \{2, 3, 4, 6\}. Draw the Hasse diagram and determine the minimal and maximal elements, the least and greatest elements, the bounds, the infimum and the supremum of XX.

Proof

  1. 1∣2∣4∣12,1∣3∣6∣121 \mid 2 \mid 4 \mid 12, \qquad 1 \mid 3 \mid 6 \mid 12

    In the diagram, 11 is at the bottom, because it divides all of them; above it, 22 and 33; above them, 44 and 66; at the top, 1212. One joins 11 with 22 and with 33; 22 with 44 and with 66; 33 with 66; and 44 and 66 with 1212.

  2. ¬(2∣3),¬(3∣2)\neg (2 \mid 3), \quad \neg (3 \mid 2)

    The minimal elements of XX are 22 and 33: no other element of XX divides them. Since there are two, by the proposition XX has no least element; the order is not total, because 22 and 33 are not comparable.

  3. ¬(4∣6),¬(6∣4)\neg (4 \mid 6), \quad \neg (6 \mid 4)

    The maximal elements are 44 and 66, which divide no other element of XX; there is no greatest element either.

  4. (∀x∈X) (1∣x∧x∣12)(\forall x \in X)\,(\resaltar{1} \mid x \wedge x \mid \resaltar{12})

    The only lower bound of XX in AA is 11, which is therefore the infimum; the only upper bound is 1212, which is the supremum. Neither of them belongs to XX.

The infimum and the supremum can therefore exist without the least and greatest elements existing. This difference distinguishes the real numbers: in the lesson on number systems it is admitted, as the axiom of completeness, that every nonempty set of real numbers bounded above has a supremum, which the rational numbers do not satisfy. The natural numbers, on the other hand, satisfy the well-ordering principle, proved in the lesson on summations and induction: every nonempty set of natural numbers has a least element.

Functions

Functions as relations

A function assigns to each element of one set exactly one element of another. If this is so, a function is determined by the pairs formed by each element and the one assigned to it, and it can be defined as a relation with a special property.

Definition (function). A function ff from AA to BB is a relation from AA to BB that relates each element of AA to exactly one element of BB:
(∀a∈A)(∃!b∈B) ((a,b)∈f)(\forall a \in A)(\exists! b \in B)\,((a, b) \in f)

That unique element is called the image of aa and is written f(a)f(a); one writes f:A→Bf : A \to B, and says that AA is the domain of ff and BB its codomain.

Two functions are equal when they have the same domain, the same codomain and the same image at each element. The identity of AA, denoted IAI_A, leaves each element where it is: it is the diagonal of A×AA \times A, and IA(x)=xI_A(x) = x for every xx in AA.

Definition (image and preimage). Let f:A→Bf : A \to B. The image of a subset XX of AA is the set of the images of its elements, and the preimage of a subset YY of BB is the set of the elements of AA whose image is in YY:
f(X)={f(x):x∈X},f−1(Y)={x∈A:f(x)∈Y}f(X) = \{ f(x) : x \in X \}, \qquad f^{-1}(Y) = \{ x \in A : f(x) \in Y \}

The image of the whole domain, f(A)f(A), is called the range of ff and is denoted ran⁡(f)\operatorname{ran}(f).

The notation for the preimage does not presuppose that ff has an inverse: the preimage exists for any function.

ExampleThe number-of-divisors function

Let f:{1,2,3,4,5,6}→{1,2,3,4}f : \{1, 2, 3, 4, 5, 6\} \to \{1, 2, 3, 4\} be the function that assigns to each number the number of its divisors. Compute its values, its range and the preimage of {2}\{2\}, and compare f(X∩Y)f(X \cap Y) with f(X)∩f(Y)f(X) \cap f(Y) for X={2,4}X = \{2, 4\} and Y={3,4}Y = \{3, 4\}.

Proof

  1. f(1)=1, f(2)=f(3)=f(5)=2, f(4)=3, f(6)=4f(1) = 1, \ f(2) = f(3) = f(5) = 2, \ f(4) = 3, \ f(6) = 4

    11 has one divisor; 22, 33 and 55, two; 44 has three, 11, 22 and 44; and 66 has four, 11, 22, 33 and 66.

  2. ran⁡(f)={1,2,3,4}\operatorname{ran}(f) = \{1, 2, 3, 4\}

    Each element of the codomain is the image of some element: the range is the whole codomain.

  3. f−1({2})={2,3,5}f^{-1}(\{2\}) = \{2, 3, 5\}

    The numbers with exactly two divisors are the primes of the domain.

  4. f(X∩Y)=f({4})={3}f(X \resaltar{\cap} Y) = f(\{4\}) = \{3\}

    The intersection of XX and YY is {4}\{4\}, whose image is {3}\{3\}.

  5. f(X)∩f(Y)={2,3}≠{3}f(X) \resaltar{\cap} f(Y) = \{2, 3\} \neq \{3\}

    On the other hand, f(X)=f(Y)={2,3}f(X) = f(Y) = \{2, 3\}, because 22 and 33 have the same image. In general only the inclusion f(X∩Y)⊆f(X)∩f(Y)f(X \cap Y) \subseteq f(X) \cap f(Y) holds, because an xx in X∩YX \cap Y serves as a witness for both images; equality fails when the witnesses are different, as here 22 and 33.

Composition

If f:A→Bf : A \to B and g:B→Cg : B \to C, each xx in AA has an image f(x)f(x) in BB, which in turn has an image in CC. The composition of gg with ff is the function g∘f:A→Cg \circ f : A \to C that applies first ff and then gg:

(g∘f)(x)=g(f(x))\left( g \circ f \right)(x) = g(f(x))

It is a function, because to each xx there corresponds a single f(x)f(x), and to this a single g(f(x))g(f(x)). The order of writing is the reverse of the order of application: in g∘fg \circ f the function on the right acts first. Composition is not commutative: if f(n)=2nf(n) = 2n and g(n)=n+1g(n) = n + 1 on the natural numbers, then (g∘f)(n)=2n+1(g \circ f)(n) = 2n + 1, which is odd, and (f∘g)(n)=2n+2(f \circ g)(n) = 2n + 2, which is even. The identity is neutral on both sides, because f(IA(x))=f(x)f(I_A(x)) = f(x) and IB(f(x))=f(x)I_B(f(x)) = f(x):

f∘IA=f,IB∘f=ff \circ I_A = f, \qquad I_B \circ f = f
TheoremAssociativity of composition

If f:A→Bf : A \to B, g:B→Cg : B \to C and h:C→Dh : C \to D, the functions h∘(g∘f)h \circ (g \circ f) and (h∘g)∘f(h \circ g) \circ f are equal. Both go from AA to DD; it suffices to check that they take the same value at each element, unfolding the definition of composition twice. The figure represents the functions as arrows between four columns.

Proof

  1. (h∘(g∘f))(x)=h((g∘f)(x))\left( h \circ \left( g \circ f \right) \right)(x) = h\left( \resaltar{\left( g \circ f \right)(x)} \right)

    Let xx be an arbitrary element of AA. By the definition of composition, applied to hh and to g∘fg \circ f.

  2. =h(g(f(x)))= h\left( \resaltar{g(f(x))} \right)

    Again by the definition, now applied to g∘fg \circ f.

  3. ((h∘g)∘f)(x)=(h∘g)(f(x))\left( \left( h \circ g \right) \circ f \right)(x) = \left( h \circ g \right)\left( \resaltar{f(x)} \right)

    On the other side, by the definition applied to h∘gh \circ g and to ff.

  4. =h(g(f(x)))= \resaltar{h(g(f(x)))}

    And by the definition applied to h∘gh \circ g, at the element f(x)f(x).

  5. h∘(g∘f)=(h∘g)∘fh \circ \left( g \circ f \right) = \left( h \circ g \right) \circ f

    The two functions have the same domain, the same codomain and the same values: they are equal. That is why one writes h∘g∘fh \circ g \circ f without parentheses.

Injective, surjective and bijective functions

Definition. A function f:A→Bf : A \to B is injective when distinct elements have distinct images, or, by contraposition, when equality of the images implies equality of the elements; it is surjective when every element of BB is the image of some element of AA, that is, when ran⁡(f)=B\operatorname{ran}(f) = B; and it is bijective, or a bijection, when it is injective and surjective:
(∀x,y∈A) (f(x)=f(y)→x=y),(∀b∈B)(∃x∈A) (f(x)=b)(\forall x, y \in A)\,(f(x) = f(y) \rightarrow x = y), \qquad (\forall b \in B)(\exists x \in A)\,(f(x) = b)

The number-of-divisors function of the example is surjective and not injective. The function n↦2nn \mapsto 2n from the natural numbers to the natural numbers is injective and not surjective, because 11 is not twice any natural number. The successor of the next lesson is, by the fourth Peano axiom, an injective function from N\mathbb{N} to N\mathbb{N}, and by the third it is not surjective, because 11 is not the image of any natural number. Surjectivity depends on the declared codomain. A bijection pairs the elements of two sets without repeating or omitting any; that is why the lesson on combinatorics defines AA to have nn elements when there exists a bijection from {1,2,…,n}\{1, 2, \ldots, n\} to AA.

TheoremComposition preserves injectivity and surjectivity

Let f:A→Bf : A \to B and g:B→Cg : B \to C. If ff and gg are injective, g∘fg \circ f is injective; if ff and gg are surjective, g∘fg \circ f is surjective; and therefore, if both are bijective, g∘fg \circ f is bijective. For injectivity, one runs along the chain backwards, from CC to AA; for surjectivity, too, but looking for preimages. The figure shows the three columns.

Proof

  1. g(f(x))=g(f(y))g(f(x)) = g(f(y))

    Injectivity: let xx and yy in AA have the same image under g∘fg \circ f.

  2. f(x)=f(y)\dato{fa}{f(x) = f(y)}

    Since gg is injective, the elements f(x)f(x) and f(y)f(y), which have the same image under gg, are equal.

  3. f(x)=f(y)→x=y\resaltar{f(x) = f(y)} \rightarrow x = y

    Since ff is injective, x=yx = y. Therefore g∘fg \circ f is injective.

  4. g(b)=c,f(a)=b\dato{b}{g(b) = c}, \quad \dato{a}{f(a) = b}

    Surjectivity: let cc be in CC. Since gg is surjective, there is a bb in BB with g(b)=cg(b) = c; since ff is surjective, there is an aa in AA with f(a)=bf(a) = b.

  5. (g∘f)(a)=g(f(a))=g(b)=c\left( g \circ f \right)(a) = g(\resaltar{f(a)}) = g(\resaltar{b}) = c

    That aa is a preimage of cc under the composition. Therefore g∘fg \circ f is surjective, and if both functions are bijective, so is the composition.

The inverse function

A function g:B→Ag : B \to A undoes f:A→Bf : A \to B when, applied after ff, it returns each element to its starting point, that is, when g∘f=IAg \circ f = I_A; and ff in turn undoes gg when f∘g=IBf \circ g = I_B. A function that satisfies both equalities is called an inverse of ff. The following theorem says which functions have one.

TheoremA function is bijective if and only if it has an inverse, and the inverse is unique

A function f:A→Bf : A \to B is bijective if and only if there exists a function g:B→Ag : B \to A such that g∘f=IAg \circ f = I_A and f∘g=IBf \circ g = I_B. That function gg is unique; it is called the inverse function of ff and is denoted f−1f^{-1}. Moreover, f−1f^{-1} is bijective and its inverse is ff. To construct the inverse, one reverses the pairs of ff; for uniqueness, one uses the associativity of composition. The figure follows a bijection between two sets of four elements.

Proof

  1. g={(b,a):(a,b)∈f},g(b)=a↔f(a)=bg = \{ (b, a) : (a, b) \in f \}, \quad \dato{g}{g(b) = a \leftrightarrow f(a) = b}

    Suppose ff is bijective. For each bb in BB there is an aa with f(a)=bf(a) = b, because ff is surjective, and only one, because ff is injective. The relation obtained by reversing the pairs of ff is therefore a function from BB to AA.

  2. g(f(a))=a,f(g(b))=bg(f(a)) = \resaltar{a}, \qquad f(g(b)) = \resaltar{b}

    By the definition of gg, applying ff and then gg returns each aa, and applying gg and then ff returns each bb.

  3. x=g(f(x))=g(f(y))=yx = g(f(x)) = g(\resaltar{f(y)}) = y

    Conversely, suppose that gg exists. If f(x)=f(y)f(x) = f(y), applying gg yields x=yx = y: the function ff is injective.

  4. f(g(b))=bf(\resaltar{g(b)}) = b

    For each bb in BB, the element g(b)g(b) is a preimage of bb: the function ff is surjective and therefore bijective.

  5. g=g∘IB=g∘(f∘h)=(g∘f)∘h=IA∘h=hg = g \circ I_B = g \circ \resaltar{\left( f \circ h \right)} = \resaltar{\left( g \circ f \right)} \circ h = I_A \circ h = h

    Uniqueness: if gg and hh satisfy both equalities, one inserts the identity and regroups by associativity.

  6. f−1∘f=IA,f∘f−1=IBf^{-1} \circ f = I_A, \qquad f \circ f^{-1} = I_B

    The two equalities of the definition are symmetric in ff and f−1f^{-1}: ff undoes f−1f^{-1} in both directions. By the part already proved, f−1f^{-1} is bijective, and its inverse is ff.

CorollaryHaving a bijection is an equivalence between sets

For all sets AA, BB and CC: there exists a bijection from AA to AA; if there exists a bijection from AA to BB, there exists one from BB to AA; and if there exist bijections from AA to BB and from BB to CC, there exists one from AA to CC. In particular, if AA has nn elements and there exists a bijection from AA to BB, then BB has nn elements. Each assertion is one of the preceding theorems.

Proof

  1. IA∘IA=IAI_A \circ I_A = I_A

    The identity is a bijection, because it is its own inverse.

  2. f:A→B→f−1:B→Af : A \to B \rightarrow f^{-1} : B \to A

    The inverse of a bijection is a bijection, by the inverse function theorem.

  3. f:A→B, g:B→C→g∘f:A→Cf : A \to B, \ g : B \to C \rightarrow g \circ f : A \to C

    The composition of two bijections is a bijection, by the preceding theorem.

  4. f∘h:{1,…,n}→Bf \circ h : \{1, \ldots, n\} \to B

    If hh is a bijection from {1,…,n}\{1, \ldots, n\} to AA and ff one from AA to BB, the composition is a bijection from {1,…,n}\{1, \ldots, n\} to BB.

It is not called an equivalence relation because there is no set of all sets on which to define it. The lesson on function operations will apply these results to real functions, and there the graph of the inverse will be the mirror image of the graph of the function with respect to the diagonal, a geometric picture of reversing the pairs.

Solved problems

The problems advance from two exercises on functions to three applications of equivalences. The second uses the multiplication of natural numbers and its cancellation law, which is proved in the lesson on the operations on natural numbers; the third, division with remainder, which is proved in the lesson on divisibility. None of those results depends on this lesson.

Solved problem 1What a composition reveals about its factors

Let f:A→Bf : A \to B and g:B→Cg : B \to C. Prove that if g∘fg \circ f is injective, then ff is injective, and that if g∘fg \circ f is surjective, then gg is surjective. Show with an example that g∘fg \circ f can be bijective without gg being injective or ff surjective.

Solution

  1. f(x)=f(y)→g(f(x))=g(f(y))f(x) = f(y) \rightarrow \resaltar{g(f(x)) = g(f(y))}

    Let xx and yy in AA satisfy f(x)=f(y)f(x) = f(y). Since gg is a function, it assigns equal images to equal elements.

  2. (g∘f)(x)=(g∘f)(y)→x=y\left( g \circ f \right)(x) = \left( g \circ f \right)(y) \rightarrow x = y

    That equality is the equality of the images under g∘fg \circ f, which is injective: therefore x=yx = y, and ff is injective.

  3. c=g(f(a))=g(b)c = g(\resaltar{f(a)}) = g(b)

    Let cc be in CC. Since g∘fg \circ f is surjective, there is an aa with g(f(a))=cg(f(a)) = c; the element b=f(a)b = f(a) of BB is a preimage of cc under gg.

  4. (g∘f)(1)=g(1)=1\left( g \circ f \right)(1) = g(1) = 1

    For the example, let A=C={1}A = C = \{1\} and B={1,2}B = \{1, 2\}, with f(1)=1f(1) = 1 and g(1)=g(2)=1g(1) = g(2) = 1. The composition is the identity of {1}\{1\}, which is bijective.

  5. g(1)=g(2),2∉ran⁡(f)g(1) = g(2), \quad 2 \notin \operatorname{ran}(f)

    However, gg is not injective, because g(1)=g(2)g(1) = g(2), and ff is not surjective, because 22 is not the image of anything. What the composition transmits is the injectivity of the first factor and the surjectivity of the second, and nothing more.

Solved problem 2As many even numbers as natural numbers

Let P={m∈N:(∃k∈N)(m=2k)}P = \{ m \in \mathbb{N} : (\exists k \in \mathbb{N})(m = 2k) \} be the set of even numbers. Construct a bijection from N\mathbb{N} to PP, with its inverse, and observe that PP is a proper subset of N\mathbb{N}.

Solution

  1. f(n)=2n∈P\dato{f}{f(n) = 2n} \in P

    We propose doubling: f(n)=2nf(n) = 2n. It is a function from N\mathbb{N} to PP, because 2n2n is even, with witness k=nk = n.

  2. 2n=2m→n=m2n = 2m \rightarrow \resaltar{n = m}

    Injectivity: if 2n=2m2n = 2m, by the cancellation law for the multiplication of natural numbers, n=mn = m.

  3. m=2k=f(k)m = 2k = f(\resaltar{k})

    Surjectivity: every mm in PP is of the form 2k2k with kk a natural number, and is therefore the image of kk.

  4. f−1(m)=m2,f−1(f(n))=2n2=nf^{-1}(m) = \frac{m}{2}, \qquad f^{-1}(f(n)) = \frac{2n}{2} = n

    By the inverse function theorem, ff has an inverse: the one that assigns to each even number its half, which is the natural number kk of the previous step, unique by cancellation.

  5. 1∉P,P⊆N,P≠N1 \notin P, \qquad P \subseteq \mathbb{N}, \quad P \neq \mathbb{N}

    However, PP is a proper subset of N\mathbb{N}: 11 is not even, because 2k=k+k≥1+1=22k = k + k \geq 1 + 1 = 2 for every natural number kk.

The result contradicts the intuition that the part is smaller than the whole, which Galileo had already noticed in 1638 when he paired the natural numbers with their squares. That no finite set is in bijection with a proper subset of itself is a form of the pigeonhole principle, which the lesson on combinatorics admits without proof together with the uniqueness of the number of elements; once that principle is accepted, N\mathbb{N} is not finite. Dedekind took precisely this property as the definition of an infinite set, and the lesson on the Peano axioms shows that N\mathbb{N} has it.

Solved problem 3The day of the week

January 1, 2026 was a Thursday. We number the days of the year 2026 from 11 to 365365 and say that two days are equivalent when their numbers leave the same remainder on division by 77. Prove that this is an equivalence relation, describe its classes, and determine which day of the week October 5, 2026 is and which day October 5, 2027 will be.

Solution

  1. n∼m↔g(n)=g(m)n \sim m \leftrightarrow \resaltar{g(n) = g(m)}

    Let g(n)g(n) be the remainder of dividing nn by 77, unique by the division with remainder theorem. The relation is g(n)=g(m)g(n) = g(m), and it inherits its three properties from equality: g(n)=g(n)g(n) = g(n); if g(n)=g(m)g(n) = g(m), then g(m)=g(n)g(m) = g(n); and if g(n)=g(m)g(n) = g(m) and g(m)=g(p)g(m) = g(p), then g(n)=g(p)g(n) = g(p).

  2. C(1)={1,8,15,…,365},…,C(7)={7,14,…,364}C(1) = \{1, 8, 15, \ldots, 365\}, \quad \ldots, \quad C(7) = \{7, 14, \ldots, 364\}

    The possible remainders are 0,1,…,60, 1, \ldots, 6, and each one is attained, so there are seven classes, the columns of a calendar with seven columns. Since the week repeats every seven days, two equivalent days fall on the same day of the week.

  3. 31+28+31+30+31+30+31+31+30+5=27831 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 5 = \dato{n}{278}

    October 5 is day 278278 of the year, because the nine preceding months add up to 273273 days.

  4. 278=7⋅39+5→278∼5278 = 7 \cdot 39 + \resaltar{5} \rightarrow 278 \sim 5

    We divide by 77: the remainder is 55, so October 5 is in the class of day 55, January 5.

  5. C(278)=C(5)C(278) = C(5)

    Day 11 was a Thursday, and therefore day 55, four days later, was a Monday: October 5, 2026 is a Monday.

  6. 365=7⋅52+1365 = 7 \cdot 52 + \resaltar{1}

    The year 2026 has 365365 days, and 365=7⋅52+1365 = 7 \cdot 52 + 1: the same date of the following year falls 365365 days later, that is, one day of the week later. October 5, 2027 will be a Tuesday.

Solved problem 4The equivalence relations on a set of four elements

How many equivalence relations are there on the set {1,2,3,4}\{1, 2, 3, 4\}?

Solution

  1. a∼b↔(∃X∈Π)(a∈X∧b∈X)a \sim b \leftrightarrow (\exists X \in \Pi)(a \in X \wedge b \in X)

    By the theorem on equivalences and partitions, each equivalence determines its partition into classes, and each partition Π\Pi determines the equivalence “being in the same block”, whose classes are the blocks; the two correspondences undo each other. It therefore suffices to count the partitions, which we classify by the sizes of their blocks.

  2. {1,2,3,4}\{1, 2, 3, 4\}

    A single block of four elements: one partition, the one with a single class.

  3. {2,3,4},{1};{1,3,4},{2};{1,2,4},{3};{1,2,3},{4}\{2, 3, 4\}, \{1\}; \quad \{1, 3, 4\}, \{2\}; \quad \{1, 2, 4\}, \{3\}; \quad \{1, 2, 3\}, \{4\}

    A block of three and one of one: as many as there are ways of choosing the solitary element, four.

  4. {1,2},{3,4};{1,3},{2,4};{1,4},{2,3}\{1, 2\}, \{3, 4\}; \quad \{1, 3\}, \{2, 4\}; \quad \{1, 4\}, \{2, 3\}

    Two blocks of two: the partition is determined by the partner of 11, which can be 22, 33 or 44; there are three.

  5. {1,2},{1,3},{1,4},{2,3},{2,4},{3,4}\{1, 2\}, \{1, 3\}, \{1, 4\}, \{2, 3\}, \{2, 4\}, \{3, 4\}

    A block of two and two of one: the partition is determined by the pair that forms the block of two, and there are six pairs.

  6. 1+4+3+6+1=151 + 4 + 3 + 6 + 1 = 15

    Four blocks of one: one partition, that of equality. Adding the five types gives the number of equivalences.

The numbers of partitions of a set of 11, 22, 33, 44, 55 elements are 11, 22, 55, 1515, 5252; they are called Bell numbers, and proposed problem 2 obtains the fifth.

Solved problem 5Every function is a classification

Let f:A→Bf : A \to B be a function. Prove that the relation x∼yx \sim y, defined by f(x)=f(y)f(x) = f(y), is an equivalence, and that ff is the composition of three functions: the surjection gg that sends each element to its class, a bijection hh from the quotient set onto the range of ff, and the injection JJ that sends each element of the range to itself inside BB. Apply this to the number-of-divisors function of the example.

Solution

  1. C(x)=f−1({f(x)})C(x) = f^{-1}(\{ f(x) \})

    The relation f(x)=f(y)f(x) = f(y) is an equivalence, by the same argument as in solved problem 3. Its classes are the preimages of the elements of the range: the class of xx gathers the elements with the same image as it. In the example, they are {1}\{1\}, {2,3,5}\{2, 3, 5\}, {4}\{4\} and {6}\{6\}.

  2. g:A→A/∼,g(x)=C(x)g : A \to A/{\sim}, \quad g(x) = C(x)

    The function g(x)=C(x)g(x) = C(x) goes from AA to A/∼A/{\sim} and is surjective, because every class is the class of one of its elements.

  3. C(x)=C(y)→f(x)=f(y)C(x) = C(y) \rightarrow \resaltar{f(x) = f(y)}

    We define h(C(x))=f(x)h(C(x)) = f(x). Since a class has many representatives, one must check that the value does not depend on the one chosen: if C(x)=C(y)C(x) = C(y), then x∼yx \sim y, that is, f(x)=f(y)f(x) = f(y).

  4. h(C(x))=h(C(y))→C(x)=C(y)h(C(x)) = h(C(y)) \rightarrow C(x) = C(y)

    The function hh is injective, because the preceding implication can be reversed: if f(x)=f(y)f(x) = f(y), then x∼yx \sim y and C(x)=C(y)C(x) = C(y). It is surjective onto the range, because each f(x)f(x) is h(C(x))h(C(x)).

  5. (J∘h∘g)(x)=J(h(C(x)))=f(x)\left( J \circ h \circ g \right)(x) = J(h(C(x))) = f(x)

    The inclusion J(b)=bJ(b) = b of the range into BB is injective, and the composition gives back ff. In the example, the four classes go to 11, 22, 33 and 44; the function is not injective because the class {2,3,5}\{2, 3, 5\} has three elements.

The problem shows that every function classifies its domain and, conversely, by the lemma on classes, that every equivalence is the relation “having the same image” under some function, the one that sends each element to its class. Thus a grading system divides students into classes according to their grade, a postal code divides addresses according to their area, and the remainder function divides numbers according to their remainder.

Proposed problems

Each problem has a hint, which should be opened only after attempting the problem; the final answer is shown after the hint.

Proposed problem 1When a set can be taken out of a parenthesis

Prove that, for all sets AA, BB and CC,

A∩(B∪C)=(A∩B)∪C↔C⊆AA \cap \left( B \cup C \right) = \left( A \cap B \right) \cup C \leftrightarrow C \subseteq A

Also give an example of a relation on {1,2,3}\{1, 2, 3\} that is neither symmetric nor antisymmetric.

Hint

For the implication to the right, take xx in CC: it is in the right-hand side, hence in the left-hand side, hence in AA. For the other, prove double inclusion by distinguishing, for each xx, whether it is in BB or in CC. For the relation, combine a pair with its mirror image and another pair without it.

Answer

If the equality holds, CC is contained in the right-hand side, which is equal to the left-hand side, which is contained in AA. If C⊆AC \subseteq A, an element of AA that is in BB or in CC is in A∩BA \cap B or in CC, and conversely an element of CC is in AA and in B∪CB \cup C. A relation that is neither symmetric nor antisymmetric is

{(1,2),(2,1),(2,3)}\{ (1, 2), (2, 1), (2, 3) \}
Worked solution

Solution

  1. x∈C→x∈(A∩B)∪C=A∩(B∪C)→x∈Ax \in C \rightarrow x \in \left( A \cap B \right) \cup C = \resaltar{A} \cap \left( B \cup C \right) \rightarrow x \in A

    If the equality holds and xx is in CC, then xx is in the right-hand side, which contains CC; by the equality, it is in the left-hand side, and in particular in AA. Therefore C⊆AC \subseteq A.

  2. x∈A∧(x∈B∨x∈C)→x∈A∩B∨x∈Cx \in A \wedge \left( x \in B \vee x \in C \right) \rightarrow \resaltar{x \in A \cap B} \vee \resaltar{x \in C}

    Conversely, suppose C⊆AC \subseteq A and let xx be in the left-hand side: it is in AA, and moreover in BB or in CC. In the first case it is in A∩BA \cap B; in the second, in CC. In both, in the right-hand side.

  3. x∈C→x∈A∩(B∪C)x \in C \rightarrow x \in \resaltar{A} \cap \left( B \cup C \right)

    Now let xx be in the right-hand side. If it is in A∩BA \cap B, it is in AA and in B∪CB \cup C; if it is in CC, it is in B∪CB \cup C and, by the hypothesis C⊆AC \subseteq A, also in AA.

  4. C⊆A→A∩(B∪C)=(A∩B)∪CC \subseteq A \rightarrow A \cap \left( B \cup C \right) = \left( A \cap B \right) \cup C

    By double inclusion, the two sides are equal when C⊆AC \subseteq A; with the first step, the equivalence is proved.

  5. (2,3)∈R, (3,2)∉R;(1,2),(2,1)∈R(2, 3) \in R, \ (3, 2) \notin R; \qquad (1, 2), (2, 1) \in R

    In the proposed relation, the pair (2,3)(2, 3) is present and its mirror image (3,2)(3, 2) is not, so it is not symmetric; the pairs (1,2)(1, 2) and (2,1)(2, 1) are present, with 1≠21 \neq 2, so it is not antisymmetric.

Proposed problem 2The partitions of five elements

Count the equivalence relations on the set {1,2,3,4,5}\{1, 2, 3, 4, 5\}, and how many of them have exactly two classes.

Hint

Classify the partitions by the sizes of their blocks, as in solved problem 4: there are seven types, from 55 to 1+1+1+1+11 + 1 + 1 + 1 + 1. For a block of three and one of two it suffices to choose the block of two; for two blocks of two and one of one, first choose the solitary element.

Answer

By types, 1+5+10+10+15+10+11 + 5 + 10 + 10 + 15 + 10 + 1; those with two classes are those of the types 4+14 + 1 and 3+23 + 2, which add up to 5+10=155 + 10 = 15:

1+5+10+10+15+10+1=521 + 5 + 10 + 10 + 15 + 10 + 1 = 52
Proposed problem 3The inverse of a composition

Let f:A→Bf : A \to B and g:B→Cg : B \to C be bijective. Prove that the inverse of g∘fg \circ f is f−1∘g−1f^{-1} \circ g^{-1}, in that order. Apply this to getting dressed: if ff is putting on one’s socks and gg putting on one’s shoes, in what order is the operation undone?

Hint

By the uniqueness of the inverse, it suffices to check that f−1∘g−1f^{-1} \circ g^{-1} composed with g∘fg \circ f, in both orders, gives the identity; regroup by associativity so that g−1g^{-1} meets gg and ff meets f−1f^{-1}.

Answer

By associativity, the middle factors cancel; by the uniqueness of the inverse, (g∘f)−1=f−1∘g−1(g \circ f)^{-1} = f^{-1} \circ g^{-1}. To get undressed, one first takes off the shoes and then the socks.

(f−1∘g−1)∘(g∘f)=f−1∘(g−1∘g)∘f=f−1∘f=IA\left( f^{-1} \circ g^{-1} \right) \circ \left( g \circ f \right) = f^{-1} \circ \left( g^{-1} \circ g \right) \circ f = f^{-1} \circ f = I_A
Worked solution

Solution

  1. f−1∘g−1:C→Af^{-1} \circ g^{-1} : C \to A

    The composition of two bijections is bijective and therefore has a unique inverse. It suffices to check that f−1∘g−1f^{-1} \circ g^{-1}, which goes from CC to AA, undoes it in both orders.

  2. (f−1∘g−1)∘(g∘f)=f−1∘(g−1∘g)∘f=f−1∘f=IA\left( f^{-1} \circ g^{-1} \right) \circ \left( g \circ f \right) = f^{-1} \circ \resaltar{\left( g^{-1} \circ g \right)} \circ f = f^{-1} \circ f = I_A

    First order: by the associativity of composition, g−1g^{-1} meets gg and their composition is the identity of BB, which does not alter ff.

  3. (g∘f)∘(f−1∘g−1)=g∘(f∘f−1)∘g−1=g∘g−1=IC\left( g \circ f \right) \circ \left( f^{-1} \circ g^{-1} \right) = g \circ \resaltar{\left( f \circ f^{-1} \right)} \circ g^{-1} = g \circ g^{-1} = I_C

    Second order: in the same way, ff meets f−1f^{-1}.

  4. (g∘f)−1=f−1∘g−1\left( g \circ f \right)^{-1} = f^{-1} \circ g^{-1}

    By the uniqueness of the inverse, f−1∘g−1f^{-1} \circ g^{-1} is the inverse of g∘fg \circ f: the factors are inverted in the opposite order.

  5. (g∘f)−1=f−1∘g−1\left( g \circ f \right)^{-1} = \resaltar{f^{-1}} \circ \resaltar{g^{-1}}

    Getting dressed is g∘fg \circ f: first the socks and then the shoes. Undoing it is applying first g−1g^{-1}, taking off the shoes, and then f−1f^{-1}, taking off the socks.

Proposed problem 4As many pairs of natural numbers as natural numbers

Prove that the function f:N×N→Nf : \mathbb{N} \times \mathbb{N} \to \mathbb{N} defined by

f(a,b)=2a−1(2b−1)f(a, b) = 2^{a - 1} \left( 2b - 1 \right)

is a bijection.

Hint

Every natural number nn can be written in exactly one way as a power of 22 times an odd number: divide by 22 as long as the number is even; the process ends because the quotients decrease. For uniqueness, if 2ju=2kv2^{j} u = 2^{k} v with uu and vv odd and j<kj < k, cancel 2j2^{j} and compare the parity of the two sides.

Answer

The function is bijective: the exponent of 22 in nn gives aa, and the odd part 2b−12b - 1 gives bb. The first values are

f(1,1)=1,f(2,1)=2,f(1,2)=3,f(3,1)=4,f(1,3)=5,f(2,2)=6f(1, 1) = 1, \quad f(2, 1) = 2, \quad f(1, 2) = 3, \quad f(3, 1) = 4, \quad f(1, 3) = 5, \quad f(2, 2) = 6
Worked solution

Solution

  1. f(a,b)=2a−1(2b−1)f(a, b) = 2^{a - 1} \left( 2b - 1 \right)

    The function is well defined: a−1a - 1 is 00 or a natural number, and in the first case 20=12^0 = 1 by the convention for the zero exponent, which the lesson on the basic operations justifies; moreover, 2b−12b - 1 is odd. In the table, row aa contains the products of 2a−12^{a - 1} by the odd numbers.

  2. n=2ju=2j(2b−1)=f(j+1,b)n = 2^{j} u = 2^{j} \left( 2b - 1 \right) = f(\resaltar{j + 1}, \resaltar{b})

    Surjectivity: given nn, divide by 22 as long as the number is even. The quotients decrease, and a strictly decreasing sequence of natural numbers cannot be infinite (this is the well-ordering principle, proved in the lesson on summations and induction, which is anticipated here): the process ends at an odd number uu after jj divisions, and u=2b−1u = 2b - 1 with b=u+12b = \frac{u + 1}{2}.

  3. 2ju=2kv, j<k→u=2k−jv2^{j} u = 2^{k} v, \ j < k \rightarrow u = \resaltar{2^{k - j}} v

    Injectivity: suppose f(a,b)=f(a′,b′)f(a, b) = f(a', b'), that is, 2ju=2kv2^{j} u = 2^{k} v with j=a−1j = a - 1, k=a′−1k = a' - 1, u=2b−1u = 2b - 1 and v=2b′−1v = 2b' - 1, where uu and vv are odd. If it were the case that j<kj < k, cancelling 2j2^{j} would leave an odd number equal to an even one, which is impossible; likewise if k<jk < j, and by trichotomy j=kj = k, that is, a=a′a = a'.

  4. 2ju=2jv→u=v→2b=2b′,a=a′, b=b′2^{j} u = 2^{j} v \rightarrow u = v \rightarrow 2b = 2b', \qquad a = a', \ b = b'

    With j=kj = k, the cancellation law for multiplication gives u=vu = v; it follows that 2b=u+1=v+1=2b′2b = u + 1 = v + 1 = 2b', and the cancellation law for multiplication gives b=b′b = b': the two pairs coincide in both coordinates.

  5. f(3,2)=22⋅3=12f(3, 2) = 2^{2} \cdot 3 = 12

    The function is therefore a bijection from N×N\mathbb{N} \times \mathbb{N} to N\mathbb{N}. For example, 12=22⋅312 = 2^2 \cdot 3 is the image of the pair (3,2)(3, 2).

Proposed problem 5The order of the courses

A student plans six courses, aa, bb, cc, dd, ee and ff, to be taken one at a time. Course aa is a prerequisite of bb and of cc; courses bb and cc are prerequisites of dd; and ee is a prerequisite of ff. Writing x⪯yx \preceq y when x=yx = y or xx must be taken before yy, directly or indirectly, prove that ⪯\preceq is a partial order, determine its minimal and maximal elements, and count the ways of ordering the six courses that respect the prerequisites.

Hint

A valid ordering is a total order that contains ⪯\preceq. Courses aa, bb, cc and dd can be taken in only two orders, according to whether bb or cc comes first; then ee and ff must be interleaved, in that order, among the other four: choose which two of the six places they occupy.

Answer

The minimal elements are aa and ee; the maximal ones, dd and ff; there is no least or greatest element. There are 1515 ways of choosing the places of ee and ff among six, and therefore

2⋅15=302 \cdot 15 = 30
Worked solution

Solution

  1. x⪯y∧y⪯z→x⪯zx \preceq y \wedge y \preceq z \rightarrow \resaltar{x \preceq z}

    The relation is reflexive by definition, because the first alternative of the definition, x=yx = y, holds when yy is xx itself. It is transitive: if xx comes before yy and yy before zz, directly or indirectly, then xx comes before zz.

  2. x⪯y∧y⪯x→x=yx \preceq y \wedge y \preceq x \rightarrow x = y

    It is antisymmetric: if we had x⪯yx \preceq y and y⪯xy \preceq x with x≠yx \neq y, the prerequisites would form a cycle, and neither of the two courses could be taken first. In the figure, the arrows of the prerequisites always point downwards, and there are no cycles.

  3. {a,e},{d,f}\{ a, e \}, \qquad \{ d, f \}

    The minimal elements are the courses without prerequisites, aa and ee; the maximal ones, those that are prerequisites of none, dd and ff. Since aa and ee are not comparable, nor dd and ff, there is no least or greatest element.

  4. (a,b,c,d),(a,c,b,d)(a, b, c, d), \qquad (a, c, b, d)

    Courses aa, bb, cc and dd admit only two orders: aa first, dd last, and bb and cc in either of the two orders between them.

  5. 2⋅15=302 \cdot \resaltar{15} = 30

    It remains to interleave ee and ff, in that order: it suffices to choose the two places they occupy among the six, and there are 5+4+3+2+1=155 + 4 + 3 + 2 + 1 = 15 ways, according to the place of ee. Each of the two orders combines with each of those choices, and there are 3030 orderings.