Definition and Representation of Relations

A relation in mathematics is any rule or correspondence that pairs elements from one set with elements of another set. In everyday life, we encounter relations constantly: a student is enrolled in a class, a city is located in a country, or a number is less than another number. In formal mathematics, a relation from set A to set B is defined as any subset of the Cartesian product A × B — that is, any collection of ordered pairs (a, b) where a ∈ A and b ∈ B. Relations are fundamental to nearly all of mathematics. They allow us to describe how objects are connected, ordered, or associated. Before we can fully understand functions — which are a special, restricted kind of relation — we must understand what relations are, how they are written, and how they can be visualised. The study of relations bridges arithmetic and abstract algebra, and appears in areas ranging from computer science (databases) to physics (describing physical laws). Relations can be represented in four main ways: as a set of ordered pairs, as a mapping diagram (arrow diagram), as a table, or as a graph on the coordinate plane. Each representation highlights different aspects of the correspondence, and being fluent in all four is an essential skill for this unit. As you work through this article, pay close attention to the vocabulary of domain, codomain, and range — these terms will reappear throughout the entire study of Relations and Functions.

Key takeaways
  • The Cartesian Product
  • Defining a Relation
  • Domain, Codomain, and Range
  • Set-Builder and Roster Notation
  • Mapping (Arrow) Diagrams
  • Graphical Representation

The Cartesian Product

Given two sets A and B, their Cartesian product A × B is the set of all possible ordered pairs (a, b) where a ∈ A and b ∈ B. For example, if A = {1, 2} and B = {x, y, z}, then A × B = {(1,x),(1,y),(1,z),(2,x),(2,y),(2,z)}. Note that order matters: (1, x) ≠ (x, 1). The size of the Cartesian product is |A| × |B|; here 2 × 3 = 6 pairs.

Defining a Relation

A relation R from set A to set B is any subset of A × B. We write a R b (read 'a is related to b') when (a, b) ∈ R. For instance, with A = {1,2,3} and B = {1,4,9}, the relation R = {(1,1),(2,4),(3,9)} pairs each number with its square. There is no requirement that every element of A must appear, and one element of A may pair with multiple elements of B — that is what distinguishes a general relation from a function.

Domain, Codomain, and Range

For a relation R from A to B: the domain is the set of all first elements (inputs) that actually appear in R; the codomain is the full set B (all possible outputs); and the range (or image) is the set of second elements (outputs) that actually appear in R. The range is always a subset of the codomain. Example: if R = {(1,2),(1,3),(2,5)}, the domain = {1,2}, the range = {2,3,5}. If B = {1,2,3,4,5}, the codomain = {1,2,3,4,5} but range ≠ codomain since 1 and 4 do not appear.

Set-Builder and Roster Notation

A relation can be written in roster form by listing all ordered pairs: R = {(1,3),(2,6),(3,9)}. Alternatively, set-builder notation describes the rule: R = {(x,y) | y = 3x, x ∈ {1,2,3}}. Set-builder notation is especially useful when the relation is infinite, such as R = {(x,y) | y ≥ x, x,y ∈ ℝ}, which describes the half-plane on or above the line y = x.

Mapping (Arrow) Diagrams

A mapping diagram uses two ovals — one for the domain elements and one for the codomain elements — with arrows showing which elements are paired. An element in the domain oval can have one arrow, multiple arrows, or no arrow at all. If every element in the domain oval has exactly one arrow, and no domain element has two arrows pointing to different codomain elements, the relation is a function. Mapping diagrams make it easy to check this condition visually.

Graphical Representation

When A and B are subsets of ℝ, a relation can be graphed on the coordinate plane. Each ordered pair (x, y) ∈ R corresponds to a point. A discrete relation such as {(1,2),(2,4),(3,6)} gives isolated points. A continuous relation like R = {(x,y) | y = x²} gives a smooth parabola. The vertical line test for functions emerges naturally here: if any vertical line crosses the graph at more than one point, then some x-value is paired with more than one y-value, meaning the relation is not a function.

The Key Equation

R⊆A×B={(a,b)∣a∈A,  b∈B}R \subseteq A \times B = \{(a,b) \mid a \in A,\; b \in B\}
  • R — Relation (none): The relation itself — a set of ordered pairs representing the correspondence between elements of A and elements of B.
  • A — Domain set (none): The set from which the first elements (inputs) of the ordered pairs are chosen.
  • B — Codomain set (none): The set from which the second elements (outputs) of the ordered pairs are chosen.
  • A \times B — Cartesian product (none): The set of all possible ordered pairs (a, b) with a from A and b from B. R is a subset of this larger set.
  • (a,b) — Ordered pair (none): A pairing of an element a from A with an element b from B. Order matters: (a,b) ≠ (b,a) in general.

Worked Example

Problem. Let A = {2, 3, 4, 5} and B = {4, 6, 8, 10, 25}. Define the relation R from A to B by the rule: (x, y) ∈ R if y = 2x or y = x². (a) List R as a set of ordered pairs. (b) State the domain and range of R. (c) Is R a function? Explain.

R={(2,4),(3,6),(4,8),(5,10),(5,25)};Dom(R)={2,3,4,5};Range(R)={4,6,8,10,25}R = \{(2,4),(3,6),(4,8),(5,10),(5,25)\};\quad \text{Dom}(R)=\{2,3,4,5\};\quad \text{Range}(R)=\{4,6,8,10,25\}

Answer. R = {(2,4),(3,6),(4,8),(5,10),(5,25)}; domain = {2,3,4,5}; range = {4,6,8,10,25}. R is not a function because the element 5 in the domain is paired with two different elements (10 and 25) in B.

Figure
Diagram
Relation R: y = 2x on A={1,2,3,4}Domain A1234Codomain B246810Each element of A maps to exactly one element of B: a function.
Origins · 1 minGeorg Cantor and how this was discovered
GC
Georg Cantor
1845–1918 · German

Georg Cantor developed the modern theory of sets, which provides the rigorous foundation for defining relations. His creation of set theory in the 1870s–1890s gave mathematics the language of sets, subsets, and Cartesian products that we use today to define a relation as a subset of A × B. Cantor also introduced the notion of cardinality, allowing mathematicians to compare the sizes of infinite sets, and showed that different infinities exist — for example, the set of real numbers is strictly larger than the set of natural numbers. Cantor's work was so controversial that the leading mathematician of his era, Leopold Kronecker, called him a 'corrupter of youth' and tried to block publication of his papers. Despite fierce opposition, Cantor's set theory eventually became the universal foundation of modern mathematics, and David Hilbert later declared that 'no one shall expel us from the paradise that Cantor has created.'

  • Definition of a Function — A function is a special type of relation in which every element of the domain is paired with exactly one element of the codomain. Understanding the general definition of a relation is the essential prerequisite for recognising what makes a function more restrictive.
  • Domain and Range — The concepts of domain, codomain, and range introduced here are explored in much greater depth when studying functions, especially when determining the domain and range from equations, graphs, and real-world contexts.
  • The Vertical Line Test — The vertical line test is the graphical method for determining whether a relation represented on the coordinate plane is a function. It builds directly on the graphical representation of relations introduced in this article.
  • Cartesian Product of Sets — A relation is formally defined as a subset of a Cartesian product. Studying the Cartesian product in depth — including how to compute it and understand its size — reinforces the set-theoretic foundation of relations.