Relations

Chapter 4: Relations

Learning objectives

  • Define a relation as a subset of a Cartesian product
  • Use the notation aRbaRb and identify the domain and range
  • Recognise familiar relations: less-than, equality, divides, sibling-of
  • Compute the inverse of a relation

Why do we need a new word for "this is related to that"? Because that single idea covers an enormous range of structures: numerical orderings (<<, \leq), arithmetic links (\mid, (modn)\equiv \pmod{n}), social connections (friend-of, sibling-of), database keys (foreign-key links), and graph edges. The mathematical concept that captures all of them — with no extra restrictions — is the relation. It is the most general "connection" structure you can build, and once you have it, you can ask precise questions: Is the connection symmetric? Reflexive? Transitive? Does it chain? Does it partition? Sections 4.3-4.5 climb that ladder. This section sets the bottom rung.

The definition

A relation from a set AA to a set BB is any subset RA×BR \subseteq A \times B. When (a,b)R(a, b) \in R, we write aRbaRb and read it "aa is RR-related to bb." If A=BA = B we call RR a relation on AA. There are no rules — RR can be tiny (empty), enormous (all of A×BA \times B), or anything in between.

Domain, range, inverse

The domain of RR is the set of first components: Dom(R)={aAbB,aRb}\text{Dom}(R) = {a \in A \mid \exists b \in B,, aRb}. The range is the set of second components: Ran(R)={bBaA,aRb}\text{Ran}(R) = {b \in B \mid \exists a \in A,, aRb}. The inverse R1R^{-1} swaps every pair: R1={(b,a)(a,b)R}R^{-1} = {(b, a) \mid (a, b) \in R}. Always: Dom(R1)=Ran(R)\text{Dom}(R^{-1}) = \text{Ran}(R) and Ran(R1)=Dom(R)\text{Ran}(R^{-1}) = \text{Dom}(R).

Familiar relations

The most important examples to keep in mind:

  • Less-than on R\mathbb{R}: R={(a,b)a<b}R = {(a, b) \mid a < b}. Strict, no element relates to itself.
  • Equality on AA: R={(a,a)aA}R = {(a, a) \mid a \in A}, the diagonal. Every element relates only to itself.
  • Divides on Z+\mathbb{Z}^+: aba \mid b means b=kab = ka for some positive integer kk.
  • Congruence mod nn on Z\mathbb{Z}: ab(modn)a \equiv b \pmod n iff n(ab)n \mid (a - b).

Mapping ArrowsInteractive figure — enable JavaScript to interact.

Pause and think: Why is the empty set \emptyset a perfectly legitimate relation from AA to BB, no matter what AA and BB are? (Hint: a relation is just a subset of a Cartesian product, and X\emptyset \subseteq X for every set XX.)

Try it

  • List the relation R={(a,b){1,2,3,4}2ab}R = {(a, b) \in {1,2,3,4}^2 \mid a \mid b}. Predict the size before listing.
  • For R={(1,a),(2,b),(2,c),(3,a)}R = {(1, a), (2, b), (2, c), (3, a)}, name Dom(R)\text{Dom}(R), Ran(R)\text{Ran}(R), and R1R^{-1}.
  • Sketch the "less-than-or-equal" relation on {1,2,3}{1, 2, 3} as an arrow diagram in the widget. How many arrows?
  • True or false: every function is a relation. Every relation is a function. Justify each.
  • Find a relation RR on {1,2,3}{1, 2, 3} such that R=R1R = R^{-1} but RR has more than 3 pairs.

A trap to watch for

Relations are more general than functions. A relation RR from AA to BB can pair a single aa with many different bb’s, or with none at all. Students who have only seen functions sometimes assume "each input has exactly one output" is part of the definition of relation. It is not. That extra rule is what makes a relation into a function — we will see this in §5.1.

What you now know

You can write any relation as a set of ordered pairs, identify its domain and range, take its inverse, and recognise the relation behind everyday connection-style data — social graphs, database joins, divisibility, congruence. Section 4.3 asks the next obvious question: which properties can a relation have, and what changes when it does?

Code ChallengeInteractive figure — enable JavaScript to interact.

References

  • Velleman, D. J. (2019). How to Prove It (3rd ed.). Cambridge University Press, §4.2.
  • Halmos, P. R. (1960). Naive Set Theory. Springer, §7.
  • Hammack, R. (2018). Book of Proof, ch. 11.
  • Date, C. J. (2003). An Introduction to Database Systems (8th ed.). Addison-Wesley, ch. 3.
  • Bloch, E. D. (2011). Proofs and Fundamentals (2nd ed.). Springer, ch. 5.

This page is prerendered for SEO and accessibility. The interactive widgets above hydrate on JavaScript load.