NBG Set Theory and Binary Relation

In this chapter, we will discuss further topics on set theory, or more specifically, relations. With set as tool, we can categorize things and try to build connections between them, like defining a function from a preimage to an image. Relation is a superset , i.e., generalization of function, which is crucial to topics that we will discuss later in this chapter.

In real life, relation is referred to as some connections between one person or one group of people to the other.

  1. Imagine a list of students and their grades in a class. Each student (let's say, by their student ID) is linked to a specific grade. This "student-to-grade" pairing is an example of a functional relation, because every student has one and only one grade assigned.

  2. Consider the relationship "has the same birthday as" among people. If person A has the same birthday as person B, and person B has the same birthday as person C, then person A also has the same birthday as person C. This relationship is an equivalence relation because it's reflexive (everyone has the same birthday as themselves), symmetric (if A shares a birthday with B, then B shares a birthday with A), and transitive (if A shares a birthday with B, and B with C, then A shares a birthday with C).

  3. Numerical heights have the usual order ≤\le. On books themselves, “has height at most” is only a preorder: two different books can have the same height, so antisymmetry may fail.

The notion is still quite similar in the context of mathematics. From many examples we can see this. Like all the mathematical operations we have defined, the mapping in a function, congruence... To sum up, relation is am abstract topic, yet not hard to understand, since it can be related to the material world easily.

From elementary sets to classes

Naive Set Theory introduced ordinary set constructions informally, with specified source sets. It did not assume that every description defines a set. The contradictory principle is unrestricted comprehension: treating the Russell collection R={x:x∉x}R=\{x:x\notin x\} as a set gives R∈RR\in R if and only if R∉RR\notin R.

Here we introduce the language of NBG (von Neumann–Bernays–Gödel) set theory to discuss both sets and larger collections. This is background for the chapter, not a requirement for defining an order on an ordinary set: a relation on a set AA is already represented by a subset of A×AA\times A [1][1] T. Banakh, “Classical Set Theory: Theory of Sets and Classes,” arXiv:2006.01613, 2026. Version 6, August 15, 2026; NBG sets, classes, and class existence. https://arxiv.org/abs/2006.01613.

DefinitionSets and proper classes

In a one-sorted presentation of NBG, the objects are classes, and every member of a class is a set. A class that is a member of another class is a set; a class that is not a set is a proper class. Thus every set is a class, but proper classes cannot themselves be elements.

The class VV of all sets and the class of all ordinals are proper classes. Allowing them as classes does not turn them into sets or permit arbitrary classes as members.

Extensionality and elementary class comprehension

AxiomExtensionality of classes

Classes with the same members are equal:

∀A ∀B(∀x (x∈A↔x∈B)→A=B).\forall A\,\forall B\bigl(\forall x\,(x\in A\leftrightarrow x\in B)\to A=B\bigr).
AxiomElementary class comprehension

Let P(x)P(x) be a formula whose quantified variables range only over sets; fixed set and class parameters may occur. There is a class

C={x:x is a set and P(x)}.C=\{x:x\text{ is a set and }P(x)\}.

Thus u∈Cu\in C exactly when uu is a set and P(u)P(u) holds. This is a schema restricted to formulas with set quantifiers, not a rule for arbitrary formulas quantifying over classes.

These principles explain the class constructions used below; they are not the complete NBG axiom list. In particular, introducing class notation alone does not settle every set-existence question. Choice conventions also vary between presentations and must be stated when they are needed.

Properties and Operations of Class

Since the definition of Class and set are related, there are a lot of overlap in their properties. The union and intersection of two classes are defined in exactly the same way as the union and intersection of two sets in naïve set theory: if AA and BB are classes, then

A∪B={x:(x∈A)∨(x∈B)},A∩B={x:(x∈A)∧(x∈B)}.\begin{aligned} A \cup B &= \{x : (x \in A) \vee (x \in B)\}, \\ A \cap B &= \{x : (x \in A) \wedge (x \in B)\}. \end{aligned}

So a set xx is a member of A∪BA \cup B if and only if it is a member of either AA or BB (or both); xx is a member of A∩BA \cap B if and only if it is a member of both AA and BB.

The usual properties of these unions and intersections are established as in naïve set theory. Namely, we have the properties known as idempotence,

∀X(X∪X=X),∀X(X∩X=X),\begin{aligned} \forall X(X \cup X = X), \quad \forall X(X \cap X = X), \end{aligned}

associativity,

∀X∀Y∀Z(X∪(Y∪Z)=(X∪Y)∪Z),∀X∀Y∀Z(X∩(Y∩Z)=(X∩Y)∩Z),\begin{aligned} \forall X \forall Y \forall Z (X \cup (Y \cup Z) = (X \cup Y) \cup Z), \\ \forall X \forall Y \forall Z (X \cap (Y \cap Z) = (X \cap Y) \cap Z), \end{aligned}

commutativity,

∀X∀Y(X∪Y=Y∪X),∀X∀Y(X∩Y=Y∩X),\begin{aligned} \forall X \forall Y (X \cup Y = Y \cup X), \quad \forall X \forall Y (X \cap Y = Y \cap X), \end{aligned}

and distributivity,

∀X∀Y∀Z(X∪(Y∩Z)=(X∪Y)∩(X∪Z)),∀X∀Y∀Z(X∩(Y∪Z)=(X∩Y)∪(X∩Z)).\begin{aligned} \forall X \forall Y \forall Z (X \cup (Y \cap Z) = (X \cup Y) \cap (X \cup Z)), \\ \forall X \forall Y \forall Z (X \cap (Y \cup Z) = (X \cap Y) \cup (X \cap Z)). \end{aligned}
DefinitionClass Complement

We write x∉yx \notin y as an abbreviation for ¬(x∈y)\neg(x \in y). Then for each class AA we define the complement of AA to be the class

∼A={x:x∉A}.\begin{aligned} \sim A = \{x : x \notin A\}. \end{aligned}
DefinitionClass Difference

For two classes AA and BB, the difference A BA~B is defined as:

A∼B or A−B={x:(x∈A)∧(x∉B)}=A∩(∼B).A\sim B \text{ or } A-B=\{x:(x\in A)\land(x\not\in B)\}=A\cap(\thicksim B).

Also, note that double negation and De Morgan's Law also work for class.

As what we have discussed in set theory that there exist some empty sets, we also have null class and universe class.

DefinitionEmpty and Universal Classes

Empty class ∅\emptyset and universe class VV are defined by

∅={x:x≠x}   V={x:x=x}.\emptyset=\{x:x\neq x\}\ \ \ V=\{x:x=x\}.

Classes also have their exclusive operations, including intersection and union.

DefinitionUnion and Intersection of Classes

Let AA be a class; the union and intersection of the class AA are the classes

⋃A={x:(∃y)((y∈A)∧(x∈y))},⋂A={x:(∀y)((y∈A)→(x∈y))}\begin{array}{rcl}\bigcup A&=&\{x:(\exists y)((y\in A)\land(x\in y))\},\\ \bigcap A&=&\{x:(\forall y)((y\in A)\to (x\in y))\}\end{array}

Where xx is a set and yy is a class.

Thus a class CC belongs to ⋃A\bigcup A if and only if CC is a set and CC belongs to at least one of the members of A;CA;C belongs to ⋂A\bigcap A if and only if CC is a set and CC belongs to every member of A.A.

The definition is quite different from intersection and union of sets, as class is a generalization of set from higher level abstraction. Also, the intersection and union for sets are binary operations, while unary for one class.

Below is a brief comparison.

Set Union and Intersection:

  1. For two sets AA and BB, their union A∪BA \cup B is the set of all elements that belong to either AA or BB. Formally: A∪B={x:x∈A∨x∈B}A \cup B = \{x : x \in A \lor x \in B\}.

  2. For two sets AA and BB, their intersection A∩BA \cap B is the set of all elements that belong to both AA and BB. Formally: A∩B={x:x∈A∧x∈B}A \cap B = \{x : x \in A \land x \in B\}.

Class Union and Intersection:

  1. For a class AA, the class union ⋃A\bigcup A is the set of all elements xx such that there exists a class yy, where yy is a member of AA, and xx is an element of yy. Formally: ⋃A={x:(∃y)((y∈A)∧(x∈y))}\bigcup A = \{x : (\exists y)((y \in A) \land (x \in y))\}.

  2. For a class AA, the class intersection ⋂A\bigcap A is the set of all elements xx such that for every class yy, if yy is a member of AA, then xx is an element of yy. Formally: ⋂A={x:(∀y)((y∈A)→(x∈y))}\bigcap A = \{x : (\forall y)((y \in A) \to (x \in y))\}.

Comparison:

  1. Set union and intersection operate on two sets, while class union and intersection operate on all member sets of a class.

  2. Set union includes elements that are in either AA or BB, while class union includes elements that are in at least one member of AA.

  3. Set intersection includes elements that are in both AA and BB, while class intersection includes elements that are in all members of AA.

  4. The result of set union and intersection is always a set, while the result of class union and intersection is not necessarily a set , but more likely a class that contains sets.

By comparing these concepts, we can see that class union and intersection are generalizations of set operations at a higher level of abstraction. They allow us to perform operations on the member sets of a class to obtain new sets, which is particularly useful when studying advanced topics in mathematical foundations and set theory.

There are several lemmas related to intersection and union of class.

LemmaEmpty-Class Union and Intersection

⋂∅=V\bigcap \emptyset= V and ⋃∅=∅.\bigcup \emptyset= \emptyset.

Proof

Let CC be a class. Then we have

C∈⋂∅  ⟺  C is a set and C belongs to every member of ∅C \in \bigcap \emptyset \iff C \text{ is a set and } C \text{ belongs to every member of } \emptyset

Since ∅\emptyset does not literally have any member.

  ⟺  C is a set\iff C \text{ is a set}

Any set is a member of universe class

  ⟺  C∈V.\iff C \in V.

Thus

⋂∅=V\bigcap \emptyset = V

by the Axiom of Extensionality.

Again let CC be a class. Then

C∈⋃∅  ⟺  C is a set and there is a member x of ∅ such that C∈xC \in \bigcup \emptyset \iff C \text{ is a set and there is a member } x \text{ of } \emptyset \text{ such that } C \in x  ⟺  C∈∅\iff C \in \emptyset

(since ∅\emptyset has no members).

So

⋃∅=∅\bigcup \emptyset = \emptyset

by the Axiom of Extensionality.

The inclusive relation of class is very similar to set.

DefinitionClass Inclusion

If AA and BB are classes such that every member of AA is also a member of BB, i.e., such that we have

∀x((x∈A)→(x∈B)),\forall x ((x \in A) \to (x \in B)),

we say that AA is included in BB, BB includes AA or AA is a subclass of BB, and we write A⊆BA \subseteq B or B⊇AB \supseteq A. (If AA is a set and A⊆BA \subseteq B we say that AA is a subset of BB.) If A⊆BA \subseteq B and there is at least one set bb such that b∈Bb \in B but b∉Ab \not\in A, we say that AA is properly included in BB, BB properly includes AA or AA is a proper subclass of BB, and we write A⊂BA \subset B or B⊃AB \supset A.

We can also extend power set to power class. For every class AA we define the power class P(A)P(A) of AA to be the class of all subsets of AA, i.e., P(A)={x:x⊆A}P(A) = \{x : x \subseteq A\}. This brings us to another axiom in NBG set theory.

AxiomPower Set Axiom

For every set xx there exists a set yy such that u∈yu \in y if and only if u⊆xu \subseteq x.

The Power Set Axiom thus asserts that every subclass uu of a set xx is actually a set (since it is an element of the set yy whose existence is asserted by the axiom) and furthermore that the power class P(x)P(x) of a set xx is also a set (and so is usually referred to as the power set of xx).

The rest of the axioms are as follows.

AxiomPairing Axiom

For all sets xx and yy the class {z:(z=x)∨(z=y)}\{z : (z = x) \vee (z = y)\} is a set.

The set {z:(z=x)∨(z=y)}\{z : (z = x) \vee (z = y)\} is denoted by {x,y}\{x, y\} and such a set is called an unordered pair. If x=yx = y the unordered pair {x,y}\{x, y\} is denoted by {x}\{x\} and is called singleton xx.

RemarkUnordered Pairs

In set theory, an unordered pair refers to a collection of two elements in which the sequence of the elements does not matter. This is represented as {a,b}\{a, b\}, indicating a set that contains exactly two distinct elements aa and bb. The fundamental property of unordered pairs is that {a,b}={b,a}\{a, b\} = \{b, a\}, asserting that the order of elements is immaterial.

The concept of an unordered pair is not limited to sets; it extends to classes in certain set theories that distinguish between sets and proper classes. While sets are collections of elements that themselves can be elements of other sets, proper classes are collections too large to be sets and hence cannot be elements of other collections. Nonetheless, the notion of grouping two objects into an unordered pair applies analogously, symbolizing the collection of those objects without regard to order.

AxiomUnion Axiom

For every set xx the class ⋃x\bigcup x is a set.

We can also extend Cartesian Product to class. Let aa and bb be sets. Then the set {{a},{a,b}}\{\{a\},\{a,b\}\} is denoted by (a,b)(a,b) and is called the ordered pair with first coordinate aa and second coordinate bb. Lét AA and BB be classes; then the Cartesian product of AA and BB is the cclass

A×B={t:(∃x)(∃y)((x∈A)∧(y∈B)∧(t=(x,y)))},A\times B=\{t:(\exists x)(\exists y)((x\in A)\land(y\in B)\land(t=(x,y)))\},

i.e. A×BA\times B is the class of all ordered pairs with first coordinate in AA and second coordinate in B.B.

If P(x,y)P(x,y) is an open sentence involving the free variables xx and yy we shall allow ourselves to write

{(x,y):P(x,y)}\{(x,y):P(x,y)\}

as an abbreviation for

{t:(∃x)(∃y)((t=(x,y))∧P(x,y))}.\{t:(\exists x)(\exists y)((t=(x,y))\land P(x,y))\}.

So we can abbreviate the definition of A×BA\times B to

A×B={(x,y):(x∈A)∧(y∈B)}.A\times B=\{(x,y):(x\in A)\wedge(y\in B)\}.

Binary Relations, Composition and Inverse

In mathematics, the most fundamental and ubiquitous type of relation is the binary relation. This term refers to a relationship between two objects or sets. We understand that a 'set' may encompass any concept, not solely in the mathematical sense but also in a material one. Relations may exist objectively between certain objects and not at all for others. Similarly, objects or sets of objects, which exist objectively, hold the potential for an infinite number of relationships with one another. This perspective can seem philosophically abstract, positing that any scenario is conceivable. However, we can convey this more clearly. Recall our discussion of the Cartesian product as a set extension, where we consider two sets, AA and BB. These sets could represent any discernible entity or indiscernible concept. Theoretically, there could be countless relationships among all elements of these sets, and the capacity of two sets to form a Cartesian product is indicative of a general type of relationship. Consequently, the elements of the power set P(A×B)P(A \times B) exemplify all possible cases of a certain kind of relationship.

A vivid mathematical example is the definition of Euclidean spaces, where an infinite number of subspaces can be defined, each representing a unique binary relation within the space.

We first introduce the definition of a binary relation in terms of sets.

DefinitionBinary Relations

A Binary Relation RR from a set AA to a set BB is a subset of the Cartesian product A×BA \times B. For elements a∈Aa \in A and b∈Bb \in B, if the pair (a,b)(a, b) belongs to the subset RR, then we say aa is related to bb by the relation RR, denoted as aRbaRb, whose negation is aR̸ba\not R b.

In last section, we introduced the higher abstraction of sets, which is class. Classes also have Cartesian product,thus, we can give a general definition to all relations using class.

DefinitionRelations as Classes of Ordered Pairs

A relation is a class of ordered pairs.

Let RR be a relation. We define the domain and range of RR to be the classes Dom RR and Range RR given by

Dom R={x:(∃y)((x,y)∈R)},Range R={y:(∃x)((x,y)∈R)}.\begin{array}{rcl}\text{Dom }R&=&\{x:(\exists y)((x,y)\in R)\},\\\text{Range }R&=&\{y:(\exists x)((x,y)\in R)\}.\end{array}

If RR is a relation and (x,y)∈R(x,y)\in R, we say that xx is RR-related to yy and that yy is an RR-relative of xx. Thus Dom RR is the class of all sets that have RR-relatives, and Range RR is the class of all sets that are RR-relatives.

Now we look into several concrete examples of relation.

ExampleConsider the set of all points on a plane

Consider the set of all points on a plane. The relation defined by the equation of a circle, x2+y2=r2x^2 + y^2 = r^2, includes all points (x,y)(x, y) that satisfy this equation. This relation is not a function because, for most values of xx, there are two possible values of yy that satisfy the equation, one positive and one negative (except for the points where x=±rx = \pm r, where there is only one value of yy).

In contrast, a function would allow each xx to be associated with exactly one yy. For instance, the square function y=x2y = x^2 is a function because each value of xx corresponds to exactly one value of yy.

In the figure we have defined a circle and a quadratic function, clearly we see that a function can never have two yy value for one xx, while this is possible for the circle.

A circle relation and the function y=x^2.

ExampleLet A be the set 1, 2, 3, 4

Let A be the set {1,2,3,4}. Which ordered pairs are in the relation R={(a,b)∣aR=\{(a,b)\mid a divides b}?b\}?

Solution: Because (a,b)(a,b) is in R if and only if aa and bb are positive integers not exceeding 4 such that aa divides bb,we see that

R={(1,1),(1,2),(1,3),(1,4),(2,2),(2,4),(3,3),(4,4)}.R=\{(1,1),(1,2),(1,3),(1,4),(2,2),(2,4),(3,3),(4,4)\}.

Bipartite digraph for the divisibility relation on \{1,2,3,4\}.

This relation also differs from function, since for member of aa, it is possible to map to multiple members in bb.

DefinitionFunctional Relations

A relation RR is said to be functional if each element of its domain has exactly one RR-relative; a functional relation is also called a function. If RR is a functional relation then for each element aa of its domain we denote the unique RR-relative of aa by R(a).R(a).

This leads us to the next axiom of NBG theory.

AxiomReplacement Axiom

For every functional relation RR, if the domain of RR is a set then the range of RR is also a set.

Mapping, Composition, and Inverse

In naive set theory and function in part 1 of the book, we gave a rough definitions to mappings. With class, we can make it more concrete.

DefinitionMappings

A mapping is an ordered pair ((A,B),R)((A,B),R) where AA and BB are sets and RR is a functional relation between AA and BB such that Dom R=A.R=A. If f=((A,B),R)f= ( ( A, B) , R) is a mapping we say that ff is a mapping from AA to B;B; we call AA the domain of f,Bf,B the codomain of ff and RR the graph of ff. If ff is a mapping with domain AA and codomain BB we often write f:A→B.f:A\to B. If aa is any element of the set AA then the set R→({a})R^{\to}(\{a\}) consists of a single element of BB which we denote by f(a);f(a); we call it the image of a under fa\textbf{ under }f or the value of f at a.f\textbf{ at }a.

It is clear from the definition of the term "mapping" that in order to describe a mapping ff we must give the domain AA and codomain BB of ff and also, for each element aa of the domain we must describe the unique element bab_a of the codomain such that (a,ba)(a,b_a) belongs to the graph of ff, i.e. we must describe for each element aa of AA its image under ff in B.B.

Let f=((A,B),R)f= ( ( A, B) , R) be a mapping from AA to BB. For each subset XX of AA we denote the subset R→(X)R^{\to}(X) of BB by f→(X);f^{\to}(X); in particular, if aa is any element of AA we have f→({a})={f(a)}.f^{\to}(\{a\})=\{f(a)\}. For each subset YY of BB we denote the subset R←(Y)R^{\leftarrow }( Y) of AA by f←(Y).f^{\leftarrow }( Y) .

Let f=((A,B),R)f=((A,B),R) be a mapping from AA to BB, and let A1A_1 be a subset of AA. Then the restriction of ff to A1A_1 is the mapping

f∣A1=((A1,B),R∩(A1×B)).f\mid A_1= \left((A_1,B),R\cap(A_1\times B)\right).

Earlier, we discussed composition and inverse of function. Now that we have known that function is a kind of relation, can we compose or inverse all other relations? Naturally the answer is yes.

DefinitionSurjective Mappings

Let f=((A,B),R)f= ( ( A, B) , R) be a mapping. Then ff is said to be surjective or to be a surjection if we have Range RR =B,= B,i.e. if every element of BB is the image under ff of at least one element of A.A.

Next, ff is injective if the inverse relation R−1R^{-1} is functional. Equivalently, each element of the range of RR is the image under ff of exactly one element of AA. In symbols, whenever f(a1)=f(a2)f(a_1)=f(a_2) for a1,a2∈Aa_1,a_2\in A, we have a1=a2a_1=a_2.

The mapping ff is said to be bijective or to be a bijection if it is both injective and surjective. If AA and BB are sets we say that AisA\textbf{is} equipotent to BB or that Ais equinumerous with BA\textbf{is equinumerous with }B if there exists a bijective mapping from AA to B.B.

Let f=((A,B),R)f=((A,B),R) be a mapping. Then ((B,A),R−1)((B,A),R^{-1}) is a mapping if and only if ff is bijective; in this case we write ((B,A),R−1)=f−1((B,A),R^{-1})=f^{-1} and call f−1f^{-1} the inverse mapping of f.f. Clearly f−1f^{-1} is a bijection from BB to AA with inverse f.f.

Here are some examples of special mappings.

ExampleA function f: A B is surjective if for every element y in B, there is...

A function f:A→Bf: A \to B is surjective if for every element yy in BB, there is at least one element xx in AA such that f(x)=yf(x) = y. For instance, let A={1,2,3}A = \{1, 2, 3\} and B={a,b}B = \{a, b\}. Define ff by f(1)=af(1) = a, f(2)=af(2) = a, and f(3)=bf(3) = b. This function is surjective because every element of BB is the image of at least one element of AA.

ExampleA function f: A B is injective if no two different elements in A map...

A function f:A→Bf: A \to B is injective if no two different elements in AA map to the same element in BB. For example, let A={1,2,3}A = \{1, 2, 3\} and B={a,b,c,d}B = \{a, b, c, d\}. Define ff by f(1)=af(1) = a, f(2)=bf(2) = b, and f(3)=cf(3) = c. This function is injective because each element of AA maps to a unique element of BB.

ExampleA function f: A B is bijective if it is both injective and surjective

A function f:A→Bf: A \to B is bijective if it is both injective and surjective. For instance, let A={1,2,3}A = \{1, 2, 3\} and B={a,b,c}B = \{a, b, c\}. Define ff by f(1)=af(1) = a, f(2)=bf(2) = b, and f(3)=cf(3) = c. This function is bijective, making AA and BB equinumerous.

ExampleIf f is a bijective function from A to B, then the inverse f^-1 is a...

If ff is a bijective function from AA to BB, then the inverse f−1f^{-1} is a function from BB to AA that reverses the mapping of ff. Using the bijective function ff from the previous example, we define f−1f^{-1} by f−1(a)=1f^{-1}(a) = 1, f−1(b)=2f^{-1}(b) = 2, and f−1(c)=3f^{-1}(c) = 3.

DefinitionComposition of Relations

If RR and SS are relations, the composition of RR and SS is the relation S∘RS\circ R given by

S∘R={(x,z):(∃y)(((x,y)∈R)∧((y,z)∈S))}.S\circ R=\{(x,z):(\exists y)(((x,y)\in R)\wedge((y,z)\in S))\}.

If RR is a relation between AA and BB and SS is a relation between BB and CC then clearly S∘RS\circ R is a relation between AA and CC, and we have Dom⁡(S∘R)⊆Dom⁡R\operatorname{Dom}\left(S\circ R\right)\subseteq\operatorname{Dom}R and Range (S∘R)⊆Range⁡S.(S\circ R)\subseteq\operatorname{Range}S.

The idea of composition also works for mappings.

DefinitionComposition of Mappings

Let f=((A,B),R)f= ( ( A, B) , R) and g=((B,C),S)g= ( ( B, C) , S) be mappings. Then clearly ((A,C),S∘R)((A,C),S\circ R) is also a mapping, which we denote by g∘fg\circ f and call the composition or composed mapping of ff and gg. For each element aa of AA we have (g∘f)(a)=g(f(a)).( g\circ f) ( a) = g( f( a) ).

RemarkComposition Notation

The other equivalent definition is that Let RR be a relation from a set AA to a set BB and S a relation from BB to a set CC. The compositecomposite of RR and S is the relation consisting of ordered pairs (a,c)(a,c), where a∈A,c∈Ca\in A, c\in C , and for which there exists an element b∈Bb\in B such that (a,b)∈R( a, b) \in R and (b,c)∈S.( b, c) \in S. We denote the composite of RR and SS by S∘R.S\circ R.

Similarly, we can define inverse relation.

DefinitionRelations Between Classes

If AA and BB are classes then a relation between A and BA\textbf{ and }B is a subclass of A×BA\times B, i.e. a relation RR such that Dom R⊆AR\subseteq A and Range R⊆B.R\subseteq B. A relation on a class AA is a subclass of A×A.A\times A.

If RR is a relation, the inverse of RR is the relation R−1R^{-1} given by

R−1={(x,y):(y,x)∈R}.R^{-1}=\{(x,y):(y,x)\in R\}.

If RR is a relation between AA and BB then R−1R^{-1} is a relation between BB and A;A; clearly Dom R−1=Range⁡RR^{-1}=\operatorname{Range}R and Range R−1=Dom⁡R.R^{-1}=\operatorname{Dom}R.

Let RR be a relation, AA any class. Then the image of A under RA\textbf{ under }R is the class consisting of all RR-relatives of all members of A.A. We denote this class by R→(A).R^{\to}(A). Thus

R→(A)={y:(∃x)((x∈A)∧((x,y)∈R))}.R^{\to}(A)=\{y:(\exists x)((x\in A)\land((x,y)\in R))\}.

Again let RR be a relation and ker⁡B\ker B be any class. Then the inverse image of BB under RR is the class (R−1)→(B),( R^{- 1}) ^{\to }( B) , which we write R←(B).R^{\leftarrow}( B) . Thus

R←(B)={x:(∃y)((y∈B)∧((x,y)∈R))}.\begin{aligned}R^{\leftarrow}(B)=\{x:(\exists y)((y\in B)\land((x,y)\in R))\}.\end{aligned}

With functional relation and mapping, we can define a more specific relation, which very special and practical.

DefinitionThe Diagonal Relation

Let AA be any set; let DA={x:(∃a)((a∈A)∧(x=(a,a)))}D_A=\{x:(\exists a)((a\in A)\land(x=(a,a)))\} (we call DAD_A the diagonal of A×A).A\times A). Then DAD_A is a functional relation between AA and AA with domain A.A. The mapping IA=((A,A),DA)I_A=((A,A),D_A) from AA to AA is called the identity mapping of A.A. Clearly we have IA(a)=aI_{A}(a)=a for each element aa of A.A.

