Relations as Sets of Ordered Pairs

What does it mean to say two things are "related"? Consider some examples. A student takes a course. A number divides another. A person is the parent of another. These all express a connection between elements of some collection. Mathematics needs a precise, unified way to capture any such connection. This way must not depend on the informal meaning of words like "divides" or "is the parent of." The surprising and powerful answer comes from the set-theoretic foundations of mathematics. It is to identify a relationship entirely with the set of pairs of objects that stand in it. This move — collapsing a relationship into a set of Ordered Pairs — is one of the great economizing ideas in the foundations of mathematics. It means we never need a primitive notion of "relatedness" beyond set membership. Once relations are subsets of a Cartesian Product, every property of a relation becomes a property of a set. This includes reflexivity, symmetry, transitivity, being a function, and being an order. Such properties become provable by ordinary set-theoretic reasoning rather than appeals to intuition. The big picture is this: relations sit at the hinge between raw set theory and the rest of mathematics. Equivalence relations partition sets into classes. Order relations organize sets into hierarchies. Functions — the single most important mathematical objects — turn out to be nothing more than relations satisfying an extra uniqueness condition. Understanding relations as sets of ordered pairs is therefore a prerequisite for everything downstream. This includes equivalence classes, partial orders, graphs, and the rigorous definition of a function. This article gives the formal definition of a relation from a set AA to a set BB. It defines domain and range rigorously, and introduces the infix notation aRbaRb. It proves basic structural facts, such as the count of possible relations between finite sets. It works through concrete examples, and shows exactly which hypotheses are needed. It does this by exhibiting what fails when they are dropped.

Key takeaways
  • A relation from AA to BB is defined to be a subset R⊆A×BR \subseteq A \times B — nothing more, nothing less.
  • The statement aRbaRb is shorthand for the set-membership fact (a,b)∈R(a,b) \in R.
  • The domain of RR is the set of first coordinates that actually occur; the range is the set of second coordinates that occur.
  • Domain and range can be proper subsets of AA and BB; distinguishing AA (or BB) from the domain (or range) is essential.
  • If ∣A∣=m|A| = m and ∣B∣=n|B| = n are finite, there are exactly 2mn2^{mn} relations from AA to BB, since a relation is exactly a subset of the mnmn-element set A×BA \times B.
  • Key idea: a relation is not a rule or a description — it is a set of ordered pairs, and everything about the relation is read off from that set.

Where this lives today

The relation-as-set-of-pairs viewpoint underlies enormous swaths of mathematics and computer science. In pure mathematics it is the immediate precursor to Properties of Relations (reflexivity, symmetry, transitivity), to equivalence relations and quotient constructions, and to partial and total orders that structure everything from cardinal arithmetic to lattice theory. It is also the precursor to Functions as Special Relations: a function f:A→Bf: A \to B is defined as a relation R⊆A×BR \subseteq A\times B satisfying dom⁡(R)=A\operatorname{dom}(R) = A together with a uniqueness clause (for each aa, at most one bb with aRbaRb) — so functions are a special case, not a separate primitive notion. In computer science, relational databases are literally implementations of finite relations: a database table is a finite subset of a Cartesian product of column domains, and relational algebra (joins, projections, selections) is set-theoretic manipulation of these subsets. Graph theory identifies a directed graph with a relation on its vertex set. In logic and model theory, relational structures (models of a first-order language) interpret relation symbols as exactly such subsets of Cartesian powers of a domain. In cryptography and complexity theory, one-way functions, hard relations, and NP-relations are formalized as subsets of pairs (x,y)(x,y) satisfying a checkable condition, directly generalizing this definition to computational contexts. In statistics and probability, a joint distribution can be viewed as living on a relation-like structure — the support of a joint random pair is a subset of a product space, echoing the same set-of-pairs idea underlying correlation and dependence between variables.

Ask the tutor: How does adding the properties of reflexivity, symmetry, and transitivity to a relation on a set lead to the definition of an equivalence relation and equivalence classes?

DefinitionRelation, Domain, Range, and Infix Notation

Let AA and BB be sets.

Relation. A relation from AA to BB is any subset RR of the Cartesian product A×BA \times B:

R⊆A×B.R \subseteq A \times B .

If A=BA = B, we call RR a relation on AA.

Infix notation. For a∈Aa \in A and b∈Bb \in B, we write

a R bto mean(a,b)∈R,a\,R\,b \quad \text{to mean} \quad (a,b) \in R,

