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.
Extra practice: The Algebra 1 Unit 3 Practice Pack has printable problems, answer keys and a cheat sheet for this unit.
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?
Step 1. List the inputs. They are the first numbers in the pairs: -2, 0, 2 and 4.
Step 2. Look for an input that repeats. None of the inputs repeats.
Step 3. Look at the outputs. The output 3 shows up twice, for the inputs −2 and 2. Two inputs may share an output, so that is allowed.
Answer: Yes, it is a function. Each input has exactly one output.
Example 2: A table
Is this relation a function?
| x | 1 | 2 | 2 | 5 |
|---|---|---|---|---|
| y | 7 | 8 | 9 | 10 |
Step 1. Read the inputs from the top row: 1, 2, 2 and 5.
Step 2. Look for an input that repeats. The input 2 appears twice.
Step 3. Check its outputs. The first 2 goes to 8, and the second 2 goes to 9. One input has two different 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.
y = 3(-1) + 2 = -3 + 2 = -1
Step 1. Substitute x = -1. Multiply first, then add, using the order of operations. A positive times a negative is negative. (See multiplying and dividing integers.)
y = 3(0) + 2 = 0 + 2 = 2
Step 2. Substitute x = 0.
y = 3(2) + 2 = 6 + 2 = 8
Step 3. Substitute x = 2.
Step 4. Decide. For any input, the rule is multiply by 3, then 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?
(3, 0),\ (3, 1),\ (3, -2)
Step 1. Name some points on x = 3. Every point has an x-value of 3.
Step 2. Check the input 3. It goes to 0, 1 and -2, and many more outputs. So x = 3 is not a function. It also fails the vertical line test, because it is itself a vertical line.
(0, 3),\ (1, 3),\ (-2, 3)
Step 3. Name some points on y = 3. Every point has a y-value of 3.
Step 4. Check the inputs. Each input has the one output 3, and a vertical line crosses this horizontal line only once. So y = 3 is a function.
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?
Step 1. For name → score, the inputs are the names: Ana, Ben, Cara and Dev. No name repeats.
Step 2. Each name has one score, so name → score is a function. Ana and Cara share the score 90, and that is allowed.
Step 3. For score → name, the inputs are the scores: 90, 85, 90 and 78. The input 90 repeats.
Step 4. Check its outputs. The score 90 goes to both Ana and Cara. One input has two outputs, so score → name 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
1.
List the inputs: 1, 3 and 5
Look for a repeat: no input repeats
It is a function.
2.
List the inputs: 2, 2 and 3
Look for a repeat: the input 2 appears twice. It goes to 1 and to -1
It is not a function.
3.
List the inputs: -1, 0 and 1
Look for a repeat: no input repeats
All three inputs share the output 4. Sharing an output is allowed
It is a function.
4.
List the inputs from the x-row: 0, 1, 2 and 3
Look for a repeat: no input repeats. The outputs 5 and 6 repeat, which is allowed
It is a function.
5.
List the inputs from the x-row: 4, 4, 5 and 6
Look for a repeat: the input 4 appears twice. It goes to 1 and to 2
It is not a function.
6.
Count the arrows from each input: 1 has one arrow, 2 has one arrow, and 3 has one arrow
Inputs 1 and 2 both point to 3. Sharing an output is allowed
It is a function.
7.
Decide: the rule is multiply by −2, then add 5. That gives one output for each input, so it is a function
y = -2(3) + 5
Substitute x = 3.
y = -6 + 5
Multiply.
y = -1
Add.
8.
Look at x = -4: it is a vertical line. The input -4 has many outputs, like (-4, 0) and (-4, 1). So it is not a function
Look at y = -4: it is a horizontal line. Each input has the one output -4. So it is a function
9.
Draw the vertical line x = 3 through the two given points
It crosses the circle twice, at (3, 4) and (3, -4). The input 3 has two outputs
It is not a function.
10.
Button → snack: each button gives one snack, so it is a function
Snack → button: the input chips goes to both A1 and A3, so it is not a function
Want more practice? The Algebra 1 Unit 3 Practice Pack has 39 pages of problems on this and the other lessons in the unit, with step-by-step answers and a cheat sheet.
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