Math glossary

Relation in Maths: Definition, Types, and Worked Examples

Represent a relation using ordered pairs, rules, tables, mapping diagrams or graphs. Check its domain, range, and whether it is a function.

TL;DR

A relation in maths is a set of ordered pairs. The domain is the first coordinates used and the range is the second coordinates used. A function assigns each input exactly one output.

Key Points

  • A relation from a set AA to a set BB is a subset of the Cartesian product A×BA\times B.
  • Ordered pairs have a direction. The pair (2,5)(2,5) places 2 first and 5 second.
  • Roster notation lists pairs, while set-builder notation describes the rule that selects them.
  • Repeating an input with different outputs makes a relation fail the function test.
  • Symmetry and transitivity describe how a relation on a single set links its elements.

What is a relation in maths?

Pick two sets. Suppose AA contains the days Monday and Tuesday and BB contains the clubs Art and Chess. The Cartesian product A×BA\times B lists every possible day–club pair. A weekly schedule is a relation if it selects only the pairs on which an activity actually meets.

For instance, the pairs (Monday,Art)(\text{Monday},\text{Art}) and (Monday,Chess)(\text{Monday},\text{Chess}) might both belong to the schedule. Monday has two clubs. A relation allows that. If a different rule supplies the start time of each club, and each club has exactly one start time, that rule can be a function.

In the notation aRbaRb, the letters mean that aa is related to bb by RR. This is another way to write (a,b)∈R(a,b)\in R. Empty relations are possible since the empty set is a subset of any Cartesian product. A relation can also contain every pair.

How do you represent a relation?

Take A={1,2,3}A=\{1,2,3\} and B={2,4,6}B=\{2,4,6\}. Set RR to contain the pairs for which y=2xy=2x.

Representation How it works for this relation
Roster form List the pairs {(1,2),(2,4),(3,6)}\{(1,2),(2,4),(3,6)\}.
Set-builder notation Write {(x,y)∈A×B:y=2x}\{(x,y)\in A\times B:y=2x\}.
Mapping diagram Draw one arrow from 1 to 2, one from 2 to 4, and one from 3 to 6.
Table Use one column for the first coordinate and one for the second.
Coordinate graph Plot (1,2)(1,2), (2,4)(2,4), and (3,6)(3,6) as separate points.

The set restrictions in the rule matter. Drawing a continuous line would add pairs such as (1.5,3)(1.5,3), which the declared sets exclude even though 3=2(1.5)3=2(1.5). Use a continuous graph only when the relation includes every point along the line or curve in the specified interval. Review the Cartesian plane if you are new to plotting points.

How do you find the domain, range, and codomain?

The domain of a relation is the set of first coordinates that actually appear. Its range is the set of second coordinates that actually appear. The codomain is the declared target set BB. Some texts call AA the source set. It can include elements that do not appear in the domain of an arbitrary relation.

If A={1,2,3}A=\{1,2,3\}, B={2,4,6,8}B=\{2,4,6,8\} and R={(1,2),(1,4),(3,4)}R=\{(1,2),(1,4),(3,4)\}, the domain is {1,3}\{1,3\} and the range is {2,4}\{2,4\}. The codomain remains BB. Include each value only once, even when several pairs use the same coordinate. The domain and range guide explains how to read both sets from a larger graph.

Mapping arrows show 1 linked to 2 and 4 and 3 linked to 4, while source value 2 and target values 6 and 8 are unused
Follow the arrows. Values at their tails belong to the domain and values at their tips belong to the range.

How can you tell if a relation is a function?

Check each input in the stated domain. A function assigns exactly one output to each of them. Two inputs can share an output. If the problem asks for a function from all of AA to BB, every element of AA needs an output.

On a graph, imagine sliding a vertical line from left to right. If the line hits two distinct points, both points share the same xx with different yy values. That relation fails the vertical-line test. A horizontal line asks a different question. If a function’s graph passes the horizontal-line test, no two inputs share an output and the function is one-to-one. OpenStax, Functions and Function Notation

What are reflexive, symmetric, and transitive relations?

These properties apply when both coordinates come from the same set.

Property Test
Reflexive Every element pairs with itself.
Symmetric Every pair (a,b)(a,b) has the reverse pair (b,a)(b,a).
Antisymmetric If both directions exist, then a=ba=b.
Transitive Whenever (a,b)(a,b) and (b,c)(b,c) exist, (a,c)(a,c) exists too.

“Has the same number of letters as” is reflexive, symmetric, and transitive for words. Such a relation is called an equivalence relation. It divides a word list into groups by length. The relation ≤\le on numbers is reflexive, antisymmetric, and transitive. The guide to relation properties shows how to check these conditions with counterexamples.