and we write aR̸ ba \not R\, b to mean (a,b)∉R(a,b) \notin R. This is purely a notational convention: aRbaRb is defined to abbreviate the membership statement (a,b)∈R(a,b)\in R, so all logical facts about RR reduce to facts about set membership in RR.

Domain. The domain of RR is

dom⁡(R)={ a∈A:there exists b∈B with (a,b)∈R }.\operatorname{dom}(R) = \{\, a \in A : \text{there exists } b \in B \text{ with } (a,b) \in R \,\}.

Range. The range (also called the image) of RR is

ran⁡(R)={ b∈B:there exists a∈A with (a,b)∈R }.\operatorname{ran}(R) = \{\, b \in B : \text{there exists } a \in A \text{ with } (a,b) \in R \,\}.

By definition dom⁡(R)⊆A\operatorname{dom}(R) \subseteq A and ran⁡(R)⊆B\operatorname{ran}(R) \subseteq B; these containments need not be equalities. The set AA is sometimes called the codomain of the source, and BB the codomain of the target, though terminology varies by author; the essential objects are RR, dom⁡(R)\operatorname{dom}(R), and ran⁡(R)\operatorname{ran}(R).

Intuition

Think of A×BA \times B as a grid: rows indexed by elements of AA, columns indexed by elements of BB. Every possible ordered pair (a,b)(a,b) is one cell of this grid. A relation RR is a choice of some cells to "shade in" — nothing about why those cells are chosen matters to the mathematics; only the resulting shaded set matters. The domain is the set of rows containing at least one shaded cell; the range is the set of columns containing at least one shaded cell. This grid picture immediately explains several facts that otherwise feel mysterious. Two relations described by completely different English sentences are the same relation if they shade exactly the same cells. A relation need not touch every row or every column — hence domain and range can be strictly smaller than AA and BB. And since a relation is just a subset of a set with ∣A∣⋅∣B∣|A|\cdot|B| elements, counting relations is counting subsets: there are exactly 2∣A∣∣B∣2^{|A||B|} of them when A,BA, B are finite.

Figure
The grid picture: A×BA\times B with a relation RR shaded, showing domain and range
1 2 3 4 x y z A B R = {(1,x),(2,y),(2,z),(4,z)} dom(R) = {1,2,4} 3 is missing: row 3 unshaded ran(R) = {x,y,z} every column is used

Theorem

TheoremCounting Relations Between Finite Sets

Let AA and BB be finite sets with ∣A∣=m|A| = m and ∣B∣=n|B| = n. Then the number of distinct relations from AA to BB equals

2mn.2^{mn}.
LemmaCardinality of a Cartesian Product

If AA and BB are finite sets with ∣A∣=m|A| = m and ∣B∣=n|B| = n, then ∣A×B∣=mn|A \times B| = mn.

Proof

Proof of the Lemma, by the multiplication principle for finite sets (induction on nn). Base case n=0n = 0: then B=∅B = \varnothing, and A×B=∅A \times B = \varnothing since there is no b∈Bb \in B to pair with any aa. So ∣A×B∣=0=m⋅0|A \times B| = 0 = m \cdot 0. Inductive step: suppose the claim holds whenever the second set has nn elements. Let BB have n+1n+1 elements; write B=B0∪{b∗}B = B_0 \cup \{b^*\} where B0B_0 has nn elements and b∗∉B0b^* \notin B_0. Then

A×B=(A×B0)  ∪  (A×{b∗}),A \times B = (A \times B_0) \;\cup\; (A \times \{b^*\}),

and this union is disjoint, because any pair in A×{b∗}A \times \{b^*\} has second coordinate b∗b^* while no pair in A×B0A \times B_0 does (as b∗∉B0b^* \notin B_0). The map a↦(a,b∗)a \mapsto (a, b^*) is a bijection from AA to A×{b∗}A \times \{b^*\}, so ∣A×{b∗}∣=m|A \times \{b^*\}| = m. By the inductive hypothesis ∣A×B0∣=mn|A \times B_0| = mn. Since the union is disjoint,

∣A×B∣=∣A×B0∣+∣A×{b∗}∣=mn+m=m(n+1).|A \times B| = |A \times B_0| + |A \times \{b^*\}| = mn + m = m(n+1).

This completes the induction, proving the lemma for all n∈Nn \in \mathbb{N}. ■\blacksquare