ExampleThe identity mapping IA for a set A is a function that maps every...

The identity mapping IAI_A for a set AA is a function that maps every element to itself. Here are some examples of identity mappings on various sets:

  • Let B={x∈R∣−1≤x≤1}B = \{x \in \mathbb{R} \mid -1 \leq x \leq 1\}. The identity mapping on BB is IB:B→BI_B : B \to B where IB(x)=xI_B(x) = x for all x∈Bx \in B.

  • Let C={apple,banana,cherry}C = \{\text{apple}, \text{banana}, \text{cherry}\}. The identity mapping on CC is IC:C→CI_C : C \to C where IC(fruit)=fruitI_C(\text{fruit}) = \text{fruit} for each fruit in set CC.

  • Let D=ZD = \mathbb{Z}. The identity mapping on DD is ID:Z→ZI_D : \mathbb{Z} \to \mathbb{Z} where ID(n)=nI_D(n) = n for all n∈Zn \in \mathbb{Z}.

The diagonal for each of these sets would be as follows:

  • The diagonal of BB, DBD_B, would be the set of all ordered pairs (x,x)(x, x) such that x∈Bx \in B.

  • The diagonal of CC, DCD_C, would be the set {(apple,apple),(banana,banana),(cherry,cherry)}\{(\text{apple}, \text{apple}), (\text{banana}, \text{banana}), (\text{cherry}, \text{cherry})\}.

  • The diagonal of DD, DDD_D, would be the set of all ordered pairs (n,n)(n, n) such that n∈Zn \in \mathbb{Z}.

In all these cases, the identity mapping illustrates the concept of a function where the input is the same as the output for each element of the set.

Families of Sets

In part 1, we discussed sequence. Sequence is defined (see definition def_sequence) by a relation between index and a mathematical expression related to the index, and commonly the index ii has i∈Ni\in \mathbb{N}. Sequence is actually a special family of set.

DefinitionFamilies of Elements

Let II and AA be classes, and FF is a functional relation between II and AA. Then FF is sometimes called a family of elements of AA indexed by II (or with I as index class)I\textbf{ as index class}) and we write (F(i))i∈I(F(i))_{i\in I} instead of FF. In particular, if EE is a set then a family of elements of P(E)\mathbf{P}(E) is called a family of subsets of EE indexed by I.I. If FF is such a family and we write Xi=F(i)X_i=F(i) for each element ii in II then we denote the family FF by(Xi)i∈I.\left ( X_i\right ) _{i\in I}.

If XX is a set of subsets of a set EE then the diagonal DXD_X is a family of subsets of EE which may sometimes be denoted by (x)x∈X.(x)_{x\in X}.

Let F=(Xi)i∈IF= ( X_{i}) _{i\in I} be a family of subsets of a set E.E. We define the union of the family to be

⋃i∈IXi={x:(∃i)((i∈I)∧(x∈Xi))}.\bigcup_{i\in I}X_i=\{x:(\exists i)((i\in I)\land(x\in X_i))\}.

