[Home](https://learningfolio.de5.net/) / [Math](https://learningfolio.de5.net/math/) / [Math glossary](https://learningfolio.de5.net/math/glossary/) / Relation in Maths: Definition, Types, and Worked Examples

[Math glossary](https://learningfolio.de5.net/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.

Written by **Learningfolio Team**

We’re subject-matter experts in math, science, parent support, and education, with 100 years of combined experience. We believe in learning, experimenting, and growing, and we review one another’s work.

## On this page

* [TL;DR](https://learningfolio.de5.net/math/relation-in-maths/#tldr)
* [Key Points](https://learningfolio.de5.net/math/relation-in-maths/#key-points)
* [What is a relation in maths?](https://learningfolio.de5.net/math/relation-in-maths/#what-is-a-relation-in-maths)
* [How do you represent a relation?](https://learningfolio.de5.net/math/relation-in-maths/#how-do-you-represent-a-relation)
* [How do you find the domain, range, and codomain?](https://learningfolio.de5.net/math/relation-in-maths/#how-do-you-find-the-domain-range-and-codomain)
* [How can you tell if a relation is a function?](https://learningfolio.de5.net/math/relation-in-maths/#how-can-you-tell-if-a-relation-is-a-function)
* [What are reflexive, symmetric, and transitive relations?](https://learningfolio.de5.net/math/relation-in-maths/#what-are-reflexive-symmetric-and-transitive-relations)
* [Where are relations used outside the classroom?](https://learningfolio.de5.net/math/relation-in-maths/#where-are-relations-used-outside-the-classroom)
* [Six Worked Examples of Relations](https://learningfolio.de5.net/math/relation-in-maths/#six-worked-examples-of-relations)
* [Common Mistakes With Relations](https://learningfolio.de5.net/math/relation-in-maths/#common-mistakes-with-relations)
* [Try It Yourself](https://learningfolio.de5.net/math/relation-in-maths/#try-it-yourself)
* [Conclusion](https://learningfolio.de5.net/math/relation-in-maths/#conclusion)
* [Read More](https://learningfolio.de5.net/math/relation-in-maths/#read-more)
* [Research Behind This Article](https://learningfolio.de5.net/math/relation-in-maths/#research-behind-this-article)

## 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 $A$ to a set $B$ is a subset of the Cartesian product $A\times B$.
* Ordered pairs have a direction. The pair $(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 $A$ contains the days Monday and Tuesday and $B$ contains the clubs Art and Chess. The **Cartesian product** $A\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 $(\text{Monday},\text{Art})$ and $(\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 $aRb$, the letters mean that $a$ is related to $b$ by $R$. This is another way to write $(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\}$ and $B=\{2,4,6\}$. Set $R$ to contain the pairs for which $y=2x$.

| Representation | How it works for this relation |
| --- | --- |
| Roster form | List the pairs $\{(1,2),(2,4),(3,6)\}$. |
| Set-builder notation | Write $\{(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)$, $(2,4)$, and $(3,6)$ as separate points. |

The set restrictions in the rule matter. Drawing a continuous line would add pairs such as $(1.5,3)$, which the declared sets exclude even though $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](https://learningfolio.de5.net/math/coordinate-plane-and-ordered-pairs/) 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 $B$. Some texts call $A$ the source set. It can include elements that do not appear in the domain of an arbitrary relation.

If $A=\{1,2,3\}$, $B=\{2,4,6,8\}$ and $R=\{(1,2),(1,4),(3,4)\}$, the domain is $\{1,3\}$ and the range is $\{2,4\}$. The codomain remains $B$. Include each value only once, even when several pairs use the same coordinate. The [domain and range guide](https://learningfolio.de5.net/math/functions-domain-range-and-input-output/) 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](https://learningfolio.de5.net/assets/versioned/relation-mapping-domain-range.9dac8e663299.webp)


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 $A$ to $B$**, every element of $A$ 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 $x$ with different $y$ 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](https://openstax.org/books/college-algebra-2e/pages/3-1-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)$ has the reverse pair $(b,a)$. |
| Antisymmetric | If both directions exist, then $a=b$. |
| Transitive | Whenever $(a,b)$ and $(b,c)$ exist, $(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 $A$ to $B$ 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\}$ and $B=\{2,3,4\}$. List the pairs that satisfy $y=x+1$.

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

### Example 2

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

1. The first coordinates give $\{-2,0,2\}$.
2. The second coordinates give $\{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=y^2$ defines $y$ as a function of $x$ over real numbers.

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

### Example 4

On $\{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)$.
3. The even value gives $(2,2)$. These five pairs form a reflexive, symmetric and transitive relation.

### Example 5

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

1. The pair $(1,2)$ followed by $(2,3)$ requires $(1,3)$.
2. Adding $(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. The inverse contains $\{(5,1),(5,2),(8,3)\}$.
2. Its domain is $\{5,8\}$ and its range is $\{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)$, the domain value is 3. The pair $(7,3)$ is a different statement.

### Mistake 2: Treating repeated outputs as a function failure

Pairs $(1,5)$ and $(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)\}$. Is it a function?
2. Write the inverse relation of $\{(2,8),(4,9)\}$.
3. Is “has the same last digit as” an equivalence relation on nonnegative integers?

**Answers.** 1. Domain $\{0,1\}$ and range $\{2,5\}$. It fails the function test at 1. 2. $\{(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

* [Compare common types of functions](https://learningfolio.de5.net/math/types-of-functions/)
* [See how coordinate rules describe a line](https://learningfolio.de5.net/math/geometry/slope-of-a-line/)

## Research Behind This Article

1. OpenStax, *Intermediate Algebra 2e: Relations and Functions*. [OpenStax](https://openstax.org/books/intermediate-algebra-2e/pages/3-5-relations-and-functions)
2. OpenStax, *College Algebra 2e: Functions and Function Notation*. [OpenStax](https://openstax.org/books/college-algebra-2e/pages/3-1-functions-and-function-notation)
3. Dana C. Ernst, *An Introduction to Proof via Inquiry-Based Learning: Relations*. [LibreTexts](https://math.libretexts.org/Bookshelves/Mathematical_Logic_and_Proof/An_Introduction_to_Proof_via_Inquiry-Based_Learning_%28Ernst%29/07%3A_New_Page/7.01%3A_New_Page)
4. OpenStax, *Precalculus 2e: Domain and Range*. [OpenStax](https://openstax.org/books/precalculus-2e/pages/1-2-domain-and-range)
