Skip to content
Part IA Michaelmas, Lent Term

Relations: Introduction

What is a Relation?

Definition

A binary relation RR from a set AA to a set BB is a subset R⊆A×BR \subseteq A \times B.

We write:

  • R:A↛BR : A \nrightarrow B to indicate a relation from AA to BB
  • aRbaRb or (a,b)∈R(a, b) \in R to indicate RR relates aa and bb

Intuition

A relation describes how elements of AA are connected to elements of BB. Unlike a function, a single a∈Aa \in A can be related to multiple b∈Bb \in B, or to none at all.

Internal diagram of a relation

Relational Extensionality

Two relations are equal iff they relate the same pairs:

R=S  ⟺  ∀a∈A.∀b∈B.(aRb⇔aSb)R = S \iff \forall a \in A. \forall b \in B. (aRb \Leftrightarrow aSb)

Examples of Relations

The Empty Relation

For any sets A,BA, B, the empty relation ∅⊆A×B\emptyset \subseteq A \times B relates nothing.

a∅ b is never truea \emptyset\, b \text{ is never true}

The Full Relation

The full relation A×B⊆A×BA \times B \subseteq A \times B relates everything.

a(A×B)b for all a∈A,b∈Ba (A \times B) b \text{ for all } a \in A, b \in B

The Identity Relation

For a set AA, the identity relation idA⊆A×A\text{id}_A \subseteq A \times A:

a idA a′  ⟺  a=a′a \,\text{id}_A\, a' \iff a = a'

Examples from Computer Science

Program specification: The relation sq:R≥0↛R\text{sq} : \mathbb{R}_{\geq 0} \nrightarrow \mathbb{R} given by x sq y  ⟺  x=y2x \,\text{sq}\, y \iff x = y^2.

Operational semantics: A transition relation S:E↛ES : E \nrightarrow E on machine states where eSe′eSe' means “state ee can transition to e′e'”.

Network connectivity: A relation C:N↛NC : N \nrightarrow N on network nodes, where aCbaCb means “node aa is directly connected to node bb”.

Database relations: A table relating Movies, Directors, Years, and People.

Special Relations on a Single Set

A relation R⊆A×AR \subseteq A \times A is called an endo-relation or relation on AA.

Reflexivity

RR is reflexive if ∀a∈A.aRa\forall a \in A. aRa.

Equivalently: idA⊆R\text{id}_A \subseteq R.

Symmetry

RR is symmetric if ∀a,b∈A.(aRb⇒bRa)\forall a, b \in A. (aRb \Rightarrow bRa).

Transitivity

RR is transitive if ∀a,b,c∈A.(aRb∧bRc⇒aRc)\forall a, b, c \in A. (aRb \land bRc \Rightarrow aRc).

Antisymmetry

RR is antisymmetric if ∀a,b∈A.(aRb∧bRa⇒a=b)\forall a, b \in A. (aRb \land bRa \Rightarrow a = b).

Examples

RelationReflexiveSymmetricTransitiveAntisymmetric
a=ba = b on any setYesYesYesYes
a≤ba \leq b on R\mathbb{R}YesNoYesYes
a<ba < b on R\mathbb{R}NoNoYesYes
a∣ba \mid b on Z\mathbb{Z}YesNoYesNo
”is a sibling of” on peopleNoYesNoNo

Visualising Relations

Internal Diagrams

Draw elements of AA on the left, elements of BB on the right. Draw arrows from aa to bb whenever aRbaRb.

Matrix Representation

For finite sets A={a1,…,am}A = \{a_1, \ldots, a_m\} and B={b1,…,bn}B = \{b_1, \ldots, b_n\}, represent RR as an m×nm \times n boolean matrix MM:

Mij=1  ⟺  aiRbjM_{ij} = 1 \iff a_i R b_j

Graph Representation (for endo-relations)

Draw elements of AA as vertices. Draw a directed edge from aa to bb whenever aRbaRb.


Summary

  • A relation R:A↛BR : A \nrightarrow B is a subset R⊆A×BR \subseteq A \times B
  • Special relations: empty, full, identity
  • Key properties: reflexive, symmetric, transitive, antisymmetric
  • Visualise with internal diagrams, matrices, or directed graphs