Relations and Functions
A relation is any set of ordered pairs that links inputs to outputs. A function is a relation where each input has exactly one output. To tell if a relation is a function, check that no input repeats with a different output. On a graph, use the vertical line test.
Before this lesson: You should know how to plot ordered pairs on the coordinate plane and how to evaluate algebraic expressions.
What Are Relations and Functions?
Think of a vending machine. You press a button (the input), and a snack comes out (the output). If you press B4, you expect the same snack every time. That is how a function works.
A relation is any pairing of inputs and outputs. We usually write it as ordered pairs (x, y). The input is x, and the output is y.
Some relations are not functions. If one input could give two different outputs, the rule is not a function. A vending machine that gave chips one time and a cookie the next time for the same button would be broken.
A mapping diagram makes this easy to see. It lists the inputs on the left and the outputs on the right. An arrow joins each input to its output.
Notice the left diagram. Inputs 1 and 3 both go to 4. That is fine. Two inputs may share an output. What breaks a function is one input with two outputs.
The Rule: How to Tell If a Relation Is a Function
A relation is a function if every input has exactly one output.
- List the inputs (the x-values).
- Look for any input that appears more than once.
- If a repeated input has a different output each time, the relation is not a function.
- If no input has two different outputs, the relation is a function.
For a graph, use the vertical line test. Imagine a vertical line sliding across the graph from left to right. If the line ever crosses the graph at two or more points, the graph is not a function.
Why does this work? Two points on one vertical line have the same x but different y values. That is one input with two outputs.
Relations and Functions Examples
Example 1: Ordered pairs
Is the relation \{(-2, 3), (0, 1), (2, 3), (4, 5)\} a function?
The inputs are -2, 0, 2 and 4. No input repeats. The output 3 shows up twice, but that is allowed.
Answer: Yes, it is a function.
Example 2: A table
Is this relation a function?
| x | 1 | 2 | 2 | 5 |
|---|---|---|---|---|
| y | 7 | 8 | 9 | 10 |
The input 2 appears twice. It goes to 8 and also to 9. One input has two outputs.
Answer: No, it is not a function.
Example 3: An equation
Is y = 3x + 2 a function? Find the outputs for x = -1, 0 and 2.
\begin{aligned}
x = -1: \quad y &= 3(-1) + 2 = -1 \\
x = 0: \quad y &= 3(0) + 2 = 2 \\
x = 2: \quad y &= 3(2) + 2 = 8
\end{aligned}Each time, you multiply by 3 and add 2. There is only one way to do that, so each x gives exactly one y.
Answer: Yes, it is a function. The outputs are -1, 2 and 8.
Example 4: Vertical and horizontal lines
Is the line x = 3 a function? What about y = 3?
The line x = 3 is vertical. It holds points like (3, 0), (3, 1) and (3, -2). The input 3 has many outputs, so it fails the vertical line test.
The line y = 3 is horizontal. Each input has the one output 3. A vertical line crosses it only once.
Answer: x = 3 is not a function. y = 3 is a function. See horizontal and vertical lines for more.
Example 5: Word problem
A teacher lists each student’s name and test score: Ana 90, Ben 85, Cara 90, Dev 78. Is name → score a function? Is score → name a function?
Name → score: each student has one score. No name repeats. So this is a function.
Score → name: the input 90 goes to both Ana and Cara. One input has two outputs. So this is not a function.
Answer: Name → score is a function. Score → name is not.
Common Mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Thinking a repeated output breaks the function | Saying \{(1, 5), (2, 5)\} is not a function | Only repeated inputs matter. Two inputs can share an output. |
| Using a horizontal line test | Saying a U-shaped curve fails because a flat line crosses it twice | Use a vertical line. It checks one input at a time. |
| Reading the table the wrong way | Checking the y row for repeats | Check the input row (x) for repeats. |
| Calling a vertical line a function | Saying x = 2 is a function | x = 2 has one input with every output. It is not a function. |
Four Ways to Show a Function
The same idea shows up in every form. Here is what to check in each one.
| Form | Example | How to check |
|---|---|---|
| Ordered pairs | \{(1, 2), (3, 4)\} | No x-value repeats with a different y-value |
| Table | x row and y row | No number in the x row repeats with a different y |
| Mapping diagram | Arrows from inputs to outputs | Each input has exactly one arrow |
| Graph | A line or curve | Passes the vertical line test |
| Equation | y = 3x + 2 | Each x-value gives only one y-value |
Equations whose graphs are slanted lines, like those in slope-intercept form, are always functions. The only lines that are not functions are vertical lines.
Practice Problems
Decide whether each relation is a function. Explain why.
- \{(1, 2), (3, 4), (5, 6)\}
- \{(2, 1), (2, -1), (3, 0)\}
- \{(-1, 4), (0, 4), (1, 4)\}
- A table with x: 0, 1, 2, 3 and y: 5, 5, 6, 6
- A table with x: 4, 4, 5, 6 and y: 1, 2, 3, 4
- A mapping diagram with arrows 1 → 3, 2 → 3 and 3 → 7
- y = -2x + 5. Also find y when x = 3.
- The lines x = -4 and y = -4
- A circle centered at (0, 0) that passes through (3, 4) and (3, -4)
- A vending machine: button A1 gives chips, A2 gives pretzels, A3 gives chips. Is button → snack a function? Is snack → button a function?
Show answers
- Function. The inputs 1, 3 and 5 do not repeat.
- Not a function. The input 2 goes to both 1 and −1.
- Function. The inputs differ. Every input sharing the output 4 is fine.
- Function. The inputs 0, 1, 2 and 3 do not repeat.
- Not a function. The input 4 goes to both 1 and 2.
- Function. Each input has one arrow. Inputs 1 and 2 may share the output 3.
- Function. Each x gives one y. When x = 3: y = -2(3) + 5 = -1.
- x = -4 is vertical, so it is not a function. y = -4 is horizontal, so it is a function.
- Not a function. The vertical line x = 3 crosses the circle at (3, 4) and (3, -4).
- Button → snack is a function, since each button gives one snack. Snack → button is not, since chips go to both A1 and A3.
Relations and Functions FAQ
What is the difference between a relation and a function?
A relation is any set of input-output pairs. A function is a special relation where each input has exactly one output. Every function is a relation, but not every relation is a function.
How do you know if a graph is a function?
Use the vertical line test. If any vertical line crosses the graph more than once, it is not a function.
Can a function have the same y-value twice?
Yes. Different inputs can share an output. For example, (1, 5) and (2, 5) can both be in a function.
Is a vertical line a function?
No. A vertical line like x = 2 has one input with endless outputs. Every other straight line is a function.
Summary
- A relation pairs inputs with outputs, often as ordered pairs.
- A function gives each input exactly one output.
- Look for a repeated input with different outputs. If you find one, it is not a function.
- Repeated outputs are fine.
- On a graph, use the vertical line test.
Previous lesson: Absolute Value Inequalities
Next lesson: Function Notation
Back to the Algebra 1 Index