Proof of the Theorem. By the definition of a relation, a relation from AA to BB is precisely a subset of A×BA \times B; thus the set of all relations from AA to BB is exactly the power set P(A×B)\mathcal{P}(A \times B). We use the standard fact — provable by induction on the size of a finite set, or by a bijective correspondence between subsets and functions into {0,1}\{0,1\} — that for any finite set SS with ∣S∣=k|S| = k,

∣P(S)∣=2k.|\mathcal{P}(S)| = 2^k.

(Proof sketch of this standard fact, by induction on kk: if k=0k=0 then S=∅S = \varnothing and P(S)={∅}\mathcal P(S) = \{\varnothing\} has exactly 1=201 = 2^0 element. If the claim holds for sets of size kk, let SS have k+1k+1 elements, S=S0∪{s∗}S = S_0 \cup \{s^*\} with ∣S0∣=k|S_0|=k, s∗∉S0s^* \notin S_0. Every subset T⊆ST \subseteq S either contains s∗s^* or does not; the subsets not containing s∗s^* are exactly the subsets of S0S_0, of which there are 2k2^k by hypothesis; the subsets containing s∗s^* are exactly {s∗}∪U\{s^*\} \cup U for U⊆S0U \subseteq S_0, again 2k2^k of them, and this is a bijection U↦{s∗}∪UU \mapsto \{s^*\}\cup U. These two classes are disjoint and exhaust P(S)\mathcal P(S), so ∣P(S)∣=2k+2k=2k+1|\mathcal P(S)| = 2^k + 2^k = 2^{k+1}.) Applying this fact with S=A×BS = A \times B, and using ∣A×B∣=mn|A \times B| = mn from the Lemma, we conclude

#{relations from A to B}=∣P(A×B)∣=2∣A×B∣=2mn.\#\{\text{relations from } A \text{ to } B\} = |\mathcal{P}(A \times B)| = 2^{|A \times B|} = 2^{mn}.

■\blacksquare

∎
CorollaryRelations on a set

If ∣A∣=m|A| = m, the number of relations on AA (i.e. from AA to AA) is 2m22^{m^2}.

Proof

Apply the Theorem with B=AB = A, so n=mn = m, giving 2m⋅m=2m22^{m \cdot m} = 2^{m^2}. ■\blacksquare

∎

Worked examples

Example 1 (an explicit small relation with domain and range strictly smaller than AA, BB). Let A={1,2,3,4,5}A = \{1, 2, 3, 4, 5\} and B={p,q,r}B = \{p, q, r\}. Define

R={(1,p), (1,q), (3,q), (3,r)}⊆A×B.R = \{(1,p),\ (1,q),\ (3,q),\ (3,r)\} \subseteq A \times B.

Checking RR is genuinely a relation from AA to BB: each listed pair has first coordinate in AA and second coordinate in BB, so indeed R⊆A×BR \subseteq A \times B. Domain. An element a∈Aa \in A belongs to dom⁡(R)\operatorname{dom}(R) iff some pair in RR has aa as first coordinate. Scanning RR: first coordinates appearing are 11 (twice) and 33 (twice). Elements 2,4,5∈A2, 4, 5 \in A never appear as a first coordinate. Hence

dom⁡(R)={1,3}⊊A.\operatorname{dom}(R) = \{1, 3\} \subsetneq A.

Range. Second coordinates appearing in RR are p,q,rp, q, r — in fact all three elements of BB occur (namely pp from (1,p)(1,p), qq from (1,q)(1,q) or (3,q)(3,q), and rr from (3,r)(3,r)). Hence

ran⁡(R)={p,q,r}=B.\operatorname{ran}(R) = \{p, q, r\} = B.

Reading off aRbaRb statements. By definition 1 R p1\,R\,p (since (1,p)∈R(1,p)\in R), 1 R q1\,R\,q, 3 R q3\,R\,q, 3 R r3\,R\,r, while 2R̸ p2 \not R\, p (since (2,p)∉R(2,p) \notin R), and indeed 22 is unrelated by RR to every element of BB, consistent with 2∉dom⁡(R)2 \notin \operatorname{dom}(R). Cardinality check. Here ∣A∣=5|A|=5, ∣B∣=3|B|=3, so by the Theorem there are 215=327682^{15} = 32768 relations from AA to BB in total; RR, with 44 pairs, is just one particular subset among these 3276832768, namely one of the (154)=1365\binom{15}{4} = 1365 subsets of size exactly 44.

Example 2 (a relation defined by a condition, converted into explicit pair form). Let A={2,3,4,5,6}A = \{2,3,4,5,6\} and B={4,5,6,7,8,9}B = \{4,5,6,7,8,9\}, and define the "divides" relation