Where are relations used outside the classroom?

A database can store pairs of student IDs and class IDs to represent class registrations. One student can appear in multiple pairs and a class can have multiple students. Repeated names do not cause confusion when the IDs are distinct.

A directed graph records one-way connections. Its arrows might show which tasks must finish before others start. For example, a route map can record a one-way street from AA to BB without including the reverse pair. Reversing every pair gives the inverse relation. In the registration example, this switches a student-to-class view to a class-to-student view.

Six Worked Examples of Relations

Example 1

Let A={1,2,3}A=\{1,2,3\} and B={2,3,4}B=\{2,3,4\}. List the pairs that satisfy y=x+1y=x+1.

  1. Input 1 gives 2, input 2 gives 3, and input 3 gives 4.
  2. All outputs belong to BB.
  3. The roster is {(1,2),(2,3),(3,4)}\{(1,2),(2,3),(3,4)\}.

Example 2

Find the domain and range of R={(−2,4),(0,4),(2,7)}R=\{(-2,4),(0,4),(2,7)\}.

  1. The first coordinates give {−2,0,2}\{-2,0,2\}.
  2. The second coordinates give {4,7}\{4,7\} after removing the duplicate 4.
  3. Each input has one output, so this relation is a function on its domain.

Example 3

Decide whether x=y2x=y^2 defines yy as a function of xx over real numbers.

  1. Set x=9x=9. Both y=3y=3 and y=−3y=-3 satisfy the equation.
  2. The vertical line x=9x=9 meets the graph twice.
  3. Restricting to y≥0y\ge0 leaves y=xy=\sqrt{x}, which does define a function for x≥0x\ge0.

Example 4

On {1,2,3}\{1,2,3\}, a relation contains pairs whose sum is even. Find the roster.

  1. The two coordinates need the same parity.
  2. The odd values 1 and 3 give (1,1),(1,3),(3,1),(3,3)(1,1),(1,3),(3,1),(3,3).
  3. The even value gives (2,2)(2,2). These five pairs form a reflexive, symmetric and transitive relation.

Example 5

On {1,2,3}\{1,2,3\}, start with R={(1,2),(2,3)}R=\{(1,2),(2,3)\}. Add the fewest pairs needed for transitivity.

  1. The pair (1,2)(1,2) followed by (2,3)(2,3) requires (1,3)(1,3).
  2. Adding (1,3)(1,3) creates no further two-step chains.
  3. The resulting relation contains exactly three pairs.

Example 6

Reverse the pairs in {(1,5),(2,5),(3,8)}\{(1,5),(2,5),(3,8)\}.

  1. The inverse contains {(5,1),(5,2),(8,3)}\{(5,1),(5,2),(8,3)\}.
  2. Its domain is {5,8}\{5,8\} and its range is {1,2,3}\{1,2,3\}.
  3. The original relation is a function. The inverse is a relation with two outputs for 5.

Common Mistakes With Relations

Mistake 1: Switching the coordinates while reading a pair

In (3,7)(3,7), the domain value is 3. The pair (7,3)(7,3) is a different statement.

Mistake 2: Treating repeated outputs as a function failure

Pairs (1,5)(1,5) and (2,5)(2,5) can coexist in a function because the inputs differ. Repeated outputs affect whether a function is one-to-one.

Mistake 3: Calling the full target set the range

First identify the target set, then mark which values actually have incoming arrows. Only those values belong to the range.

Try It Yourself

  1. List the domain and range of {(0,2),(1,2),(1,5)}\{(0,2),(1,2),(1,5)\}. Is it a function?
  2. Write the inverse relation of {(2,8),(4,9)}\{(2,8),(4,9)\}.
  3. Is “has the same last digit as” an equivalence relation on nonnegative integers?

Answers. 1. Domain {0,1}\{0,1\} and range {2,5}\{2,5\}. It fails the function test at 1. 2. {(8,2),(9,4)}\{(8,2),(9,4)\}. 3. Yes. Equality of last digits is reflexive, symmetric, and transitive.

Conclusion

  • Write one ordered pair for each allowed match.
  • Read the used first and second coordinates before comparing them with the target set.
  • Check each input for one output before naming the relation a function.

Read More

Research Behind This Article

  1. OpenStax, Intermediate Algebra 2e: Relations and Functions. OpenStax
  2. OpenStax, College Algebra 2e: Functions and Function Notation. OpenStax
  3. Dana C. Ernst, An Introduction to Proof via Inquiry-Based Learning: Relations. LibreTexts
  4. OpenStax, Precalculus 2e: Domain and Range. OpenStax