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 RA×BR \subseteq A \times B.

We write:

  • R:ABR : 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 aAa \in A can be related to multiple bBb \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    aA.bB.(aRbaSb)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.

ab is never truea \emptyset\, b \text{ is never true}

The Full Relation

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

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

The Identity Relation

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

aidAa    a=aa \,\text{id}_A\, a' \iff a = a'

Examples from Computer Science

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

Operational semantics: A transition relation S:EES : E \nrightarrow E on machine states where eSeeSe' means “state ee can transition to ee'”.

Network connectivity: A relation C:NNC : 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 RA×AR \subseteq A \times A is called an endo-relation or relation on AA.

Reflexivity

RR is reflexive if aA.aRa\forall a \in A. aRa.

Equivalently: idAR\text{id}_A \subseteq R.

Symmetry

RR is symmetric if a,bA.(aRbbRa)\forall a, b \in A. (aRb \Rightarrow bRa).

Transitivity

RR is transitive if a,b,cA.(aRbbRcaRc)\forall a, b, c \in A. (aRb \land bRc \Rightarrow aRc).

Antisymmetry

RR is antisymmetric if a,bA.(aRbbRaa=b)\forall a, b \in A. (aRb \land bRa \Rightarrow a = b).

Examples

RelationReflexiveSymmetricTransitiveAntisymmetric
a=ba = b on any setYesYesYesYes
aba \leq b on R\mathbb{R}YesNoYesYes
a<ba < b on R\mathbb{R}NoNoYesYes
aba \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:ABR : A \nrightarrow B is a subset RA×BR \subseteq A \times B
  • Special relations: empty, full, identity
  • Key properties: reflexive, symmetric, transitive, antisymmetric
  • Visualise with internal diagrams, matrices, or directed graphs