What Are Relations and Functions?
A relation between two sets is any collection of ordered pairs $(x, y)$ — a record of which inputs are linked to which outputs. Formally, a relation from set $A$ to set $B$ is a subset of the Cartesian product $A \times B$ (all possible pairs).
A function is a relation with one restriction added: every input is paired with exactly one output. Different inputs may share an output, but no single input is allowed to map to two different outputs. So all functions are relations, but not all relations are functions — the most important sentence in the whole topic.
The set of all inputs is the domain; the set of all outputs that actually get used is the range; the set of all allowed outputs is the codomain. These three words come up constantly once you start classifying functions by type.
What Is the Difference Between a Relation and a Function?
The single test is this: does any input map to more than one output? If yes, it's a relation but not a function. If every input maps to exactly one output, it's a function.
Feature | Relation | Function |
|---|---|---|
Definition | Any set of ordered pairs | A relation where each input has one output |
Inputs to outputs | One input may have many outputs | One input has exactly one output |
Every one is a... | relation | relation and a function |
Example | ${(1, 2), (1, 3), (2, 4)}$ | ${(1, 2), (2, 4), (3, 6)}$ |
The relation example fails because the input $1$ appears with both $2$ and $3$. The function example passes because each input shows up only once. This is the same distinction the relation in math article develops in more detail on the relation side.
How Do You Tell if a Graph Is a Function?
Use the vertical line test: if any vertical line crosses the graph more than once, the graph is not a function. A vertical line at $x = a$ collects every output paired with that single input $a$; if it hits the curve twice, that input has two outputs, and the function rule breaks.
A circle $x^2 + y^2 = 25$ fails — a vertical line through the middle hits it top and bottom, so the input $x = 0$ gives both $y = 5$ and $y = -5$. A parabola $y = x^2$ passes, because every vertical line meets it exactly once. The vertical line test is the graph-level version of the one-input-one-output rule.
How Do You Read Domain and Range?
The domain is every $x$ you're allowed to feed in; the range is every $y$ that actually comes out. For the function ${(1, 4), (2, 5), (3, 6)}$, the domain is ${1, 2, 3}$ and the range is ${4, 5, 6}$.
For a formula like $f(x) = \sqrt{x}$, the domain is $x \geq 0$ (you can't take the real square root of a negative), and the range is $y \geq 0$. Reading domain and range correctly is what lets you write answers in interval notation — the bracket-and-parenthesis shorthand for "all values from here to there."
What Are the Types of Relations and Functions?
Relations get classified by how elements connect to themselves and each other. The standard list:
Empty relation — no pairs at all.
Universal relation — every possible pair is included.
Identity relation — each element related only to itself, ${(a, a)}$.
Reflexive — every element relates to itself.
Symmetric — if $a$ relates to $b$, then $b$ relates to $a$.
Transitive — if $a$ relates to $b$ and $b$ to $c$, then $a$ relates to $c$.
Equivalence relation — reflexive, symmetric, and transitive all at once.
Functions get classified by how inputs and outputs line up:
One-to-one (injective) — distinct inputs give distinct outputs. See the one to one function article for the full treatment.
Onto (surjective) — every output in the codomain is actually hit. The surjective function article covers this.
Many-to-one — several inputs share an output (like $x^2$).
Bijective — both one-to-one and onto.
Constant — every input maps to the same single output.
The two big families — injective and surjective — are the gateway to inverses and counting problems later, so they are worth meeting by name now even before you use them.
Examples of Relations and Functions
The examples move from spotting a function in a pair-set, through the most common reading mistake, to domain, range, and a real-world mapping.
Example 1
Is the relation ${(2, 4), (3, 9), (4, 16)}$ a function?
Check each input. $2, 3, 4$ each appear exactly once, each with a single output.
Final answer: yes, it's a function. (It's the squaring rule on those three inputs.)
Example 2
A common slip — is ${(1, 5), (2, 6), (1, 7)}$ a function?
Wrong attempt. A student scans the outputs — $5, 6, 7$, all different — and concludes "all outputs are distinct, so it's a function." The reasoning checks the wrong column.
Test the rule directly. The function condition is about inputs, not outputs. Look at the inputs: $1$ appears twice, paired once with $5$ and once with $7$.
Correct. The input $1$ maps to two different outputs, which the function rule forbids.
Final answer: no, it's a relation but not a function. The trap is checking whether outputs repeat instead of whether inputs do.
Example 3
Does the equation $y = 3x - 2$ define a function?
Pick any $x$ and the formula returns exactly one $y$. Its graph is a straight line, and every vertical line crosses a non-vertical line once.
Final answer: yes. Every linear equation of the form $y = mx + c$ is a function.
Example 4
State the domain and range of $f(x) = \dfrac{1}{x - 3}$.
The only forbidden input is $x = 3$ (division by zero), so the domain is all real numbers except $3$. The output can be any number except $0$ (the fraction never equals zero), so the range is all reals except $0$.
Final answer: domain ${x \in \mathbb{R} : x \neq 3}$, range ${y \in \mathbb{R} : y \neq 0}$.
Example 5
Is the relation "is the mother of" a function from people to people?
Each person has exactly one biological mother, so every input (a person) maps to exactly one output (their mother).
Final answer: yes, it's a function. By contrast, "is a sibling of" is not — a person can have several siblings, so one input maps to many outputs.
Example 6
A vending machine assigns each button code a single snack. Is this a function, and what are its domain and range?
Each code returns exactly one snack, so it's a function. The domain is the set of valid button codes; the range is the set of snacks actually stocked. If pressing one code could dispense two different items, the machine would be unusable — the same reason a function must give one output per input.
Final answer: yes — domain is the button codes, range is the available snacks.
Why Relations and Functions Sit at the Heart of Algebra
"A function is a machine: one thing in, one thing out, every time."
The modern word function traces to Gottfried Wilhelm Leibniz (1646–1716, Germany), who used it in 1673 for quantities that depend on a curve; Peter Gustav Lejeune Dirichlet (1805–1859, Germany) later gave the broad definition we use today — any rule pairing each input with one output, no formula required. That shift, from "function means a formula" to "function means a single-valued rule," is what lets functions describe almost anything.
Where the idea does real work:
Spreadsheets and code. Every spreadsheet formula and every programming function is literally a function in this sense — feed it inputs, get one defined output. A cell that returned two values would break the sheet.
Cause and effect in science. "Temperature as a function of time," "distance as a function of speed" — modelling the world means deciding what depends on what, then writing it as a function.
Inverses and undo operations. Only certain functions can be reversed, which is why the one-to-one and onto types matter — they decide whether an "undo" exists at all.
Where Students Trip Up on Relations and Functions
Mistake 1: Checking outputs instead of inputs
Where it slips in: Deciding whether a pair-set is a function by looking at whether the $y$-values repeat.
Don't do this: Conclude "the outputs are all different, so it's a function" — or "an output repeats, so it isn't."
The correct way: The function rule is about inputs. Repeated outputs are completely fine ($f(x) = x^2$ sends both $2$ and $-2$ to $4$ and is still a function). A repeated input with different outputs is what breaks it.
Mistake 2: Confusing domain with range
Where it slips in: Asked for the domain, the reader lists the output values.
Don't do this: Treat "domain" and "range" as interchangeable.
The correct way: Domain is the inputs (the $x$-values you're allowed to use); range is the outputs (the $y$-values that come out). A quick memory hook: domain comes first alphabetically and first in the pair $(x, y)$.
Mistake 3: Thinking every relation is a function
Where it slips in: Assuming the two words are synonyms.
Don't do this: Use "relation" and "function" as if they mean the same thing.
The correct way: Every function is a relation, but most relations are not functions. The memorizer who stores "they're basically the same" gets blindsided the first time a circle or a one-to-many mapping appears.
Key Takeaways
A relation is any set of input-output pairs; a function is a relation where every input has exactly one output.
All functions are relations, but most relations are not functions — the defining rule is one input, one output.
The vertical line test decides whether a graph is a function; domain is the inputs, range is the outputs.
The most common mistake is checking whether outputs repeat instead of whether inputs do.
The main function types — one-to-one, onto, many-to-one, bijective, constant — are the gateway to inverses and later counting problems.
Where to Go From Here
Decide whether ${(0, 1), (1, 2), (0, 3)}$ is a function, and explain which rule it tests.
State the domain and range of $f(x) = \sqrt{x - 2}$.
Use the vertical line test to decide whether $x = y^2$ defines a function.
Answer to Question 1: not a function — the input $0$ maps to both $1$ and $3$. Answer to Question 2: domain $x \geq 2$, range $y \geq 0$. Answer to Question 3: not a function — $x = 4$ gives $y = 2$ and $y = -2$. If Question 1 tripped you, return to Mistake 1 and check the input column.
Want a live Bhanzu trainer to walk through more relations and functions problems? Book a free demo class — online globally.
Was this article helpful?
Your feedback helps us write better content