Thus xx belongs to the union of the family (Xi)i∈I(X_i)_{i\in I} if and only if it belongs to at least one of the sets XiX_i with ii in I.I. Of course if XX is a set of subsets of EE the union of the corresponding family DXD_X coincides with the union of the set XX as previously defined: ⋃x∈Xx=⋃X.\bigcup_{x\in X}x=\bigcup X.

Again let (Xi)i∈I(X_i)_{i\in I} be a family of subsets of a set E.E. The intersection of this family is defined to be

⋂i∈IXi={x:(x∈E)∧(∀i)((i∈I)⟹(x∈Xi))}.\bigcap_{i\in I}X_i=\{x:(x\in E)\land(\forall i)((i\in I)\Longrightarrow(x\in X_i))\}.

So xx belongs to the intersection of the family (Xi)i∈I(X_i)_{i\in I} if and only if it belongs to all the sets XiX_i with ii in I.I.

We notice that if II is empty then we have ⋂i∈IXi=E.\bigcap_{i\in I}X_i=E. If X i a non-empty set of subsets of EE the intersection of the corresponding family DXD_X coincides with the intersection of the set XX as previously defined:⋂x∈Xx=⋂X.{: }\bigcap _{x\in X}x= \bigcap X.

ExampleConsider the set E and a family of its subsets (Xi)i in I, where I =...

Consider the set EE and a family of its subsets (Xi)i∈I(X_i)_{i \in I}, where I={1,2,3}I = \{1, 2, 3\} and

  • X1={a,b}X_1 = \{a, b\}

  • X2={b,c}X_2 = \{b, c\}

  • X3={a,c,d}X_3 = \{a, c, d\}

The union of the family (Xi)i∈I(X_i)_{i \in I} is the set of elements that are in at least one of the sets XiX_i:

⋃i∈IXi=X1∪X2∪X3={a,b,c,d}\bigcup_{i \in I} X_i = X_1 \cup X_2 \cup X_3 = \{a, b, c, d\}

The intersection of the family (Xi)i∈I(X_i)_{i \in I} is the set of elements that are in every one of the sets XiX_i:

⋂i∈IXi=X1∩X2∩X3=∅\bigcap_{i \in I} X_i = X_1 \cap X_2 \cap X_3 = \emptyset
DefinitionSequences as Functions

Let EE be a set. A sequence in EE is a function from the set of natural numbers N\mathbb{N} to EE. The sequence can be represented as a family of sets (xi)i∈N(x_i)_{i \in \mathbb{N}}, where each xix_i is an element of EE, and ii is the index representing the position of the element in the sequence.

The nn-th term of the sequence is denoted by xnx_n, and the sequence itself can be written as (xn)n=1∞(x_n)_{n=1}^{\infty}, which is the family of elements of EE indexed by N\mathbb{N}.

Let (Xi)i∈I(X_i)_{i\in I} be a family of sets with index set I.I. Let X=⋃i∈IXi.X=\bigcup_{i\in I}X_i. Then the product of the family (Xi)i∈I(X_i)_{i\in I} is the set

∏i∈IXi={f:(f∈Map⁡(I,X))∧(∀i)((i∈I)⟹(f(i)∈Xi))}.\prod_{i\in I}X_i=\{f:(f\in\operatorname{Map}(I,X))\wedge(\forall i)((i\in I)\Longrightarrow(f(i)\in X_i))\}.

If we write f(i)=xif(i)=x_i for each index ii in II, it is sometimes helpful to denote the element ff of ∏i∈IXi\prod_{i\in I}X_i by ∏i∈Ixi\prod_{i\in I}x_i.

For each index jj in II we define a mapping πj\pi_j from ∏i∈IXi\prod_{i\in I}X_i to XjX_j by setting

πj(f)=f(j)for every f∈∏i∈IXi.\pi_j(f)=f(j)\quad\text{for every }f\in\prod_{i\in I}X_i.

The mapping πj\pi_j is called the jj -th projection mapping from ∏i∈IXi.\prod_{i\in I}X_i.

ExampleConsider two sets X1 = a, b and X2 = 1, 2

Consider two sets X1={a,b}X_1 = \{a, b\} and X2={1,2}X_2 = \{1, 2\}. The index set is I={1,2}I = \{1, 2\}. The product of the family of sets (Xi)i∈I(X_i)_{i \in I}, which is X1×X2X_1 \times X_2, consists of all ordered pairs where the first element is from X1X_1 and the second is from X2X_2. Thus, the product is:

∏i∈IXi=X1×X2={(a,1),(a,2),(b,1),(b,2)}\prod_{i \in I} X_i = X_1 \times X_2 = \{(a, 1), (a, 2), (b, 1), (b, 2)\}

Each ordered pair represents a function ff mapping II to the union of X1X_1 and X2X_2. For instance, one such function corresponding to the ordered pair (a,1)(a, 1) is defined by:

f(1)=a,f(2)=1f(1) = a, \quad f(2) = 1

Projection mappings πj\pi_j from ∏i∈IXi\prod_{i \in I} X_i to XjX_j are defined for each index j∈Ij \in I by setting:

π1(f)=f(1),π2(f)=f(2)\pi_1(f) = f(1), \quad \pi_2(f) = f(2)

Hence, for our function ff, the projections are:

π1(f)=a,π2(f)=1\pi_1(f) = a, \quad \pi_2(f) = 1

Family of Sets is related to another axiom of NBG set theory.

AxiomCartesian Product Axiom

Let (Ei)i∈I(E_i)_{i\in I} be a family of nonempty sets indexed by a set II. Then the product ∏i∈IEi\prod_{i\in I}E_i is non-empty.

We can also define choice function of class.

DefinitionChoice Functions

Let (Ei)i∈I(E_i)_{i\in I} be a family of non-empty sets. By a choice function for this family we mean a mapping ff from II to ⋃i∈IEi\bigcup_{i\in I}E_i such that for every index ii in II we have f(i)∈Ei;f(i)\in E_i; thus a choice function is an element of the product ∏i∈IEi.\prod_{i\in I}E_i. If we have Ei∩Ej=∅E_i\cap E_j=\emptyset for every pair of distinct elements i,ji, j of II we say that the family (Ei)i∈I( E_i) _{i\in I} is pairwisepairwise disjoint)disjoint) then the range of a choice function for (Ei)i∈I(E_i)_{i\in I} is a subset of ⋃i∈IEi\bigcup_{i\in I}E_i which contains exactly one element from each set of the family. Such a set is called a selection set for the (pairwise disjoint) family (Ei)i∈I.(E_i)_{i\in I}.

Thus the Axiom of Choice asserts that for every family of non-empty sets there exists a choice function and so for every pairwise disjoint family of non-empty sets there exists a selection set.

ExampleConsider the family of non-empty, pairwise disjoint sets

Consider the family of non-empty, pairwise disjoint sets:

E1={1,2},E2={3,4},E3={5,6},\begin{aligned} E_1 &= \{1, 2\}, \\ E_2 &= \{3, 4\}, \\ E_3 &= \{5, 6\}, \end{aligned}

with the index set I={1,2,3}I = \{1, 2, 3\}.

A choice function ff for this family might be defined as:

f(1)=1,f(2)=4,f(3)=5.\begin{aligned} f(1) &= 1, \\ f(2) &= 4, \\ f(3) &= 5. \end{aligned}

This function ff chooses one element from each set EiE_i, making the selection set for this family {f(1),f(2),f(3)}={1,4,5}\{ f(1), f(2), f(3) \} = \{1, 4, 5\}.

Reflexivity, Symmetry, and Transitivity

With basic relation we have defined, we can now look into some special relations with some specific properties. These properties are important, since these property will be used to further classify relations for us. All special relations could be related to the diagonal of the sets or classes involved in that specific relation.

The first special relation is actually already covered in the diagonal of class, which is the idea of reflexivity, meaning a relation from an object to itself.

DefinitionReflexive Relations

Let RR be a relation on a set XX. The relation RR is said to be reflexive if DX⊆RD_X \subseteq R, where DX={(x,x)∣x∈X}D_X = \{(x, x) \mid x \in X\}. That is, for every element xx in XX, the pair (x,x)(x, x) belongs to RR.

ExampleConsider the following relations on the set 1, 2, 3, 4

Consider the following relations on the set {1,2,3,4}\{1, 2, 3, 4\}:

  • R1={(1,1),(1,2),(2,1),(2,2),(3,4),(4,1),(4,4)}R_1 = \{(1, 1), (1, 2), (2, 1), (2, 2), (3, 4), (4, 1), (4, 4)\}

  • R2={(1,1),(1,2),(2,1)}R_2 = \{(1, 1), (1, 2), (2, 1)\}

  • R3={(1,1),(1,2),(1,4),(2,1),(2,2),(3,3),(4,1),(4,4)}R_3 = \{(1, 1), (1, 2), (1, 4), (2, 1), (2, 2), (3, 3), (4, 1), (4, 4)\}

  • R4={(2,1),(3,1),(3,2),(4,1),(4,2),(4,3)}R_4 = \{(2, 1), (3, 1), (3, 2), (4, 1), (4, 2), (4, 3)\}

  • R5={(1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,4)}R_5 = \{(1, 1), (1, 2), (1, 3), (1, 4), (2, 2), (2, 3), (2, 4), (3, 3), (3, 4), (4, 4)\}

  • R6={(3,4)}R_6 = \{(3, 4)\}

Which of these relations are reflexive?

Solution: The relations R3R_3 and R5R_5 are reflexive because they both contain all pairs of the form (a,a)(a, a), namely, (1,1),(2,2),(3,3),(1, 1), (2, 2), (3, 3), and (4,4)(4, 4). The other relations are not reflexive because they do not contain all of these ordered pairs. In particular, R1,R2,R4,R_1, R_2, R_4, and R6R_6 are not reflexive because (3,3)(3, 3) is not in any of these relations.

And as a complement of Reflexivity, we can define Irreflexivity

DefinitionIrreflexive Relations

A relation RR on a set XX is called irreflexive if DX∩R=∅D_X \cap R = \emptyset, i.e., no pair of the form (x,x)(x, x) belongs to RR for any xx in XX.

Now we discuss symmetry of relation.

DefinitionSymmetric Relations

A relation RR on a set XX is symmetric if for every x,yx, y in XX, if (x,y)∈R(x, y) \in R then (y,x)(y, x) is also in RR, i.e., R=R−1R = R^{-1}

We can also define the complement of this kind of relation.

DefinitionAsymmetric Relations

Let RR be a relation on a set XX. The relation RR is said to be asymmetric if for any x,yx, y in XX, whenever (x,y)∈R(x, y) \in R, then (y,x)∉R(y, x) \notin R. This implies that no pair can be in both RR and R−1R^{-1} unless x=yx = y, which is not permitted for asymmetric relations, thus R∩R−1=∅R \cap R^{-1} = \emptyset, i.e. R≠R−1R \neq R^{-1}, .

There is also a type of relation called antisymmetric relation.

DefinitionAntisymmetric Relations

A relation RR on a set XX is antisymmetric if for all x,yx, y in XX, if (x,y)∈R(x, y) \in R and (y,x)∈R(y, x) \in R, then x=yx = y. That is, R∩R−1⊆DXR \cap R^{-1} \subseteq D_X.

Some may confused by these similar terms. Below are the clarification and some examples.

  • A relation RR on a set XX is symmetric if for any x,y∈Xx, y \in X, whenever (x,y)(x, y) is in RR, then (y,x)(y, x) is also in RR. Symmetry implies a mutual relationship.

  • A relation RR is asymmetric if for any x,y∈Xx, y \in X, whenever (x,y)(x, y) is in RR, (y,x)(y, x) is not in RR. Asymmetry denotes a one-way relationship.

  • A relation RR is antisymmetric if for any x,y∈Xx, y \in X, whenever both (x,y)(x, y) and (y,x)(y, x) are in RR, it must be that x=yx = y. Antisymmetry allows for a hierarchical ordering.

Let's explore these properties through examples:

ExampleThe relation 'is a sibling of' is symmetric

The relation "is a sibling of" is symmetric. If Tom is a sibling of Jerry, then Jerry is a sibling of Tom.

ExampleThe 'less than' relation on the real numbers is asymmetric

The "less than" relation on the real numbers is asymmetric. If 3<43 < 4, then it is not the case that 4<34 < 3.

ExampleThe 'divides' relation for integers is antisymmetric

The "divides" relation for integers is antisymmetric. For example, 66 divides 1212, and 1212 does not divide 66. But we can have 6 divides 6 itself.

Exercises

ExerciseDetermine whether each of the following is a set or a class in NBG set...

Determine whether each of the following is a set or a class in NBG set theory, and explain why.

  1. The collection of all sets that do not contain themselves.

  2. The set of all natural numbers.

  3. The class of all ordinal numbers.

SolutionBelow are the solutions The collection of all sets that do not contain...

Below are the solutions.

  1. The collection of all sets that do not contain themselves is a proper class. This is because any attempt to consider it as a set leads to Russell's paradox, thus it cannot be a set within any consistent set theory including NBG.

  2. The set of all natural numbers is a set. It is well-defined and does not lead to any paradoxes within NBG set theory. Furthermore, it is an element of the class of all sets.

  3. The class of all ordinal numbers is a proper class because it is too large to be a set. If it were a set, it would lead to contradictions similar to those arising from considering the "set of all sets."

ExerciseRussel's Paradox is fixed by introducing more strict set axioms to the...

Russel's Paradox is fixed by introducing more strict set axioms to the set theory. In NBG theory, a proper class is defined as a top-level class that cannot be subclass of any other classes or sets, and this is the key to avoid the paradox in naive set theory. Explain in details that how this concept avoids the case in Russel's Paradox.

SolutionWith the introduction of the concept of classes, we can discuss...

With the introduction of the concept of classes, we can discuss collections that are too large to be considered as sets, such as the "class of all sets." Therefore, the set described by Russell's Paradox, denoted by RR, is no longer considered a legitimate set but rather a "proper class." This means that we refrain from discussing RR as a set, thereby avoiding the paradox because proper classes are not subject to the operations and axioms that constrain sets. As a result, the axiomatic system does not permit the formation of sets that would lead to Russell's Paradox.

ExerciseLet A, B, C be classes such that A B, B C, C A

Let A,B,CA,B,C be classes such that A⊆B,B⊆CA\subseteq B,B\subseteq C, C⊆A.C\subseteq A. Prove that A=B=C.A=B=C.

ExerciseLet A, B, C be classes such that A B, B C

Let A,B,CA,B,C be classes such that A⊂B,B⊂C.A\subset B,B\subset C. Prove that A⊂C.A\subset C.

Below are exercises for binary relation.

Representation of Relations

In last section. we discussed binary relation and their properties. This section focuses on ways of representation. Symbolic language is accurate and not prone to make misunderstanding, yet it is not quite easy to understand to human minds. Therefore, we need straightforward ways to visualize them and assure the accuracy in the same time.

Representation By Matrix

The first commonly used method is matrix. A relation between finite sets can be represented using a zero-one matrix. Suppose that RR is a relation from A={a1,a2,…,am}A=\{a_1,a_2,\ldots,a_m\} to B={b1,b2,…,bn}.B=\{b_1,b_2,\ldots,b_n\}. (Here the elements of the sets AA and BB have been listed in a particular, but arbitrary, order. Furthermore, when A=BA=B we use the same ordering for AA and B.)B.) The relation RR can be represented by the matrix MR=[mij]\mathbf{M}_R=[m_{ij}], where

