topic badge

2.01 Functions and relations

Relations

A relation is a set of ordered pairs which represent a relationship.

For example, we can think of the names of people in a math class and their ages as ordered pairs, like \left(\text{Bob}, 13 \right). These pairs of information represent a relation.

If we chose a specific age (like 13), we could list all the names of the people who are this age. It could be one person, Bob, or it could be multiple. If a teacher wanted to look for the person who was 13 years old, that description might fit four people which means there's not one clear answer.

We can express the same relation in several different ways: as a mapping, a set of ordered pairs, an input-output table, a graph in the coordinate plane, or as an equation in terms of x and/or y that describes a graph.

A mapping diagram shows how the input values are assigned one or more output values. Consider the mapping below:

An image showing an example of a mapping of a relation. Ask your teacher for more information.

\, \, \,

\, \, \,

A mapping of a relation

We can write an input-output table from the mapping, making sure that each pair is represented. Remember that the first value of a relation is an input value and the second value is the output value. The input is the value of x that is applied to the relation. The output is the y, or the answer that is received as a result of putting x into the relation. A table can be laid out horizontally (like the one shown below) or vertically.

x-1012
y2024

This also corresponds to the set of ordered pairs \{(-1, 2), (0, 0), (1, 2), (2, 4)\}, which can be graphed in the coordinate plane, as shown below.

-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y

A graph of the relation represents the (x, y) pairs in the coordinate plane.

Examples

Example 1

Write the relation \{(2, 2), (4, 4), (6, 3), (7, 5)\} in the table below.

x2467
y
Worked Solution
Create a strategy

Write the second coordinate of each ordered pair in the y row, below the x-value it corresponds to.

Apply the idea
x2467
y2435

Example 2

Consider the relation: \{(-9, -5), (-5, -10), (-5, -4), (-3, 7), (-2, -4), (-1, 1)\}. Represent the relation on the coordinate plane.

Worked Solution
Create a strategy

The first value of each ordered pair tells us how to move along the x-axis, while the second value tells us how to move along the y-axis.

Apply the idea
-8
-6
-4
-2
2
x
-10
-8
-6
-4
-2
2
4
6
8
y

Example 3

A relation is defined as follows: y=-4 if x is positive and y=4 if x is 0 or negative.

a

Complete the table.

x-4-3-2-101234
y
Worked Solution
Create a strategy

For each positive x-value: y=-4, otherwise y=4.

Apply the idea

When x=1, \, 2, \, 3 , \, 4: y=-4.

When x=0, \, -1, \, -2, \, -3, \, -4: y=4.

x-4-3-2-101234
y44444-4-4-4-4
b

Plot the points on the coordinate plane.

Worked Solution
Create a strategy

Plot the points from the completed table in part (a).

Apply the idea
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Idea summary

A relation is a set of ordered pairs which represent a relationship.

We can express the same relation in several different ways: as a mapping, a set of ordered pairs, an input-output table, a graph in the coordinate plane, or as an equation in terms of x and/or y that describes a graph.

Functions

A function is a special type of relation where each input only has one output. Functions are a way of connecting input values to their corresponding output values.

A function machine with the input arrow on the left leading to the word function in a box with an output arrow on the right

For example, if we think about placing an order for boba teas, the number of boba teas we order (the input) affects the amount we have to pay (the output).

A graphic with three rows. The first row has one boba tea with a right facing arrow pointing to 3 US dollars, the second row with 2 boba teas with a right facing arrow pointing to 6  US dollars, and the third row with thre boba teas with a right facing arrow pointing to  9 US dollars.

\, \\Let's say each boba tea costs \$3. If we bought one boba tea, it would cost \$3, if we bought two boba teas, it would cost \$6 and so on.

Notice how the value of the input (the number of boba teas) always produces exactly one output (cost)?

This is an example of a function.

 A graphic with three rows. The first row has one boba tea with a right facing arrow pointing to 3 US dollars, the second row with 2 boba teas with a one right facing arrow pointing to 6  US dollars and another right facing arrow pointing to 10 US dollars, and the third row with 3 boba teas with a right facing arrow pointing to  9 US dollars.