R={(a,b)∈A×B:a∣b}.R = \{(a,b) \in A \times B : a \mid b\}.

Here a∣ba \mid b means b=kab = ka for some integer kk — this is the rule used to decide membership, but RR itself is the resulting set of pairs, not the rule. We compute RR explicitly by checking each a∈Aa \in A against each b∈Bb \in B:

  • a=2a=2: divides 4,6,84,6,8 among BB. Pairs: (2,4),(2,6),(2,8)(2,4),(2,6),(2,8).
  • a=3a=3: divides 6,96,9 among BB. Pairs: (3,6),(3,9)(3,6),(3,9).
  • a=4a=4: divides 4,84,8 among BB. Pairs: (4,4),(4,8)(4,4),(4,8).
  • a=5a=5: divides none of 4,5,6,7,8,94,5,6,7,8,9 that are multiples of 55 within BB — check: 5∣55 \mid 5 is true since 5=1⋅55 = 1\cdot 5! Recheck: 55 divides 55. Pair: (5,5)(5,5).
  • a=6a=6: divides 66 among BB (does 66 divide 1212? not in BB). Pair: (6,6)(6,6).

So

R={(2,4),(2,6),(2,8),(3,6),(3,9),(4,4),(4,8),(5,5),(6,6)}.R = \{(2,4),(2,6),(2,8),(3,6),(3,9),(4,4),(4,8),(5,5),(6,6)\}.

This has 99 ordered pairs. Domain. First coordinates occurring: 2,3,4,5,62,3,4,5,6 — every element of AA occurs (each aa divides itself, and a∈Ba \in B for a∈{4,5,6}a \in \{4,5,6\}, while 2,32,3 divide larger elements of BB). Hence

dom⁡(R)={2,3,4,5,6}=A.\operatorname{dom}(R) = \{2,3,4,5,6\} = A.

Range. Second coordinates occurring: 4,6,84,6,8 (from a=2a=2), 6,96,9 (from a=3a=3), 4,84,8 (from a=4a=4), 55 (from a=5a=5), 66 (from a=6a=6). Collecting distinct values: {4,5,6,8,9}\{4,5,6,8,9\}. Note 77 never appears — indeed no a∈Aa \in A divides 77, since 77 is prime and none of 2,3,4,5,62,3,4,5,6 equal 11 or 77. Hence

ran⁡(R)={4,5,6,8,9}⊊B,\operatorname{ran}(R) = \{4,5,6,8,9\} \subsetneq B,

because 7∈B∖ran⁡(R)7 \in B \setminus \operatorname{ran}(R). Infix notation in use. We may write 2 R 82\,R\,8 (true, since 2∣82 \mid 8) and 3R̸ 83 \not R\, 8 (false, since 3∤83 \nmid 8); both are just restatements of (2,8)∈R(2,8) \in R and (3,8)∉R(3,8) \notin R respectively.

Counterexample

CounterexampleWhy we must fix AA and BB in advance: the same set of pairs, different ambient product, different domain/range

The Theorem and Definition rely on first specifying the ambient sets AA and BB, not merely the set of pairs RR. If this hypothesis — that RR comes equipped with a fixed AA and BB with R⊆A×BR \subseteq A\times B — is dropped, and one instead tries to recover "the domain" and "the range" from RR alone by declaring them to be exactly the first and second coordinates occurring in RR, subtle but important information is lost, and statements like "dom⁡(R)⊆A\operatorname{dom}(R) \subseteq A" become vacuous or ill-posed. Concretely: let

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

As a relation from A1={1,2,3}A_1 = \{1,2,3\} to B1={1,4,9}B_1 = \{1,4,9\}, we have R⊆A1×B1R \subseteq A_1 \times B_1, with dom⁡(R)=A1\operatorname{dom}(R) = A_1 and ran⁡(R)=B1\operatorname{ran}(R) = B_1; here RR happens to touch every row and every column. But the very same set of ordered pairs RR is also a perfectly good relation from A2={1,2,3,4,5}A_2 = \{1,2,3,4,5\} to B2={1,4,9,16,25}B_2 = \{1,4,9,16,25\} — again R⊆A2×B2R \subseteq A_2 \times B_2 — except now

dom⁡(R)={1,2,3}⊊A2,ran⁡(R)={1,4,9}⊊B2.\operatorname{dom}(R) = \{1,2,3\} \subsetneq A_2, \qquad \operatorname{ran}(R) = \{1,4,9\} \subsetneq B_2.