mij={1 if(ai,bj)∈R,0 if(ai,bj)∉R.m_{ij}=\left\{\begin{matrix}1\text{ if}(a_i,b_j)\in R,\\0\text{ if}(a_i,b_j)\notin R.\end{matrix}\right.
ExampleConsider the binary relation R on the set X = 1, 2, 3 defined by the...

Consider the binary relation RR on the set X={1,2,3}X = \{1, 2, 3\} defined by the pairs R={(1,2),(2,3),(3,1)}R = \{(1, 2), (2, 3), (3, 1)\}. We can represent RR as a matrix MM where the entry mijm_{ij} is 1 if (i,j)∈R(i, j) \in R and 0 otherwise. Thus, the matrix MM representing RR is given by:

M=[010001100]M = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix}

This matrix shows that there is a relation from 1 to 2, 2 to 3, and 3 to 1, as indicated by the ones in the matrix.

What about some other special relations? Here are more examples.

Reflexive Relations in Matrix

We defined reflexivity through the diagonal of a relation matrix. A relation on a set is reflexive if and only if every diagonal entry miim_{ii} is 11. The off-diagonal entries may be chosen independently, so a reflexive relation need not be the identity relation.

ExampleA reflexive relation on a set X = 1, 2, 3 requires that every element...

A reflexive relation on a set X={1,2,3}X = \{1, 2, 3\} requires that every element is related to itself. Thus, for the relation RR to be reflexive, it must include the pairs R={(1,1),(2,2),(3,3)}R = \{(1, 1), (2, 2), (3, 3)\} at minimum. The matrix MM representing such a reflexive relation RR is given by:

M=[1abc1def1]M = \begin{bmatrix} 1 & a & b \\ c & 1 & d \\ e & f & 1 \end{bmatrix}

Here, the diagonal elements of the matrix are all set to 1, reflecting the reflexive property that each element is related to itself. This diagonal structure is reminiscent of an identity matrix, where all diagonal elements are 1, and all off-diagonal elements are 0. In the context of relations, the presence of 1s on the diagonal is crucial for reflexivity. However, the values of a,b,c,d,e,a, b, c, d, e, and ff (the off-diagonal elements) do not influence the reflexivity of the relation and can be either 0 or 1. This highlights that while the matrix representing a reflexive relation must have 1s along its diagonal, it does not necessarily need to be an identity matrix.

Symmetric/Antisymmetric/Asymmetry Relation in Matrix

For a symmetric relation, (a,b)∈R(a,b)\in R if and only if (b,a)∈R(b,a)\in R. In its matrix, this means mij=mjim_{ij}=m_{ji}, or equivalently M=MTM=M^T. Symmetry does not require the diagonal entries to be 11; that additional condition belongs to reflexivity.

ExampleA relation R on a set X = 1, 2, 3 is symmetric if for any two elements...

A relation RR on a set X={1,2,3}X = \{1, 2, 3\} is symmetric if for any two elements aa and bb in XX, whenever (a,b)∈R(a, b) \in R, then (b,a)(b, a) is also in RR. Consider the symmetric relation RR defined by the pairs R={(1,1),(3,3),(1,2),(2,1)}R = \{(1, 1), (3, 3), (1, 2), (2, 1)\}. The matrix MM representing this symmetric relation RR is given by:

M=[110100001]M = \begin{bmatrix} 1 & 1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 1 \end{bmatrix}

In this matrix, the entries are symmetric about the main diagonal. The presence of 11 at positions (1,2)(1,2) and (2,1)(2,1) illustrates the symmetric nature of the relation, as both (1,2)(1,2) and (2,1)(2,1) are included in RR.

A reflexive relation, on the other hand, requires that each element be related to itself, leading to 11s along the main diagonal of its matrix. In the example above, the relation is not reflexive because it does not contain (2,2)(2, 2).

Although both reflexive and symmetric properties concern the main diagonal, they describe different aspects of a relation:

  • Reflexivity is about individual elements being self-connected, evidenced by 11s on the diagonal.

  • Symmetry involves pairs of elements and requires that if an element aa is related to an element bb, then bb must also be related to aa, leading to a mirrored symmetry across the diagonal.

A relation can be both reflexive and symmetric but does not need to be one to be the other. For instance, a purely symmetric relation need not include self-pairs like (1,1)(1, 1) unless it is also intended to be reflexive.

An antisymmetric relation on a set XX involves a specific condition: for any two distinct elements α\alpha and bb in XX,if both (a,b)(a,b) and (b,a)(b,a) are in the relation RR, then α\alpha must be equal to bb. This means that if a≠a\neq bb,it cannot be the case that both (a,b)(a,b) and (b,a)(b,a) are in RR.In terms of matrix representation:

ExampleConsider the set X = 1, 2, 3 and define the relation R on X by the...

Consider the set X={1,2,3}X = \{1, 2, 3\} and define the relation RR on XX by the pairs R={(1,2),(2,3),(3,3)}R = \{(1, 2), (2, 3), (3, 3)\}. This relation is antisymmetric, which we can observe through its matrix representation. The matrix MM representing the relation RR is given by:

M=[010001001]M = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 1 \end{bmatrix}

In this matrix, note the following:

  • The entry m12=1m_{12} = 1 (relation from 1 to 2), and m21=0m_{21} = 0 (no relation from 2 to 1), satisfying the antisymmetric condition.

  • Similarly, m23=1m_{23} = 1 and m32=0m_{32} = 0.

  • The diagonal entry m33=1m_{33} = 1 does not violate antisymmetry as self-relations do not affect antisymmetry.

Antisymmetric relations allow entries on the main diagonal (self-relations) but restrict how elements can relate symmetrically off the diagonal, ensuring that if one direction is permitted, the opposite is not unless they are the same element.

An asymmetric relation is a stronger form of an antisymmetric relation. A relation RR on a set XX is asymmetric if, for any elements aa and bb in XX,whenever (a,b)(a,b) is in RR, then (b,a)(b,a) cannot be in RR. This implies that if one direction between two different elements is allowed, the opposite direction is strictly forbidden, making it impossible for both (a,b)(a,b) and (b,a)(b,a) to exist in RR for any a≠b.a\neq b.

ExampleConsider the set X = 1, 2, 3 and define an asymmetric relation R on X...

Consider the set X={1,2,3}X = \{1, 2, 3\} and define an asymmetric relation RR on XX by including the pairs R={(1,2),(2,3)}R = \{(1, 2), (2, 3)\}. This relation is asymmetric as it does not contain both (a,b)(a, b) and (b,a)(b, a) for any aa and bb in XX. The matrix MM representing this relation RR is given by:

M=[010001000]M = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}

In this matrix: - The entry m12=1m_{12} = 1 and m21=0m_{21} = 0, supporting the asymmetric nature by the absence of the reverse relation. - The entry m23=1m_{23} = 1 and m32=0m_{32} = 0, further demonstrating asymmetry.

This matrix shows no reciprocal relations between different elements, which is a defining characteristic of asymmetric relations. Note that self-relations (diagonal entries) are not present in this matrix, aligning with the strict definition of asymmetry which typically excludes self-relations as well.

Operation of Relation Matrix

We can find intersection or union of two relations easily by examining their matrices. This could be done by comparing each element with the same index one by one.

ExampleLet A = bmatrix 0 & 1 & 0 0 & 0 & 1 0 & 0 & 0 bmatrix and B = bmatrix...

Let A=[010001000]A = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix} and B=[110000100]B = \begin{bmatrix} 1 & 1 & 0 \\ 0 & 0 & 0 \\ 1 & 0 & 0 \end{bmatrix} be two relations.

The union A∪BA \cup B is:

A∪B=[110001100]A \cup B = \begin{bmatrix} 1 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 0 \end{bmatrix}

The intersection A∩BA \cap B is:

A∩B=[010000000]A \cap B = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 0 \\ 0 & 0 & 0 \end{bmatrix}

Matrix is also possible to represent composition of relations. For these relations, in particular, suppose that RR is a relation from AA to BB and SS is a relation from BB to CC. Suppose that AA, BB, and CC have mm, nn, and pp elements, respectively. Let the zero-one matrices for S∘RS \circ R, RR, and SS be MS∘R=[tij]M_{S \circ R} = [t_{ij}], MR=[rij]M_R = [r_{ij}], and MS=[sij]M_S = [s_{ij}], respectively (these matrices have sizes m×pm \times p, m×nm \times n, and n×pn \times p, respectively). The ordered pair (ai,cj)(a_i, c_j) belongs to S∘RS \circ R if and only if there is an element bkb_k such that (ai,bk)(a_i, b_k) belongs to RR and (bk,cj)(b_k, c_j) belongs to SS. It follows that tij=1t_{ij} = 1 if and only if rik=skj=1r_{ik} = s_{kj} = 1 for some kk. From the definition of the Boolean product, this means that

MS∘R=MR⊗MS.M_{S \circ R} = M_R \otimes M_S.
ExampleMR = 1 & 0 & 1 1 & 1 & 0 0 & 0 & 0 and MS =
MR=[101110000]andMS=[010001101].M_R = \begin{bmatrix} 1 & 0 & 1 \\ 1 & 1 & 0 \\ 0 & 0 & 0 \\ \end{bmatrix} \quad \text{and} \quad M_S = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 1 & 0 & 1 \\ \end{bmatrix}.
SolutionThe matrix for S R is obtained by performing the Boolean product of MR...

The matrix for S⊗RS \otimes R is obtained by performing the Boolean product of MRM_R and MSM_S. This operation is similar to matrix multiplication, except that addition is replaced by the logical OR operation, and multiplication is replaced by the logical AND operation. The result is a matrix that represents the composition of the two relations:

MS∘R=MR⊗MS=[111011000].M_{S \circ R} = M_R \otimes M_S = \begin{bmatrix} 1 & 1 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 0 \\ \end{bmatrix}.

Each entry in MS∘RM_{S \circ R} is computed by taking the logical OR of the ANDs of the corresponding row from MRM_R and the column from MSM_S.

Examplewhere the matrix representing R is MR = 0 & 1 & 0

where the matrix representing RR is

MR=[010011100].M_R = \begin{bmatrix} 0 & 1 & 0 \\ 0 & 1 & 1 \\ 1 & 0 & 0 \\ \end{bmatrix}.
SolutionThe matrix for R^2 is found by taking the Boolean product of MR with...

The matrix for R2R^2 is found by taking the Boolean product of MRM_R with itself. This operation is analogous to squaring a matrix, where we use Boolean algebra for addition and multiplication:

MR2=MR[2]=[011111010].M_{R_2} = M_{R}^{[2]} = \begin{bmatrix} 0 & 1 & 1 \\ 1 & 1 & 1 \\ 0 & 1 & 0 \\ \end{bmatrix}.

The entries of MR2M_{R_2} indicate whether there is a path of length 2 between the nodes represented by the matrix indices in the relation RR.

Representation By Digraph

The other way to visualize relation is by using Directed Graph, or Digraph.

DefinitionDirected Graphs

A digraph or directed graph is an ordered pair G=(V,A)G = (V, A) comprising:

  • A non-empty set VV, whose elements are called vertices or nodes.

  • A set AA of ordered pairs of vertices, called arcs, directed edges, arrows, or directed lines.

The directed edge (x,y)∈A(x, y) \in A is said to point from the vertex xx to the vertex yy. Unlike in an undirected graph, the edges in a digraph have a direction associated with them, indicated by the ordering of the vertices in the pair.

We will discuss further on graph in graph theory, now we just need to know that we will use it to visualize relation. A directed graph can be used to represent a binary relation between a set of elements. Here is an example.

ExampleLet set A = a, b, c, B = a, d, the relation R=(a, a), (a, d), (b, a),...

Let set A={a,b,c},B={a,d}A = \{a,b,c\}, B = \{a,d\}, the relation

R={(a,a),(a,d),(b,a),(c,a),(c,d)}R=\{(a,a),(a,d), (b,a),(c,a),(c,d)\}

could be represented by the following graph.

Digraph representation of the relation from A to B.

Using Digraph is a very intuitive approach to visualize relation. In the graph, we use the element in the domain and codomain of the relation as vertex, and the relations are represented using the edges, which are also ordered pairs.

Using a graph is also easy to determine special patterns of relations such as reflexivity, symmetry, etc.

ExampleConsider the relation defined from set A=a, b, c to itself, R = (a,...

Consider the relation defined from set A={a,b,c}A=\{a,b,c\} to itself, R={(a,a),(b,b),(c,c),(b,a)}R = \{(a,a),(b,b),(c,c),(b,a)\}. This relation could be visualized by the following graph, which is reflexive.

A digraph of a reflexive relation.

We see that each object has a loop for a reflexive relation.

ExampleConsider the relation defined from set A=a, b, c to itself, R1 = (a,...

Consider the relation defined from set A={a,b,c}A=\{a,b,c\} to itself, R1={(a,b),(b,a)(a,c),(c,a)}R_1 = \{(a,b),(b,a)(a,c),(c,a)\}, and R2={(a,a),(b,b)(c,c),(a,b),(b,c)}R_2=\{(a,a),(b,b)(c,c),(a,b),(b,c) \}. This relation could be visualized by the following graphs.

The symmetric relation R_1 and antisymmetric relation R_2 as digraphs.

R1R_1 is symmetric because every edge between distinct objects has a matching edge in the opposite direction. R2R_2 is antisymmetric because the only pairs that occur in both directions are self-loops, although it may contain one-way edges between distinct objects.

For the cases of transitivity, it's also quite clear in the following example.

ExampleStill consider the same set A and the relation R1 = (a, b), (b, c),...

Still consider the same set AA and the relation R1={(a,b),(b,c),(a,c)},R2={(a,a),(a,b),(b,b)}R_1 = \{(a,b), (b,c), (a,c)\}, R_2 = \{(a,a), (a,b),(b,b)\}.

Two transitive relations as directed graphs.

Both R1R_1 and R2R_2 are transitive. For R2R_2, transitivity follows in particular from the reflexive loops on aa and bb. A relation that is reflexive, symmetric, and transitive is an equivalence relation, which we discuss next.

Exercises

ExerciseList the ordered pairs in the relations on 1, 2, 3, 4 corresponding to...

List the ordered pairs in the relations on {1,2,3,4}\{1, 2, 3, 4\} corresponding to these matrices (where the rows and columns correspond to the integers listed in increasing order).

a)[1101101001111011]b)[1110010000111001]c)[0101101001011010]\text{a)} \begin{bmatrix} 1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 \\ \end{bmatrix} \text{b)} \begin{bmatrix} 1 & 1 & 1 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 1 \\ 1 & 0 & 0 & 1 \\ \end{bmatrix} \text{c)} \begin{bmatrix} 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ 0 & 1 & 0 & 1 \\ 1 & 0 & 1 & 0 \\ \end{bmatrix}
SolutionSince the (1, 1)^th entry is a 1, (1, 1) is in the relation
  1. Since the (1,1)th(1,1)^{th} entry is a 11, (1,1)(1,1) is in the relation. Since (1,3)th(1,3)^{th} entry is a 00, (1,3)(1,3) is not in the relation. Continuing in this manner, we see that the relation contains (1,1)(1,1), (1,2)(1,2), (1,4)(1,4), (2,1)(2,1), (2,3)(2,3), (3,2)(3,2), (3,3)(3,3), (3,4)(3,4), (4,1)(4,1), (4,3)(4,3), and (4,4)(4,4).

  2. The relation contains (1,1)(1,1), (1,2)(1,2), (1,3)(1,3), (2,2)(2,2), (3,3)(3,3), (3,4)(3,4), (4,1)(4,1), and (4,4)(4,4).

  3. The relation contains (1,2)(1,2), (1,4)(1,4), (2,1)(2,1), (2,3)(2,3), (3,2)(3,2), (3,4)(3,4), (4,1)(4,1), and (4,3)(4,3).