\, \\However, if our friend also ordered 2 boba teas, but was charged \$10 while we paid \$6, we may be confused and assume that the cash register miscalculated the price.

This is not a function.

A set of 4 function machines representing -2x. They show input values of -1, 0, 1, and 2, and show outputs of 2, 0, -2, and -4. The inside of the function machine should show the operations that occur.

\, \\Another way to look at functions is to look at how inputs map to their output values. The function machine shown represents the relationship y=-2x.

Each input going into the machine is multiplied by -2 and exits the machine as the output, or y-value.

If we put four input values of -1,\,0,\,1,\, and 2, into the machine, it gives four output values of 2,\,0,\,-2,\, and -4.

Notice how each x-value is associated with only one y-value. This means y=-2x is a function.

If you can write a relationship between x and y then we can see that there is a relation. However, if this relationship only gives one value of y for each x-value (or one output for every input) then it is a function.

x-328-15-2
y-138-23-1

This table represents a relation that is a function since each input is only assigned one output. Notice that the output 3 repeats, but the relation is still a function since the inputs are unique.

x-123-1-3-2
y-13-3-431

This table represents a relation but not a function since the input -1 is paired with two outputs of -1 and -4.

Sets of ordered pairs can also show whether or not a relation is a function. The following set of ordered pairs is a function since one input matches to one output:

\left\{\left(-4,-1\right),\left(-2,0\right),\left(0,1\right),\left(2,0\right),\left(3,-2\right),\left(4,3\right)\right\}

This set of ordered pairs is not a function since the inputs of -4 and 2 each repeat with different outputs.

\left\{\left(-4,-1\right),\left(-4,3\right),\left(0,1\right),\left(2,2\right),\left(2,-2\right),\left(4,0\right)\right\}

Graphs can also show one input (x-value) paired with one output (y-value ). By graphing the previous set of ordered pairs, we see the graph of a function and the graph not representing a function.

-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Function
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Not a function
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Function
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Not a function

Examples

Example 4

This mapping shows the relation F.

a

Find the output when x=1.

Worked Solution
Create a strategy

We start from the input oval labeled x and follow the line(s) from 1 to the output value(s).

Apply the idea

When x=1, y=-1.

b

Determine if F is a function.

Worked Solution
Create a strategy

For a function, each x-value maps to a unique y-value.

Apply the idea

If we input x=2 into the mapping, we get both y=0 and y=1. This means that F is not a function.

Reflect and check

To be a function, each input value should only map to one output value. For example, G would be a function:

Example 5

The pairs of values in the table represent a relation between x and y.

x-8-7-6-3279910
y813-18-16-15-2-411-9

Do they represent a function?

Worked Solution
Create a strategy

The relation is a function if for every x-value, there is exactly one y-value.

Apply the idea

The x-value of 9 yields the y-values of -4 and 11. So, the points do not represent a function.

Example 6

Oprah makes scarves to sell at the market. It costs her \$2 to produce each one, and she sells them for \$5.

a

Complete the graph of the points representing the relation between the number of scarves she manages to sell and her total profit for when 1, 2, 3, 4 and 5 scarves are sold. The first point has been plotted for you.

-8
-6
-4
-2
2
4
6
8
10
\text{Quantity}
2
4
6
8
10
12
14
16
18
\text{Profit}
Worked Solution
Create a strategy

The total profit can be found using the formula:

\text{Total profit}= \text{Total revenue}-\text{Total cost}

Apply the idea

\text{Total revenue}=\text{Number of scarves sold}\cdot \$5

\text{Total cost}=\text{Number of scarves sold}\cdot \$2