So whether dom⁡(R)=A\operatorname{dom}(R) = A (a property relevant to, e.g., whether RR can be a function defined on all of AA, foreshadowing the notion of a total function) is not a fact about RR in isolation — it is a fact about RR relative to a chosen AA. Dropping the requirement of specifying the ambient sets A,BA, B makes "domain equals AA" an ill-formed or context-dependent question, and destroys the theorem's counting statement as well: the number of relations "from RR's coordinates to itself" is not even meaningful without fixing AA and BB first, so the formula 2mn2^{mn} cannot even be stated. This shows the hypothesis "R⊆A×BR \subseteq A \times B for specified A,BA, B" is not a mere bookkeeping convenience — it is essential to the definitions of domain, range, and to any counting statement about relations.

Scope, edge cases & common traps

SituationWhat is trueCommon error
R=∅R = \varnothing∅\varnothing is a relation from AA to BB for any A,BA,B; dom⁡(∅)=ran⁡(∅)=∅\operatorname{dom}(\varnothing)=\operatorname{ran}(\varnothing)=\varnothingThinking a relation must relate something; the empty relation is perfectly legitimate
R=A×BR = A \times BThe "full" relation; every a∈Aa \in A relates to every b∈Bb \in BConfusing "full relation" with "identity relation" (these coincide only in degenerate cases)
AA or BB infiniteDefinition still applies verbatim: R⊆A×BR \subseteq A\times BAssuming domain/range must be finite, or that the 2mn2^{mn} counting formula applies (it needs finiteness)
dom⁡(R)⊊A\operatorname{dom}(R) \subsetneq APerfectly allowed; some elements of AA relate to nothingAssuming dom⁡(R)=A\operatorname{dom}(R) = A always — this is a special property, not automatic
A=BA = BRR is a relation on AA; still just R⊆A×AR \subseteq A \times AConfusing aRba R b with bRab R a — order in the pair matters, RR need not be symmetric
Same pairs, different codomainran⁡(R)\operatorname{ran}(R) depends on BB only insofar as ran⁡(R)⊆B\operatorname{ran}(R)\subseteq B; the set of second coordinates present is intrinsic to RRTreating BB itself (rather than ran⁡(R)\operatorname{ran}(R)) as "the range"

The mathematician behind it

The rigorous reduction of "relation" to "set of ordered pairs" is a product of the broader foundational program that reduced essentially all mathematical objects to pure sets, carried out especially through the work of Felix Hausdorff, Kazimierz Kuratowski, and Norbert Wiener on the set-theoretic definition of the ordered pair itself, combined with the systematic set-theoretic treatment of functions and relations that crystallized in the early-to-mid twentieth century. Kuratowski's 1921 definition of the ordered pair, (a,b):={{a},{a,b}}(a,b) := \{\{a\},\{a,b\}\}, made it possible to define A×BA \times B purely as a set built from AA and BB, and once that was in hand, "relation" could be defined with no further primitives — simply as a subset of A×BA \times B.

Origins · 1 minKazimierz Kuratowski and how this was discovered
KK
Kazimierz Kuratowski
1896–1980 · Warsaw School of Mathematics, set theory and topology

A Polish mathematician central to the Warsaw School, Kuratowski worked on set theory, topology, and the foundations of mathematics. His 1921 definition of the ordered pair as a set is the technical device that makes the definition of a relation as "just a subset of A×BA\times B" fully rigorous within pure set theory, with no unreduced primitive notion of "pairing."