ExerciseRepresent each of these relations on 1, 2, 3, 4 with a matrix (with...

Represent each of these relations on {1,2,3,4}\{1, 2, 3, 4\} with a matrix (with the elements of this set listed in increasing order).

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

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

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

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

SolutionThe relations corresponding to these matrices (from a to d) are

The relations corresponding to these matrices (from a to d) are:

[0111001100010000][1001010000101000][0111101111011110][0000000111010000]\begin{bmatrix} 0 & 1 & 1 & 1 \\ 0 & 0 & 1 & 1 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} 0 & 1 & 1 & 1 \\ 1 & 0 & 1 & 1 \\ 1 & 1 & 0 & 1 \\ 1 & 1 & 1 & 0 \end{bmatrix} \begin{bmatrix} 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 1 & 1 & 0 & 1 \\ 0 & 0 & 0 & 0 \end{bmatrix}
ExerciseHow many nonzero entries does the matrix representing the relation R...

How many nonzero entries does the matrix representing the relation RR on A={1,2,3,...,1000}A = \{1, 2, 3, ..., 1000\} consisting of the first 1000 positive integers have if RR is

  1. {(a,b)∣a≤b}\{(a, b) \mid a \leq b\}?

  2. {(a,b)∣a=b±1}\{(a, b) \mid a = b \pm 1\}?

  3. {(a,b)∣a+b=1000}\{(a, b) \mid a + b = 1000\}?

  4. {(a,b)∣a+b≤1001}\{(a, b) \mid a + b \leq 1001\}?

  5. {(a,b)∣a≠0}\{(a, b) \mid a \neq 0\}?

SolutionNote that the total number of entries in the matrix is 1000^2 = 1,...