\displaystyle \text{Profit for 1 scarf}\displaystyle =\displaystyle 1\cdot 5 - 1\cdot 2Substitute the number of scarves
\displaystyle =\displaystyle \$3Evaluate
\displaystyle \text{Profit for 2 scarves}\displaystyle =\displaystyle 2\cdot 5 - 2\cdot 2Substitute the number of scarves
\displaystyle =\displaystyle \$6Evaluate
\displaystyle \text{Profit for 3 scarves}\displaystyle =\displaystyle 3\cdot 5 - 3\cdot 2Substitute the number of scarves
\displaystyle =\displaystyle \$9Evaluate
\displaystyle \text{Profit for 4 scarves}\displaystyle =\displaystyle 4\cdot 5 - 4\cdot 2Substitute the number of scarves
\displaystyle =\displaystyle \$12Evaluate
\displaystyle \text{Profit for 5 scarves}\displaystyle =\displaystyle 5\cdot 5 - 5\cdot 2Substitute the number of scarves
\displaystyle =\displaystyle \$15Evaluate

Plot the pairs of values found.

1
2
3
4
5
6
7
8
9
\text{Quantity}
2
4
6
8
10
12
14
16
18
\text{Profit}
b

Is this relation a function?

Worked Solution
Create a strategy

This relation is a function if for every quantity sold, there is exactly one total profit.

Apply the idea

Checking each pair of values in the graph, each quantity of scarves sold is associated with only one total profit, so this relation does represent a function.

Idea summary

A relation is a function if and only if each element in the domain is paired with a unique element of the range.

The vertical line test

Exploration

Move the slider until the vertical line crosses the entire graph.

Press the 'Try another' button to try a new graph.

Loading interactive...
  1. What similarities did you notice in the graphs that were labeled as functions?

  2. How did the vertical line help you determine which graphs represented functions?

  3. Would a horizontal line be useful in determining if a relation is a function?

Sometimes it is easier to investigate the graph of a relation to determine whether or not it is a function. When looking at a graph, if you can draw a vertical line anywhere so that it crosses the graph of the relation in more than one place, then it is not a function.

Vertical line test

The graph of a relation is a function if a vertical line intersects the graph of a relation at exactly one point across the entire graph.

Here are two examples of relations being checked with the vertical line test. A function is said to "pass the vertical line test" while a relation that is not a function "fails the vertical line test."

-7
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
7
x
-7
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
7
y
Fails the vertical line test (is not a function)
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Passes the vertical line test (is a function)

One pair of points is enough to decide that a relation is not a function, but it is not enough to decide that a relation is a function. We must keep checking points on the graph until it either fails the test or we have checked for all x-values.

When classifying, remember that every function is a relation, but not every relation is a function.

Examples

Example 7

Determine whether the following graphs show functions.

a
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
x
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
y
Worked Solution
Create a strategy

Draw vertical lines throughout the graph and check whether each line crosses at only one point on the graph at a time.

Apply the idea
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
x
-6
-5
-4
-3
-2
-1
1
2
3
4
5
6
y

Each vertical line passes through the graph only once, so the graph is a function.

b
-8
-6
-4
-2
2
4
x
-4
-3
-2
-1
1
2
3
4
y
Worked Solution
Create a strategy

Draw vertical lines throughout the graph and check whether each line crosses at only one point on the graph at a time.

Apply the idea
-8
-6
-4
-2
2
4
x
-4
-3
-2
-1
1
2
3
4
y

The vertical lines shown cross the graph at multiple points, so the graph is not a function.

c
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y
Worked Solution
Create a strategy

Draw vertical lines throughout the graph and check whether each line crosses at only one point on the graph at a time.

Apply the idea
-4
-3
-2
-1
1
2
3
4
x
-4
-3
-2
-1
1
2
3
4
y

Each vertical line passes through the graph only once, so the graph is a function.

Idea summary

While all functions are relations, not all relations are functions.

The vertical line test for functions:

-5
-4
-3
-2
-1
1
2
3
4
5
x
-5
-4
-3
-2
-1
1
2
3
4
5
y

When looking at a graph, if you can draw a vertical line anywhere so that it crosses the graph of the relation in more than one place, then it is not a function.

Outcomes

A.F.2

The student will investigate, analyze, and compare characteristics of functions, including quadratic and exponential functions, and model quadratic and exponential relationships.

A.F.2a

Determine whether a relation, represented by a set of ordered pairs, a table, a mapping, or a graph is a function; for relations that are functions, determine the domain and range.

What is Mathspace

About Mathspace