History
- 1901–1908: Foundational crises spur Zermelo's axiomatization of set theory, setting the stage for reducing all mathematical objects to sets.
- 1914: Norbert Wiener gives an early set-theoretic reduction of the ordered pair.
- 1921: Kazimierz Kuratowski publishes the now-standard definition (a,b)={{a},{a,b}}(a,b) = \{\{a\},\{a,b\}\}.
- 1920s–1930s: With ordered pairs and Cartesian products fully set-theoretic, relations and functions are formally identified with sets of ordered pairs throughout the developing Zermelo–Fraenkel framework.
- Mid-20th century: Textbook treatments (Halmos's Naive Set Theory, and later Enderton, Velleman) standardize "relation = subset of A×BA \times B" as the universal starting definition for undergraduate foundations courses.
Is a relation the same thing as a function?

No — every function is a relation, but not every relation is a function. A relation from AA to BB is simply any subset R⊆A×BR \subseteq A \times B; nothing requires each element of AA to appear as a first coordinate, and nothing forbids an element of AA from appearing paired with two different elements of BB. A function additionally requires (i) dom⁡(R)=A\operatorname{dom}(R) = A (every input is used, "totality") and (ii) uniqueness: if (a,b1)∈R(a,b_1) \in R and (a,b2)∈R(a,b_2)\in R then b1=b2b_1 = b_2. So functions are exactly the relations satisfying these two extra conditions — this is the precise sense in which Functions as Special Relations are a special case of the material here.

Why define a relation as a set of pairs instead of as a "rule" or "predicate"?

Defining relations via rules or predicates seems more intuitive, but it hides an ambiguity: different-looking rules can produce the same set of pairs, and mathematics wants two relations to be considered identical exactly when they relate the same elements — no more, no less. By defining RR to literally be the set of pairs, extensional equality of relations becomes ordinary set equality: R1=R2  ⟺  (∀a,b) [(a,b)∈R1⇔(a,b)∈R2]R_1 = R_2 \iff (\forall a,b)\,[(a,b)\in R_1 \Leftrightarrow (a,b)\in R_2]. This also lets all of set theory's machinery (unions, intersections, complements, power sets) apply directly to relations, since they are just sets.

Can domain and range be empty even if AA and BB are not?

Yes. Take R=∅⊆A×BR = \varnothing \subseteq A \times B for any nonempty A,BA, B. Then no pair belongs to RR, so no aa satisfies "there exists bb with (a,b)∈R(a,b)\in R," giving dom⁡(R)=∅\operatorname{dom}(R) = \varnothing, and symmetrically ran⁡(R)=∅\operatorname{ran}(R) = \varnothing. This is a completely legitimate relation — it is the "nothing is related to anything" relation, sometimes called the empty relation, and it satisfies the subset condition ∅⊆A×B\varnothing \subseteq A\times B vacuously.

If R⊆A×BR \subseteq A \times B and also R⊆A′×B′R \subseteq A' \times B' for different A′,B′A', B', is RR "the same relation"?

As a set, yes — RR is identical as a set of ordered pairs regardless of which ambient product it is regarded as a subset of. But the phrase "relation from AA to BB" packages RR together with the chosen AA and BB, and properties like dom⁡(R)=A\operatorname{dom}(R) = A are properties of this pairing, not of RR alone (see the counterexample above). In careful treatments, some authors define a relation as the triple (A,B,R)(A, B, R) precisely to avoid this ambiguity, though many introductory treatments (as here) suppress A,BA,B once fixed by context.

Does aRbaRb automatically imply bRabRa?

No, and this is one of the most important points about the definition. Since R⊆A×BR \subseteq A \times B consists of ordered pairs, (a,b)∈R(a,b) \in R and (b,a)∈R(b,a) \in R are in general entirely different membership questions — even when A=BA = B so both pairs make sense. For example with "aa divides bb" on positive integers, 2R42R4 holds (since 2∣42\mid 4) but 4R24R2 fails (since 4∤24 \nmid 2). Relations for which aRbaRb always implies bRabRa are called symmetric, a special property studied under Properties of Relations, not a automatic consequence of the basic definition.

Why does the counting formula 2mn2^{mn} require AA and BB to be finite?

The proof rests on two facts: ∣A×B∣=mn|A\times B| = mn for finite A,BA,B (proved by induction on ∣B∣|B|), and ∣P(S)∣=2∣S∣|\mathcal P(S)| = 2^{|S|} for finite SS (also proved by induction on ∣S∣|S|). Both inductions are inductions on a natural number and simply do not apply when AA or BB is infinite — indeed if AA is infinite, P(A×B)\mathcal P(A\times B) is infinite, and comparing its size to "2mn2^{mn}" requires cardinal arithmetic (defining 2κ2^{\kappa} for infinite cardinals κ\kappa) rather than the elementary combinatorial argument given here.

Is "domain" here the same as "domain of definition" for a function later on?

Yes, and this consistency is exactly the point of building the theory in this order. Once a function ff is defined as a relation Rf⊆A×BR_f \subseteq A \times B with dom⁡(Rf)=A\operatorname{dom}(R_f) = A, the domain of the relation RfR_f (as just defined) coincides with the usual "domain of the function ff." So the definition of domain given here is not a mere analogy to the later functional notion — it is the same definition, and the functional case is simply the special case where the domain equals all of AA and uniqueness of outputs holds.

Before this

Where this leads