Note that the total number of entries in the matrix is 10002=1,000,0001000^2 = 1,000,000.

  1. There is a 11 in the matrix for each pair of distinct positive integers not exceeding 10001000, namely in position (a,b)(a, b) where a≤ba \leq b, as well as 11's along the diagonal. Thus the answer is the number of subsets of size 22 from a set of 10001000 elements, plus 10001000, i.e., C(1000,2)+1000=499500+1000=500,500C(1000, 2) + 1000 = 499500 + 1000 = 500,500.

  2. There two 11's in each row of the matrix except the first and last rows, in which there is one 11. Therefore the answer is 998⋅2+2=1998998 \cdot 2 + 2 = 1998.

  3. There is a 11 in the matrix at each entry just above and to the left of the "anti-diagonal" (i.e., in positions (1,999),(2,998),...,(999,1)(1, 999), (2, 998), ..., (999, 1). Therefore the answer is 999999.

  4. There is a 11 in the matrix at each entry on or above (to the left of) the "anti-diagonal." This is the same number of 11's as in part (a), so the answer is again 500,500500,500.

  5. The condition is trivially true (since 1≤a≤10001 \leq a \leq 1000), so all 1,000,0001,000,000 entries are 11.

ExerciseDraw the directed graph that represents the relation (a, a), (a, b),...

Draw the directed graph that represents the relation

{(a,a),(a,b),(b,c),(c,b),(c,d),(d,a),(d,b).}\{(a, a), (a, b), (b, c), (c, b), (c, d), (d, a), (d, b).\}

Directed graph for the relation in the exercise.

ExerciseLet R be a relation on a set A

Let RR be a relation on a set AA. Explain how to use the directed graph representing RR to obtain the directed graph representing the complementary relation R‾\overline{R}.

SolutionFor each pair (a, b) of vertices (including the pairs (a, a) in which...

For each pair (a,b)(a, b) of vertices (including the pairs (a,a)(a, a) in which the two vertices are the same), if there is an edge from aa to bb, then erase it, and if there is no edge from aa to bb, put add it in.

ExerciseGiven the directed graphs representing two relations, how can the...

Given the directed graphs representing two relations, how can the directed graph of the union, intersection, symmetric difference, difference, and composition of these relations be found?

SolutionWe assume that the two relations are on the same set

We assume that the two relations are on the same set. For the union, we simply take the union of the directed graphs, i.e., take the directed graph on the same vertices and put in an edge from ii to jj whenever there is an edge from ii to jj in either of them. For intersection, we simply take the intersection of the directed graphs, i.e., take the directed graph on the same vertices and put in an edge from ii to jj whenever there are edges from ii to jj in both of them. For symmetric difference, we simply take the symmetric difference of the directed graphs, i.e., take the directed graph on the same vertices and put in an edge from ii to jj whenever there is an edge from ii to jj in one, but not both, of them. Similarly, to form the difference, we take the difference of the directed graphs, i.e., take the directed graph on the same vertices and put in an edge from ii to jj whenever there is an edge from ii to jj in the first but not the second. To form the directed graph for the composition S∘RS \circ R of relations RR and SS, we draw a directed graph on the same set of vertices and put in an edge from ii to jj whenever there is a vertex kk such that there is an edge from ii to kk in RR, and an edge from kk to jj in SS.

Closure of Relations

Section Pending Migration / Draft Placeholder

This section on relation closures (reflexive closure, symmetric closure, and transitive closure via Warshall's algorithm) is an outline placeholder from the original lecture notes, queued for complete exposition and proofs.

Equivalence Relations

In mathematics, an equivalence relation is a special type of binary relation that allows us to group elements of a set into disjoint subsets called equivalence classes. The idea behind equivalence relations is to capture a meaningful notion of "sameness" or "interchangeability" among elements.

Equivalence relations are characterized by three key properties: reflexivity, symmetry, and transitivity. These properties ensure that the relation partitions the set into equivalence classes, each containing elements that are equivalent in some sense.

Equivalence

DefinitionEquivalence Relations

A relation on a set AA is called an equivalence relation if it is reflexive, symmetric, and transitive. Two elements aa and bb that are related by an equivalence relation are called equivalent. The notation a∼ba\sim b is often used to denote that aa and bb are equivalent elements with respect to a particular equivalence relation.

The concept of equivalence relations is a fundamental tool in many branches of mathematics. They allow us to focus on essential characteristics that elements share, abstracting away extraneous details. Some common examples include:

  • Equality of numbers

  • Congruence modulo nn in number theory

  • Similarity of triangles in geometry

  • Having the same cardinality for sets

Equivalence relations provide a way to decompose a set into a collection of equivalence classes, revealing important structural insights. They are essential for understanding quotient structures, modular arithmetic, and the role of abstraction in mathematical thought.

ExampleLet m be an integer with m > 1

Let mm be an integer with m>1m > 1. Show that the relation

R={(a,b)∣a≡b (mod m)}R = \{(a, b) \mid a \equiv b \ (\mathrm{mod} \ m)\}

is an equivalence relation on the set of integers.

SolutionRecall from Section 4

Recall from Section 4.1 that a≡b (mod m)a \equiv b \ (\mathrm{mod} \ m) if and only if mm divides a−ba - b. Note that a−a=0a - a = 0 is divisible by mm, because 0=0⋅m0 = 0 \cdot m. Hence, a≡a (mod m)a \equiv a \ (\mathrm{mod} \ m), so congruence modulo mm is reflexive.

Now suppose that a≡b (mod m)a \equiv b \ (\mathrm{mod} \ m). Then a−ba - b is divisible by mm, so a−b=kma - b = km, where kk is an integer. It follows that b−a=(−k)mb - a = (-k)m, so b≡a (mod m)b \equiv a \ (\mathrm{mod} \ m). Hence, congruence modulo mm is symmetric.

Next, suppose that a≡b (mod m)a \equiv b \ (\mathrm{mod} \ m) and b≡c (mod m)b \equiv c \ (\mathrm{mod} \ m). Then mm divides both a−ba - b and b−cb - c. Therefore, there are integers kk and ll with a−b=kma - b = km and b−c=lmb - c = lm. Adding these two equations shows that a−c=(a−b)+(b−c)=km+lm=(k+l)ma - c = (a - b) + (b - c) = km + lm = (k + l) m. Thus, a≡c (mod m)a \equiv c \ (\mathrm{mod} \ m). Therefore, congruence modulo mm is transitive.

It follows that congruence modulo mm is an equivalence relation.

ExampleLet A be a non-empty set, and define a relation on the power set P(A)...

Let AA be a non-empty set, and define a relation ∼\sim on the power set P(A)\mathcal{P}(A) (the set of all subsets of AA) as follows: for any subsets X,Y⊆AX, Y \subseteq A,

X∼Y  ⟺  ∣X∣=∣Y∣X \sim Y \iff |X| = |Y|

where ∣X∣|X| denotes the cardinality (number of elements) of the set XX. In other words, two subsets are related by ∼\sim if and only if they have the same number of elements.

SolutionWe can show that the relation defined above is an equivalence relation...

We can show that the relation ∼\sim defined above is an equivalence relation on P(A)\mathcal{P}(A):

  1. Reflexivity: For any subset X⊆AX \subseteq A, we have ∣X∣=∣X∣|X| = |X|, so X∼XX \sim X.

  2. Symmetry: If X∼YX \sim Y, then ∣X∣=∣Y∣|X| = |Y|. Since equality of cardinalities is symmetric, we also have ∣Y∣=∣X∣|Y| = |X|, so Y∼XY \sim X.

  3. Transitivity: If X∼YX \sim Y and Y∼ZY \sim Z, then ∣X∣=∣Y∣|X| = |Y| and ∣Y∣=∣Z∣|Y| = |Z|. By the transitivity of equality, we have ∣X∣=∣Z∣|X| = |Z|, so X∼ZX \sim Z.

The equivalence classes under this relation are called cardinality classes. For a subset X⊆AX \subseteq A, its cardinality class [X][X] consists of all subsets of AA that have the same cardinality as XX:

[X]=Y⊆A∣∣Y∣=∣X∣[X] = {Y \subseteq A \mid |Y| = |X|}

In other words, the cardinality classes partition P(A)\mathcal{P}(A) into disjoint subsets based on the number of elements in each subset. For example, if A=1,2,3A = {1, 2, 3}, then the cardinality classes are:

  • [∅]=∅[\emptyset] = { \emptyset } (subsets with 0 elements)

  • [1]=1,2,3[{1}] = {{1}, {2}, {3}} (subsets with 1 element)

  • [1,2]=1,2,1,3,2,3[{1, 2}] = {{1, 2}, {1, 3}, {2, 3}} (subsets with 2 elements)

  • [A]=A[A] = {A} (subsets with 3 elements)

This equivalence relation captures the idea that two sets are "equivalent" if they have the same cardinality, regardless of their specific elements. The study of cardinality and the relationships between sets of different sizes is a fundamental aspect of set theory and plays a crucial role in the development of modern mathematics, including the theory of infinite sets and the foundations of mathematics.

ExampleLet R be the relation on the set of real numbers such that xRy if and...

Let RR be the relation on the set of real numbers such that xRyxRy if and only if xx and yy are real numbers that differ by less than 1, that is, ∣x−y∣<1|x - y| < 1. Show that RR is not an equivalence relation.

SolutionR is reflexive because |x - x| = 0 < 1 whenever x in R

RR is reflexive because ∣x−x∣=0<1|x - x| = 0 < 1 whenever x∈Rx \in \mathbb{R}. RR is symmetric, for if xRyxRy, where xx and yy are real numbers, then ∣x−y∣<1|x - y| < 1, which tells us that ∣y−x∣=∣x−y∣<1|y - x| = |x - y| < 1, so that yRxyRx. However, RR is not an equivalence relation because it is not transitive. Take x=2.8x = 2.8, y=1.9y = 1.9, and z=1.1z = 1.1, so that ∣x−y∣=∣2.8−1.9∣=0.9<1|x - y| = |2.8 - 1.9| = 0.9 < 1, ∣y−z∣=∣1.9−1.1∣=0.8<1|y - z| = |1.9 - 1.1| = 0.8 < 1, but ∣x−z∣=∣2.8−1.1∣=1.7>1|x - z| = |2.8 - 1.1| = 1.7 > 1. That is, 2.8R1.92.8R1.9, 1.9R1.11.9R1.1, but not 2.8R1.12.8R1.1.

Equivalence Classes

We can dig deeper into equivalence by partitioning the set where the relation is built upon with respect to a member of the subset. We call this a Equivalence Class.

DefinitionEquivalence Classes

Let RR be an equivalence relation on a set A. The set of all elements that are related to an element aa of AA is called the equivalenceequivalence class of aa. The equivalence class of aa with respect to RR is denoted by [a]R[a]_R. When only one relation is under consideration, we can delete the subscript RR and write [a][a] for this equivalence class.

RemarkRepresentatives of Equivalence Classes

In set notation we have

[a]R={(a,s)∈R}.[a]_R = \{ (a,s) \in R\}.

For some member e∈[a]Re\in [a]_R, we call ee a representative of the equivalence class.

ExampleWhat is the equivalence class of an integer for the equivalence...

What is the equivalence class of an integer for the equivalence relation a=∣b∣a = |b|?

SolutionSince a = b or a = -b, so [a] = -a, a, which holds for all integer,...

Since a=b or a=−ba = b \text{ or } a = -b, so [a]={−a,a}[a] = \{-a,a\}, which holds for all integer, including 0. We have [3]={−3,3}[3] = \{ -3, 3\}, etc.

ExampleWhat are the equivalence classes of 0 and 1 for congruence modulo 2?

What are the equivalence classes of 0 and 1 for congruence modulo 2?

SolutionThe equivalence class of 0 contains all integers a such that a == 0 mod 4

The equivalence class of 0 contains all integers aa such that a≡0(mod4)a \equiv 0 \pmod{4}. The integers in this class are those divisible by 4. Hence, the equivalence class of 0 for this relation is

[0]={…,−8,−4,0,4,8,…}.[0] = \{ \ldots, -8, -4, 0, 4, 8, \ldots \}.

The equivalence class of 1 contains all the integers aa such that a≡1(mod4)a \equiv 1 \pmod{4}. The integers in this class are those that have a remainder of 1 when divided by 4. Hence, the equivalence class of 1 for this relation is

[1]={…,−7,−3,1,5,9,…}.[1] = \{ \ldots, -7, -3, 1, 5, 9, \ldots \}.

This notion actually allows us to further abstract to congruence classes modulo mm.

DefinitionCongruence Classes Modulo an Integer

Let mm be a positive integer. The congruence class of an integer aa modulo mm, denoted by [a]m[a]_m, is the set of all integers bb such that b≡a (mod m)b \equiv a \ (\mathrm{mod} \ m), which means that mm divides b−ab - a. Formally, the congruence class [a]m[a]_m is defined as:

[a]m={b∈Z ∣ b≡a (mod m)}={b∈Z ∣ ∃k∈Z, b=a+km}.[a]_m = \{ b \in \mathbb{Z} \ | \ b \equiv a \ (\mathrm{mod} \ m) \} = \{ b \in \mathbb{Z} \ | \ \exists k \in \mathbb{Z}, \ b = a + km \}.

Here are some other examples on equivalence class.

ExampleFind the equivalence class for (1)/(2) under the relation of fraction...

Find the equivalence class for 12\frac{1}{2} under the relation of fraction simplification.

SolutionThe equivalence class of (1)/(2) consists of all fractions that...

The equivalence class of 12\frac{1}{2} consists of all fractions that simplify to 12\frac{1}{2}, which includes all rational numbers where the numerator is half the denominator. Hence, the equivalence class is:

[1/2]={24,36,48,510,…}[1/2] = \left\{ \frac{2}{4}, \frac{3}{6}, \frac{4}{8}, \frac{5}{10}, \ldots \right\}
ExampleFind the equivalence class for the string 'cat' under the relation of...

Find the equivalence class for the string "cat" under the relation of having the same length.

SolutionThe equivalence class of the string 'cat' consists of all strings of...

The equivalence class of the string "cat" consists of all strings of length 3. Examples include:

["cat"]={"dog","pen","sun","mom",…}[\text{"cat"}] = \{ \text{"dog"}, \text{"pen"}, \text{"sun"}, \text{"mom"}, \ldots \}

Congruence Class can be further interpreted by introducing partition of set. Recall (in definition def

) that the partition of a set are a possible combination of mutually disjoint subsets of a set. Suppose we have some set RR, than we can make form some three-member partition (P1∪P2∪P3)=R(P_1\cup P_2\cup P_3) = R, where P1,P2,P3,⊆RP_1,P_2,P_3,\subseteq R. Also we have ∣R∣=∣P1∣+∣P2∣+∣P3∣|R| = |P_1|+|P_2|+|P_3|. But notice that Pi∩Pj,i,j∈{1,2,3}P_i\cap P_j, i,j \in\{1,2,3\} is ∅\emptyset.

Now let's relate this to congruence class.

TheoremEquivalence Classes and Partitions

Let RR be an equivalence relation on a set AA. These statements for elements aa and bb of AA are equivalent:

(i):aRb(ii):[a]=[b](iii):[a]∩[b]≠∅(i):aRb\quad(ii):[a]=[b]\quad(iii):[a]\cap[b]\neq\emptyset

Proof

We first show that (i) implies (ii). Assume that aRbaRb. We will prove that [a]=[b][a] = [b] by showing [a]⊆[b][a] \subseteq [b] and [b]⊆[a][b] \subseteq [a]. Suppose c∈[a]c \in [a], where cc is any arbitrary member of [a][a]. Then aRcaRc. Because aRbaRb and RR is symmetric, we know that bRabRa. Furthermore, because RR is transitive and bRabRa and aRcaRc, it follows that bRcbRc. Hence, c∈[b]c \in [b]. This shows that [a]⊆[b][a] \subseteq [b], since all elements of [a][a] is also an element of [b][b]. The proof that [b]⊆[a][b] \subseteq [a] is similar.

Second, we will show that (ii) implies (iii). Assume that [a]=[b][a] = [b]. It follows that [a]∩[b]≠∅[a] \cap [b] \neq \emptyset because [a][a] is nonempty (because a∈[a]a \in [a] since RR is reflexive).

Next, we will show that (iii) implies (i). Suppose that [a]∩[b]≠∅[a] \cap [b] \neq \emptyset. Then there is an element cc with c∈[a]c \in [a] and c∈[b]c \in [b]. In other words, aRcaRc and bRcbRc. By the symmetric property, cRbcRb. Then by transitivity, because aRcaRc and cRbcRb, we have aRbaRb.

Because (i) implies (ii), (ii) implies (iii), and (iii) implies (i), the three statements, (i), (ii), and (iii), are equivalent.

Let RR be an equivalence relation on a set AA. The union of the equivalence classes is the whole set AA, because an element a of AA is in its own equivalence class, and distinct classes are disjoint (different elements may belong to the same class). ⋃a∈A[a]R=A.\bigcup_{a\in A}[a]_R=A. This is because from theorem one we have

LemmaDistinct Equivalence Classes Are Disjoint

If [a]R≠[b]R[a]_R \neq [b]_R, then [a]R∩[b]R=∅.[a]_R\cap[b]_R=\emptyset.

If the intersection were nonempty, the preceding equivalence would force the classes to be equal, contradicting the hypothesis. This is the contrapositive of nonempty intersection implying equal classes.

DefinitionPartition

A partition of SS is an indexed family of nonempty subsets AiA_i such that Ai∩Aj=∅A_i\cap A_j=\emptyset for distinct indices and

⋃i∈IAi=S.\bigcup_{i \in I}A_i = S.
ExampleLet A = Z, the set of all integers, and let R be the equivalence...

Let A=ZA = \mathbb{Z}, the set of all integers, and let RR be the equivalence relation of congruence modulo 33. Determine if the following statements are true:

  1. 1R41R4

  2. [1]=[4][1] = [4]

  3. [1]∩[4]≠∅[1] \cap [4] \neq \emptyset

Solution1R4 is true because 4 == 1 mod 3 [1] = [4] is true because both 1 and...
  1. 1R41R4 is true because 4≡1mod  34 \equiv 1 \mod 3.

  2. [1]=[4][1] = [4] is true because both 11 and 44 have the same remainder when divided by 33, which means they are in the same equivalence class modulo 33.

  3. [1]∩[4]≠∅[1] \cap [4] \neq \emptyset is true because [1][1] contains 44 since 4≡1mod  34 \equiv 1 \mod 3, hence 44 is in both [1][1] and [4][4].

As all three statements are true, the statements (i), (ii), and (iii) are equivalent for the given equivalence relation.

An equivalence relation cuts a set into classes. Congruence modulo three partitions all integers into three disjoint equivalence classes.

An equivalence relation cuts a set into classes. Congruence modulo three partitions all integers into three disjoint equivalence classes.

Congruence modulo three partitions all integers into three disjoint equivalence classes.

Exercises

ExerciseDetermine the equivalence class of 2 under the relation of congruence...

Determine the equivalence class of 22 under the relation of congruence modulo 55.

SolutionThe equivalence class of 2 modulo 5, denoted [2]5, consists of all...

The equivalence class of 22 modulo 55, denoted [2]5[2]_5, consists of all integers that leave a remainder of 22 when divided by 55. This can be expressed as:

[2]5={…,−8,−3,2,7,12,…}[2]_5 = \{ \ldots, -8, -3, 2, 7, 12, \ldots \}

where each element is of the form 2+5k2 + 5k for some integer kk.

ExerciseLet S be the equivalence relation on P(1, 2, 3, 4) defined by X Y if...

Let SS be the equivalence relation on P({1,2,3,4})\mathcal{P}(\{1, 2, 3, 4\}) defined by

X∼Y if and only if ∣X∪{2}∣=∣Y∪{2}∣.X \sim Y \text{ if and only if } |X \cup \{2\}| = |Y \cup \{2\}|.

Write down the equivalence classes of SS.

SolutionTo find the equivalence classes of the relation S, we need to analyze...

To find the equivalence classes of the relation SS, we need to analyze how the sets X∪{2}X \cup \{2\} and Y∪{2}Y \cup \{2\} affect the cardinality and thus the equivalence.

Consider the power set P({1,2,3,4})\mathcal{P}(\{1, 2, 3, 4\}), which includes all subsets of {1,2,3,4}\{1, 2, 3, 4\}:

P({1,2,3,4})={∅,{1},{2},{3},{4},{1,2},{1,3},{1,4},{2,3},{2,4},{3,4},{1,2,3},{1,2,4},{1,3,4},{2,3,4},{1,2,3,4}}\begin{aligned} \mathcal{P}(\{1, 2, 3, 4\}) = & \{\emptyset, \{1\}, \{2\}, \{3\}, \{4\}, \{1, 2\}, \{1, 3\}, \{1, 4\}, \{2, 3\}, \{2, 4\}, \\ & \{3, 4\}, \{1, 2, 3\}, \{1, 2, 4\}, \{1, 3, 4\}, \{2, 3, 4\}, \{1, 2, 3, 4\}\} \end{aligned}

We need to group these sets into equivalence classes based on the criterion ∣X∪{2}∣=∣Y∪{2}∣|X \cup \{2\}| = |Y \cup \{2\}|.

  1. {∅,{2}}\{\emptyset, \{2\}\}
  • ∅∪{2}={2}\emptyset \cup \{2\} = \{2\}, ∣∅∪{2}∣=1|\emptyset \cup \{2\}| = 1

  • {2}∪{2}={2}\{2\} \cup \{2\} = \{2\}, ∣{2}∪{2}∣=1|\{2\} \cup \{2\}| = 1

  1. {{1},{3},{4},{1,2},{2,3},{2,4}}\{\{1\}, \{3\}, \{4\}, \{1, 2\}, \{2, 3\}, \{2, 4\}\}
  • {1}∪{2}={1,2}\{1\} \cup \{2\} = \{1, 2\}, ∣{1}∪{2}∣=2|\{1\} \cup \{2\}| = 2

  • {3}∪{2}={2,3}\{3\} \cup \{2\} = \{2, 3\}, ∣{3}∪{2}∣=2|\{3\} \cup \{2\}| = 2

  • {4}∪{2}={2,4}\{4\} \cup \{2\} = \{2, 4\}, ∣{4}∪{2}∣=2|\{4\} \cup \{2\}| = 2

  • {1,2}∪{2}={1,2}\{1, 2\} \cup \{2\} = \{1, 2\}, ∣{1,2}∪{2}∣=2|\{1, 2\} \cup \{2\}| = 2

  • {2,3}∪{2}={2,3}\{2, 3\} \cup \{2\} = \{2, 3\}, ∣{2,3}∪{2}∣=2|\{2, 3\} \cup \{2\}| = 2

  • {2,4}∪{2}={2,4}\{2, 4\} \cup \{2\} = \{2, 4\}, ∣{2,4}∪{2}∣=2|\{2, 4\} \cup \{2\}| = 2

  1. {{1,3},{1,4},{3,4},{1,2,3},{1,2,4},{2,3,4}}\{\{1, 3\}, \{1, 4\}, \{3, 4\}, \{1, 2, 3\}, \{1, 2, 4\}, \{2, 3, 4\}\}
  • {1,3}∪{2}={1,2,3}\{1, 3\} \cup \{2\} = \{1, 2, 3\}, ∣{1,3}∪{2}∣=3|\{1, 3\} \cup \{2\}| = 3

  • {1,4}∪{2}={1,2,4}\{1, 4\} \cup \{2\} = \{1, 2, 4\}, ∣{1,4}∪{2}∣=3|\{1, 4\} \cup \{2\}| = 3

  • {3,4}∪{2}={2,3,4}\{3, 4\} \cup \{2\} = \{2, 3, 4\}, ∣{3,4}∪{2}∣=3|\{3, 4\} \cup \{2\}| = 3

  • {1,2,3}∪{2}={1,2,3}\{1, 2, 3\} \cup \{2\} = \{1, 2, 3\}, ∣{1,2,3}∪{2}∣=3|\{1, 2, 3\} \cup \{2\}| = 3

  • {1,2,4}∪{2}={1,2,4}\{1, 2, 4\} \cup \{2\} = \{1, 2, 4\}, ∣{1,2,4}∪{2}∣=3|\{1, 2, 4\} \cup \{2\}| = 3

  • {2,3,4}∪{2}={2,3,4}\{2, 3, 4\} \cup \{2\} = \{2, 3, 4\}, ∣{2,3,4}∪{2}∣=3|\{2, 3, 4\} \cup \{2\}| = 3

  1. {{1,3,4},{1,2,3,4}}\{\{1, 3, 4\}, \{1, 2, 3, 4\}\}
  • {1,3,4}∪{2}={1,2,3,4}\{1, 3, 4\} \cup \{2\} = \{1, 2, 3, 4\}, ∣{1,3,4}∪{2}∣=4|\{1, 3, 4\} \cup \{2\}| = 4

  • {1,2,3,4}∪{2}={1,2,3,4}\{1, 2, 3, 4\} \cup \{2\} = \{1, 2, 3, 4\}, ∣{1,2,3,4}∪{2}∣=4|\{1, 2, 3, 4\} \cup \{2\}| = 4

Therefore, the equivalence classes are:

{∅,{2}},{{1},{3},{4},{1,2},{2,3},{2,4}},{{1,3},{1,4},{3,4},{1,2,3},{1,2,4},{2,3,4}},{{1,3,4},{1,2,3,4}}.\begin{aligned} &\{\emptyset, \{2\}\}, \\ &\{\{1\}, \{3\}, \{4\}, \{1, 2\}, \{2, 3\}, \{2, 4\}\}, \\ &\{\{1, 3\}, \{1, 4\}, \{3, 4\}, \{1, 2, 3\}, \{1, 2, 4\}, \{2, 3, 4\}\}, \\ &\{\{1, 3, 4\}, \{1, 2, 3, 4\}\}. \end{aligned}
ExerciseLet A = Z, and define R on A by xRy if and only if x - y is even

Let A=ZA = \mathbb{Z}, and define RR on AA by xRyxRy if and only if x−yx - y is even. Determine if the following statements are true for a=2a = 2 and b=5b = 5:

  1. aRbaRb

  2. [2]=[5][2] = [5]

  3. [2]∩[5]≠∅[2] \cap [5] \neq \emptyset

SolutionaRb is false because 2 - 5 is odd [2] = [5] is false because 2 is in...
  1. aRbaRb is false because 2−52 - 5 is odd.

  2. [2]=[5][2] = [5] is false because 22 is in the equivalence class of even remainders while 55 is in the class of odd remainders.

  3. [2]∩[5]≠∅[2] \cap [5] \neq \emptyset is false because [2][2] contains all even numbers and [5][5] contains all odd numbers, so they have no elements in common.

In this case, statements (i), (ii), and (iii) are not equivalent because the relation RR is not defined as congruence modulo some number but rather by the parity of the difference between elements.

No that we can get partition of a set from a equivalence relation, can we inverse this process? That is, define a equivalence relation with some given set partitions? The answer is yes.

To see this, assume that {Ai∣i∈I}\{A_i \mid i \in I\} is a partition on SS. Let RR be the relation on SS consisting of the pairs (x,y)(x, y), where xx and yy belong to the same subset AiA_i, in the partition. To show that RR is an equivalence relation we must show that RR is reflexive, symmetric, and transitive.

We see that (a,a)∈R(a, a) \in R for every a∈Sa \in S, because aa is in the same subset of SS as itself. Hence, RR is reflexive. If (a,b)∈R(a, b) \in R, then bb and aa are in the same subset of SS in the partition, so that (b,a)∈R(b, a) \in R as well. Hence, RR is symmetric. If (a,b)∈R(a, b) \in R and (b,c)∈R(b, c) \in R, then aa and bb are in the same subset XX of SS in the partition, and bb and cc are in the same subset YY of SS of the partition. Because the subsets of SS in the partition are disjoint and bb belongs to XX and YY, it follows that X=YX = Y. Consequently, aa and cc belong to the same subset of SS in the partition, so (a,c)∈R(a, c) \in R. Thus, RR is transitive.

It follows that RR is an equivalence relation. The equivalence classes of RR consist of subsets of SS containing related elements, and by the definition of RR, these are the subsets of SS in the partition. The theorem summarizes the connections we have established between equivalence relations and partitions.

TheoremEquivalence Classes Form a Partition

Let RR be an equivalence relation on a set SS. Then the equivalence classes of RR form a partition of SS. Conversely, given a partition {Ai∣i∈I}\{A_i \mid i \in I\} of the set SS, there is an equivalence relation RR that has the sets Ai,i∈IA_i, i \in I, as its equivalence classes.

Proof

Reflexivity puts each element into its own nonempty class. The preceding lemma makes distinct classes disjoint, and their union is all of SS, proving a partition. Conversely define xRyxRy when x,yx,y belong to the same partition block. Every element belongs to a block, proving reflexivity, and the definition is symmetric. If x,yx,y share a block and y,zy,z share another, their common element yy forces those blocks equal, proving transitivity. For x∈Aix\in A_i, exactly the elements of AiA_i are related to xx, so [x]R=Ai[x]_R=A_i. This also proves the two constructions undo each other.

ExampleFor example, consider the set S = 1, 2, 3, 4, 5, 6

For example, consider the set S={1,2,3,4,5,6}S = \{1, 2, 3, 4, 5, 6\}.

One possible equivalence relation RR on SS is "congruence modulo 3". This relation partitions SS into the equivalence classes [1]={1,4}[1] = \{1, 4\}, [2]={2,5}[2] = \{2, 5\}, and [3]={3,6}[3] = \{3, 6\}.

Conversely, consider a partition of SS into subsets A1={1,2}A_1 = \{1, 2\}, A2={3,4}A_2 = \{3, 4\}, and A3={5,6}A_3 = \{5, 6\}. The equivalence relation RR induced by this partition is such that two numbers are related if and only if they are in the same subset AiA_i.

Order Relations

Another important family is formed by order relations, including partial, total, and well orders. We begin with the most general notion, the partial order, and then specialize it.

Partial, Total, and Well Ordering

DefinitionPartial Orders and Posets

A relation RR on a set S is called a partial ordering or partial order if it is reflexive, antisymmetric, and transitive. A set SS together with a partial ordering RR is called a partial ordered set, or poset, and is denoted by (S,R)(S,R). Members of S are called elements of the poset.

RemarkNotation for Partial Orders

The reason why partial order relation has a specific notation for poset is because that order relation is usually defined on the same set(for the domain and codomain). For equivalence relation, however, we see more relation between different sets.

The most common partial order relation is "greater than or equal to", "is subset to", and "divides".

ExampleShow that the greater than or equal to relation >= is a partial...

Show that the greater than or equal to relation ≥\geq is a partial ordering on the set of integers.

Solution: Because a≥aa \geq a for every integer aa, ≥\geq is reflexive. If a≥ba \geq b and b≥ab \geq a, then a=ba = b. Hence, ≥\geq is antisymmetric. Finally, ≥\geq is transitive because a≥ba \geq b and b≥cb \geq c imply that a≥ca \geq c. It follows that ≥\geq is a partial ordering on the set of integers and (Z,≥)(\mathbb{Z}, \geq) is a poset.

ExampleThe divisibility relation | is a partial ordering on the set of...

The divisibility relation ∣| is a partial ordering on the set of positive integers, because it is reflexive, antisymmetric, and transitive, as was shown in Section 9.1. We see that (Z+,∣)(\mathbb{Z}^+, |) is a poset.

ExampleShow that the inclusion relation is a partial ordering on the power...

Show that the inclusion relation ⊆\subseteq is a partial ordering on the power set of a set SS.

Solution: Because A⊆AA \subseteq A whenever AA is a subset of SS, ⊆\subseteq is reflexive. It is antisymmetric because A⊆BA \subseteq B and B⊆AB \subseteq A imply that A=BA = B. Finally, ⊆\subseteq is transitive, because A⊆BA \subseteq B and B⊆CB \subseteq C imply that A⊆CA \subseteq C. Hence, ⊆\subseteq is a partial ordering on P(S)P(S), and (P(S),⊆)(P(S), \subseteq) is a poset.

For convenience of representation, we need a symbol to define the operator for an arbitrary partial ordering.

NotationPartial-Order Notation

≼\preccurlyeq is used to define any arbitrary partial order relation a≼ba \preccurlyeq b on set SS. Alternatively, we also have a≺ba \prec b to denote that a≼ba\preccurlyeq b but a≠ba \neq b.

With this, we can define comparability of the relation. This helps us to distinguish different types of special partial orderings.

DefinitionComparable Elements

The elements aa and bb of a poset (S, ≼)\preccurlyeq) are called comparable if either a≼ba\preccurlyeq b or b≼ab\preccurlyeq a. When aa and bb are elements of S such that neither a≼ba\preccurlyeq b nor b≼a,ab\preccurlyeq a,a and bb are called incomparable.

ExampleIn the poset ( Z^+, | ), are 3 and 9 comparable?

In the poset (Z+,∣)(\mathbb{Z}^+ ,\mid), are 3 and 9 comparable? Also consider 4 and 5.

Solution3 and 9 are obviously comparable, since even though 9 not| 3, we still...

3 and 9 are obviously comparable, since even though 9∤39 \nmid 3, we still have 3∣93 \mid 9. So 3 and 9 are comparable. While 4∤54\nmid 5 and 5∤45\nmid 4, so they are not comparable.

We see that for divisibility, there are cases that the relation is not comparable among the elements that are involved here. Actually this is why we call it partial order, because there are cases that things cannot be compared or cannot build relation. If we can have a very special partial ordering on SS that is comparable for every member of the set, we call it a total ordering or total order relation.

DefinitionTotal Orders

If (S,≼)(S, \preccurlyeq) is a poset and every two elements of SS are comparable, SS is called a totally ordered or linearly ordered set, and ≼\preccurlyeq is called a total order or a linear order. A totally ordered set is also called a chain.

Total ordering is also very quite familiar to us, actually, the ≤\leq relation we just mentioned is also a total order relation, and so as ≥\geq.

Here are some other examples.

ExampleThe set of words in a dictionary with the alphabetical order is a...

The set of words in a dictionary with the alphabetical order is a totally ordered set because any two words can be compared based on lexicographic order.

ExampleThe set of points on a line with a defined direction is a totally...

The set of points on a line with a defined direction is a totally ordered set, where any two points can be compared based on their position relative to each other along the line.

So we know that total orderings are special partial orderings. Now, can we manage to find a kind of special relation with respect to total ordering? The answer is yes, and we have actually known this relation, as it is the foundation of the principal of mathematical induction (theorem principle/induc).

DefinitionWell-Ordered Sets

The poset (S,≼)(S, \preccurlyeq) is a well-ordered set if ≼\preccurlyeq is total ordering and every nonempty subset of SS has a least element.

Here are some example of well-ordering.

ExampleThe set of natural numbers N with the usual order <= is not only a...

The set of natural numbers N\mathbb{N} with the usual order ≤\leq is not only a totally ordered set but also a well-ordered set because every non-empty subset of N\mathbb{N} has a smallest element.

CounterexampleA total order that is not a well-order

Let S={1/n:n∈N, n≥1}S=\{1/n:n\in\mathbb{N},\ n\geq 1\}. The usual order ≤\leq totally orders SS, but does not well-order it: the nonempty subset SS itself has no least element. For every 1/n∈S1/n\in S, the smaller element 1/(n+1)1/(n+1) also belongs to SS. Well-ordering of N\mathbb{N} guarantees least elements of nonempty subsets, not greatest elements.

ExampleThe set of positive integers up to 100, 1, 2, , 100, is well-ordered...

The set of positive integers up to 100, {1,2,…,100}\{1, 2, \ldots, 100\}, is well-ordered by the usual ≤\leq relation. Any non-empty subset has a minimum element since it is a finite subset of the well-ordered set N\mathbb{N}.

Well ordering secures that each step we made with mathematical induction is correct, since the least element allows us to define a solid base case, so that the rest of the statement could be proved one by one by applying our hypothesis, so that the inductive step could be proven. This could be encapsulated by the following theorem.

TheoremWell-Ordered Induction

Suppose that SS is a well-ordered set. Then P(x)P(x) is true for all x∈Sx \in S, if

Inductive Step: For every y∈Sy \in S, if P(x)P(x) is true for all x∈Sx \in S with x<yx < y, then P(y)P(y) is true.

Proof

Suppose it is not the case that P(x)P(x) is true for all x∈Sx \in S. Then there is an element y∈Sy \in S such that P(y)P(y) is false. Consequently, the set A={x∈S∣P(x) is false}A = \{ x \in S \mid P(x) \text{ is false} \} is nonempty. Because SS is well-ordered, AA has a least element aa. By the choice of aa as a least element of AA, we know that P(x)P(x) is true for all x∈Sx \in S with x<ax < a. This implies by the inductive step P(a)P(a) is true. This contradiction shows that P(x)P(x) must be true for all x∈Sx \in S.

RemarkThe Basis Step in Well-Ordered Induction

We do not need a basis step in a proof using the principle of well-ordered induction because if x0x_0 is the least element of a well-ordered set, the inductive step tells us that P(x0)P(x_0) is true. This follows because there are no elements x∈Sx \in S with x<x0x < x_0, so we know (using a vacuous proof) that P(x)P(x) is true for all x∈Sx \in S with x<x0x < x_0.

Lexicographic Order

In a dictionary, all words are ordered in alphabetical order by the first letter that is different from the other previous words. For example, we have this array of strings in alphabetical order: "a","abnormal","acknowledge","acquire",…\text{"a"}, \text{"abnormal"}, \text{"acknowledge"}, \text{"acquire"},\ldots. We can conceptualize this ordering in mathematics with a partial order relation, calling it lexicographic order.

The concept of lexicographic ordering can be extended beyond strings and applied to the Cartesian product of two posets. We formalize this concept as follows:

DefinitionLexicographic Ordering

Given two posets (A1,≼1)(A_1, \preccurlyeq_1) and (A2,≼2)(A_2, \preccurlyeq_2), the lexicographic ordering ≼\preccurlyeq on A1×A2A_1 \times A_2 compares first coordinates, and compares second coordinates only when the first coordinates are equal. Its strict part is

(a1,a2)≺(b1,b2)⟺a1≺1b1 or (a1=b1 and a2≺2b2).(a_1,a_2)\prec(b_1,b_2)\quad\Longleftrightarrow\quad a_1\prec_1 b_1\ \text{or}\ (a_1=b_1\ \text{and}\ a_2\prec_2 b_2).

We achieve a partial ordering ≼\preccurlyeq by combining this lexicographic ordering with equality. Here is how we verify it.

Proof

For reflexivity, every pair (a1,a2)(a_1,a_2) is related to itself because a1=a1a_1=a_1 and a2≼2a2a_2\preccurlyeq_2 a_2.

For antisymmetry, suppose both (a1,a2)≼(b1,b2)(a_1,a_2)\preccurlyeq(b_1,b_2) and (b1,b2)≼(a1,a2)(b_1,b_2)\preccurlyeq(a_1,a_2). If a1≠b1a_1\neq b_1, the strict first-coordinate alternatives would point in opposite directions, which is impossible. Hence a1=b1a_1=b_1. The definition then reduces to a2≼2b2a_2\preccurlyeq_2 b_2 and b2≼2a2b_2\preccurlyeq_2 a_2, so a2=b2a_2=b_2 by antisymmetry of ≼2\preccurlyeq_2.

For transitivity, if the first coordinates are strictly ordered, transitivity of ≼1\preccurlyeq_1 gives the required first-coordinate comparison. If the first coordinates are equal, the comparison is decided by the second coordinates, where transitivity of ≼2\preccurlyeq_2 applies. Thus the lexicographic relation is a partial order. It is total when both component orders are total.

ExampleConsider two posets, (A1, <= 1) where A1 = 1, 2 with the usual less...

Consider two posets, (A1,≤1)(A_1, \leq_1) where A1={1,2}A_1 = \{1, 2\} with the usual less than or equal relation, and (A2,≤2)(A_2, \leq_2) where A2={a,b}A_2 = \{a, b\} with a≤2ba \leq_2 b. The lexicographic order ≤\leq on A1×A2A_1 \times A_2 is given as follows:

For any two elements (a1,a2),(b1,b2)∈A1×A2(a_1, a_2), (b_1, b_2) \in A_1 \times A_2, we say that (a1,a2)≤(b1,b2)(a_1, a_2) \leq (b_1, b_2) if:

  1. a1<1b1a_1 <_1 b_1, or

  2. a1=b1a_1 = b_1 and a2≤2b2a_2 \leq_2 b_2.

For example, (1,a)≤(2,a)(1, a) \leq (2, a) because 1<121 <_1 2, and (2,a)≤(2,b)(2, a) \leq (2, b) because 2=22 = 2 and a≤2ba \leq_2 b. Thus, the pair (1,a)(1, a) is considered less than (2,b)(2, b) in the lexicographic ordering because the first element of the first pair (1) is less than the first element of the second pair (2), even though we do not compare the second elements in this case.

Hasse Diagram

Section Pending Migration / Draft Placeholder

This subsection on Hasse diagram construction and poset visualization is an outline placeholder from the original lecture notes.

Maximal and Minimal Elements

Section Pending Migration / Draft Placeholder

This subsection covering maximal, minimal, greatest, and least elements in partially ordered sets is queued for complete definitions and examples.

Lattices

Section Pending Migration / Draft Placeholder

This subsection covering lattice properties (meets, joins, and distributive lattices) is queued for authoring.

Topological Sorting

Section Pending Migration / Draft Placeholder

This subsection on topological sorting of finite posets and DAG scheduling algorithms is queued for authoring.

Exercises

The following exercises are on lexicographic ordering.

ExerciseDo some tricks to the result of the proof in definition lexord to make...

Do some tricks to the result of the proof in definition lexord to make it a well order relation.

SolutionThis could be solved without a second thought that we can make A1, A2...

This could be solved without a second thought that we can make A1,A2A_1,A_2 any sets with smallest element, such as Z1\Z_{1}, all integers greater than or equal 1.

ExerciseLet R be a binary relation on Z defined by xRy if and only if x < y or...

Let RR be a binary relation on Z\mathbb{Z} defined by

xRy if and only if x<y or x≡y(mod2).xRy \text{ if and only if } x < y \text{ or } x \equiv y \pmod{2}.

Is RR reflexive? Is RR symmetric? Is RR antisymmetric? Is RR transitive?

Fully justify each answer.

SolutionLet's analyze the properties of the relation R

Let's analyze the properties of the relation RR.

  • Reflexive: A relation RR on a set AA is reflexive if every element is related to itself, i.e., aRaaRa for all a∈Aa \in A.

    For any integer x∈Zx \in \mathbb{Z}, we have x≡x(mod2)x \equiv x \pmod{2}. Hence, xRxxRx holds for all x∈Zx \in \mathbb{Z}.

    Therefore, RR is reflexive.

  • Symmetric: A relation RR on a set AA is symmetric if aRbaRb implies bRabRa for all a,b∈Aa, b \in A.

    Consider the pair (2,3)(2, 3). We have 2R32R3 because 2<32 < 3. However, 3R̸23 \not R 2 because 3>23 > 2 and 3≢2(mod2)3 \not\equiv 2 \pmod{2}.

    Therefore, RR is not symmetric.

  • Antisymmetric: A relation RR on a set AA is antisymmetric if aRbaRb and bRabRa imply a=ba = b for all a,b∈Aa, b \in A.

    Consider the pair (2,4)(2, 4). We have 2R42R4 because 2<42 < 4, and 4R24R2 because 4≡2(mod2)4 \equiv 2 \pmod{2}. However, 2≠42 \neq 4.

    Therefore, RR is not antisymmetric.

  • Transitive: A relation RR on a set AA is transitive if aRbaRb and bRcbRc imply aRcaRc for all a,b,c∈Aa, b, c \in A.

    Consider the elements 22, 33, and 11. We have 2R32R3 because 2<32 < 3, and 3R13R1 because 3≡1(mod2)3 \equiv 1 \pmod{2}. However, 2R̸12 \not R 1 because 2≮12 \not< 1 and 2≢1(mod2)2 \not\equiv 1 \pmod{2}.

    Therefore, RR is not transitive.

ExerciseExplain why the conjunction of a partial order relation and an...

Explain why the conjunction of a partial order relation and an equivalence relation leads to the previous result.

SolutionA partial order relation is a binary relation that is reflexive,...

A partial order relation is a binary relation that is reflexive, antisymmetric, and transitive. An equivalence relation is a binary relation that is reflexive, symmetric, and transitive.

When we combine a partial order relation with an equivalence relation, the resulting relation can still be reflexive because both component relations are reflexive. However, the antisymmetry of the partial order can conflict with the symmetry of the equivalence relation, leading to a relation that is neither antisymmetric nor symmetric. Furthermore, the transitivity of the partial order might not hold if the conditions of the equivalence relation introduce exceptions, which can break the transitivity in specific cases.

In this particular example: - The reflexive property is preserved because both conditions x<yx < y and x≡y(mod2)x \equiv y \pmod{2} ensure that xRxxRx. - The symmetry is broken because x<yx < y does not imply y<xy < x. - The antisymmetry is violated when equivalence modulo 2 (x≡y(mod2)x \equiv y \pmod{2}) holds for distinct xx and yy. - The transitivity is disrupted when combining the partial order (x<yx < y) with equivalence modulo 2, as seen in the counterexample with 2,32, 3, and 11.

Thus, the combined relation RR does not retain all properties of partial orders and equivalence relations.

N-ary Relations

Section Pending Migration / Draft Placeholder

This section on nn-ary relations and relational database models (projections, joins, and keys) is an outline placeholder from the original lecture notes, queued for complete exposition.

Searching algorithms

Searching is the task of locating a target TT in an array AA of length nn. The cost depends on whether AA is ordered.

Searching in an unordered array

If AA has no order, the only general method is to inspect A[1],…,A[n]A[1],\ldots,A[n] in turn. This is linear search.

Algorithm 1 Linear search

1:procedure LinearSearch(A,TA, T)

2:for j←1j \gets 1 to nn do

3:if A[j]=TA[j] = T then

4:return jj

5:end if

6:end for

7:return −1-1

8:end procedure

In the worst case every entry is read, so the time is O(n)O(n). If TT sits in the first cell, a single comparison suffices. Computer scientists record that best-case lower bound with Ω\Omega notation, and a matching upper and lower bound with Θ\Theta notation.

NotationOmega notation

Ω(g(n))\Omega(g(n)) is the set of functions that grow at least as fast as gg: there exist c>0c>0 and n0n_0 such that 0≤cg(n)≤f(n)0 \leq c g(n) \leq f(n) for all n≥n0n \geq n_0.

NotationTheta notation

Θ(g(n))\Theta(g(n)) is the set of functions squeezed between two positive multiples of gg: there exist c1,c2>0c_1,c_2>0 and n0n_0 such that 0≤c1g(n)≤f(n)≤c2g(n)0 \leq c_1 g(n) \leq f(n) \leq c_2 g(n) for all n≥n0n \geq n_0.

If the target is equally likely to occupy any index, the average number of probes is

pˉ=1n∑i=1ni=n+12,\bar{p} = \frac{1}{n}\sum_{i=1}^{n} i = \frac{n+1}{2},

so linear search has average cost Θ(n)\Theta(n).

Searching in an ordered array

DefinitionOrdered array

An array AA is ordered if A[1]≤⋯≤A[n]A[1]\leq \cdots \leq A[n] or A[1]≥⋯≥A[n]A[1]\geq \cdots \geq A[n].

A comparison with A[i]A[i] then discards half of the remaining list:

  • if T<A[i]T < A[i], then TT cannot occur in A[i],…,A[n]A[i],\ldots,A[n];
  • if A[i]<TA[i] < T, then TT cannot occur in A[1],…,A[i]A[1],\ldots,A[i].

To make the worst case as small as possible, probe near the middle of the current sublist A[p],…,A[q]A[p],\ldots,A[q], using j=⌊(p+q)/2⌋j=\bigl\lfloor(p+q)/2\bigr\rfloor. That algorithm is binary search.

Algorithm 2 Binary search

1:procedure BinarySearch(A,TA, T)

2:p←1p \gets 1

3:q←nq \gets n

4:while p≤qp \leq q do

5:j←⌊(p+q)/2⌋j \gets \bigl\lfloor (p+q)/2 \bigr\rfloor

6:if A[j]=TA[j] = T then

7:return jj

8:else if A[j]<TA[j] < T then

9:p←j+1p \gets j+1

10:else

11:q←j−1q \gets j-1

12:end if

13:end while

14:return −1-1

15:end procedure

A visualisation of the comparisons is available at this search demo.

Walkthrough with n=12n=12 and A=(3,5,8,8,9,16,29,41,50,63,64,67)A=(3,5,8,8,9,16,29,41,50,63,64,67). If T=99T=99, the variables evolve as follows.

ppjjqqA[j]A[j]relationoutput
161216A[j]<TA[j]<T
791250A[j]<TA[j]<T
10111264A[j]<TA[j]<T
12121267A[j]<TA[j]<T
1312TT is not in AA

Write k=q−p+1k=q-p+1 for the current length, and after an unsuccessful probe at A[j]A[j] split into k1=j−pk_1=j-p and k2=q−jk_2=q-j. Choosing j=⌊(p+q)/2⌋j=\lfloor(p+q)/2\rfloor makes k1k_1 the smaller half.

TheoremBinary search sublist lengths

On each iteration with j=⌊(p+q)/2⌋j=\bigl\lfloor(p+q)/2\bigr\rfloor, the leftover lengths satisfy

k1=⌊k−12⌋≤k2=⌈k−12⌉≤k2.k_1 = \Bigl\lfloor \frac{k-1}{2} \Bigr\rfloor \leq k_2 = \Bigl\lceil \frac{k-1}{2} \Bigr\rceil \leq \frac{k}{2}.
Proof

From j≤(q+p)/2<j+1j \leq (q+p)/2 < j+1, subtract pp to get k1≤(q−p)/2<k1+1k_1 \leq (q-p)/2 < k_1+1, so k1=⌊(k−1)/2⌋k_1=\lfloor(k-1)/2\rfloor. Then k1+k2=k−1k_1+k_2=k-1 forces the displayed bound on k2k_2.

TheoremBinary search termination

Binary search terminates after at most ⌈lg⁡n⌉+1\lceil \lg n \rceil + 1 probes.

Proof

Let w=⌊lg⁡n⌋w=\lfloor \lg n \rfloor. After ww unsuccessful probes the current length kk is at most n/2wn/2^w. Since 2w≤n<2w+12^w \leq n < 2^{w+1}, one has 1≤n/2w<21 \leq n/2^w < 2, so k=1k=1. The next probe inspects that last entry and then either finds TT or makes p>qp>q.

DefinitionLoop invariant

A loop invariant is an assertion that is true before and after every iteration of a loop.

Assume TT occurs at index ii. The invariant of the first algorithm is: after kk iterations, if T=A[i]T=A[i] then p≤i≤qp\leq i \leq q.

TheoremLoop invariance of binary search

After kk iterations, if T=A[i]T=A[i] then p≤i≤qp\leq i\leq q.

Proof

Induction on kk. Before the loop, p=1p=1 and q=nq=n, so the claim holds. Suppose it holds after ww iterations, and another iteration computes jnew=⌊(p+q)/2⌋j_{\mathrm{new}}=\lfloor(p+q)/2\rfloor. Then p≤jnew≤qp\leq j_{\mathrm{new}}\leq q. If A[jnew]<TA[j_{\mathrm{new}}]<T, the new left endpoint is jnew+1j_{\mathrm{new}}+1; if A[jnew]>TA[j_{\mathrm{new}}]>T, the new right endpoint is jnew−1j_{\mathrm{new}}-1; if they are equal, pp and qq are unchanged. In every case the surviving interval still contains ii whenever TT is present.

When the loop stops with p>qp>q, there is no index in [p,q][p,q], so TT is not in AA. Otherwise it was returned at the probe jj. That is why binary search is correct, and much cheaper than linear search.

Branching diagrams

DefinitionBranching diagram

A branching diagram for an algorithm is a tree of all sequences of operations the algorithm might perform.

For n=12n=12, the first probe is A[6]A[6]. The two comparison outcomes lead to A[3]A[3] or A[9]A[9], and so on.

Branching tree of the first binary search, n=12.

The diagram is a binary tree: it is rooted at the top, every vertex has at most two downward edges, vertices with no downward edge are leaves, and every non-root vertex has exactly one incoming edge from above.

Binary search, version 2

A second version updates the right endpoint by q←jq \gets j rather than q←j−1q \gets j-1, and compares only A[j]<TA[j]<T inside the loop.

Algorithm 3 Binary search, version 2

1:procedure BinarySearch(A,TA, T)

2:p←1p \gets 1

3:q←nq \gets n

4:while p<qp < q do

5:j←⌊(p+q)/2⌋j \gets \bigl\lfloor (p+q)/2 \bigr\rfloor

6:if A[j]<TA[j] < T then

7:p←j+1p \gets j+1

8:else

9:q←jq \gets j

10:end if

11:end while

12:if A[p]=TA[p] = T then

13:return pp

14:else

15:return −1-1

16:end if

17:end procedure

For the same T=99T=99 example the table is shorter by one iteration.

ppjjqqp<qp<qA[j]A[j]A[j]<TA[j]<Toutput
1612t16t
7912t50t
101112t64t
1212fTT is not in AA

The probe A[j]A[j] is now the last cell of the left block, not a singleton third block. If A[j]<TA[j]<T one continues in A[j+1],…,A[q]A[j+1],\ldots,A[q]; otherwise in A[p],…,A[j]A[p],\ldots,A[j]. With j=⌊(p+q)/2⌋j=\lfloor(p+q)/2\rfloor the new lengths satisfy k2=⌊k/2⌋≤k/2≤k1=⌈k/2⌉k_2=\lfloor k/2\rfloor \leq k/2 \leq k_1=\lceil k/2\rceil. So on some iterations the next sublist is more than half as long as the previous one.

Let L(w)L(w) be the length still to be searched after ww iterations of the while loop.

TheoremLength bounds for version 2

After ww iterations,

⌊n2w⌋≤L(w)≤⌈n2w⌉.\Bigl\lfloor \frac{n}{2^w} \Bigr\rfloor \leq L(w) \leq \Bigl\lceil \frac{n}{2^w} \Bigr\rceil.
Proof

The case w=0w=0 is L(0)=nL(0)=n. Assume the bound at step mm. The next length is obtained by taking floor or ceiling of half of L(m)L(m). Floor and ceiling are nondecreasing, and for every real xx one has ⌊⌊x⌋/2⌋=⌊x/2⌋\lfloor\lfloor x\rfloor/2\rfloor=\lfloor x/2\rfloor and ⌈⌈x⌉/2⌉=⌈x/2⌉\lceil\lceil x\rceil/2\rceil=\lceil x/2\rceil. Applying these identities with x=n/2mx=n/2^m keeps the same shape of bound at step m+1m+1.

TheoremTermination of version 2

After at most ⌈lg⁡n⌉\lceil \lg n \rceil comparisons of the form "A[j]<TA[j]<T?", and when p=qp=q, the current sublist has length 11.

Lemma

If x<yx<y are real, then ⌈x⌉≤⌈y⌉\lceil x\rceil\leq\lceil y\rceil and ⌊x⌋≤⌊y⌋\lfloor x\rfloor\leq\lfloor y\rfloor.

The branching diagram of version 2 for n=12n=12 is again a binary tree, but every internal vertex has exactly two downward edges: a full binary tree.

Branching tree of binary search version 2, n=12.

TheoremLeaves in a full binary tree

A full binary tree with mm internal vertices has m+1m+1 leaves.

Proof

Induction on mm. For m=1m=1 the root has two leaf children. Adding one internal vertex converts a leaf into an internal vertex and adds two new leaves, so the leaf count increases by 11.

Exercises

ExerciseWhere an unsuccessful search would insert

Suppose TT is not found by binary search. Where should it be inserted?

  1. Is the final qq always one less than the final pp?
  2. When is A[q]<T<A[p]A[q] < T < A[p]?
  3. If p=1p=1 throughout, is T<A[1]T<A[1]?
  4. If q=nq=n throughout, is A[n]<TA[n]<T?
Solution

The final qq need not be p−1p-1 in every implementation; it depends on how the endpoints move. The inequality A[q]<T<A[p]A[q]<T<A[p] describes the gap where TT would sit in a sorted array. If pp never increased then T<A[1]T<A[1]; if qq never decreased then A[n]<TA[n]<T.

ExerciseAverage cost in Theta notation

Consider the best performance of binary search in Ω\Omega notation and the worst performance in OO notation. Can the average performance be stated in Θ\Theta notation?

Solution

The best case is a hit at the first midpoint, Ω(1)\Omega(1). The worst case is O(log⁡n)O(\log n) probes. An average-case Θ\Theta bound would need matching lower and upper estimates under a probability model on the target's index; the usual textbook statement is O(log⁡n)O(\log n) on average, without a matching Θ\Theta claim, because that model is not unique.

References

  1. [1] T. Banakh, “Classical Set Theory: Theory of Sets and Classes,” arXiv:2006.01613, 2026. Version 6, August 15, 2026; NBG sets, classes, and class existence. https://arxiv.org/abs/2006.01613 ↩