 Lesson Explainer: Relations and Functions | Nagwa Lesson Explainer: Relations and Functions | Nagwa

# Lesson Explainer: Relations and Functions Mathematics

In this explainer, we will learn how to identify, represent, and recognize functions from arrow diagrams, graphs, and equations.

Before we begin discussing functions, let’s start with the more general term mapping. A mapping is a rule to take elements of one set and relate them with elements of another set. We can think of this as transforming elements of one set into one or more elements of another set.

We can represent mappings in many different ways. One way is to draw all the elements of both sets in a diagram and then sketch arrows from the elements in the first set to elements that are related or “mapped” in the second set. This is called a mapping diagram or an arrow diagram.

Let’s consider an example of a mapping that takes a number and maps it onto its prime divisors.

From the diagram, we see there is a single arrow from 2 to the element 2; this tells us that the only prime divisor of 2 is 2 itself. We can see that 3, 4, and 5 also have only one prime divisor. However, when we get to 6, we see there are two arrows: one to 2 and another to 3. This happens because 6 has two different prime divisors. We call this a one-to-many mapping since one element in can be mapped to more than one element in .

This is an important fact to note since this is the property that stops us from being able to consider this mapping a function. We recall that functions take an input and give us an output. This means we can represent functions using arrow diagrams; the domain is the inputs and the range is the set of all outputs given the domain. We then connect each input with its corresponding output with an arrow. For example, consider the function that doubles the value.

We see in the diagram that we take 2 as an input and the function doubles this value to 4.

In a function, we cannot have an input that gives multiple different outputs; the function always has to give the same output. This means that every element in the domain must have a single output. In our arrow diagram, this is equivalent to saying every element in the domain has a single arrow originating from it.

### Definition: Mappings and Functions

A mapping is a rule to take elements of one set and relate them with elements of another set.

A function is a mapping in which every element of the domain is mapped to a single element in the range.

Therefore, we can check if a mapping is not a function by determining if any element in the domain maps onto multiple elements in the range.

In the same way, we define a many-to-one function to be a function in which more than one input is mapped to the same output.

For example, consider the function that squares the integers between and 2.

We can see that there are multiple arrows pointing at 1 and 4 in the range. This tells us that many elements in the domain are mapped onto the same element in the range. For example, the squares of and 2 are both equal to 4. Thus, this is a many-to-one function.

If a mapping is a function and every element in the range has at most one element in the domain that maps onto it, then we call the function a one-to-one function. We can check if a function is one to one from an arrow diagram by checking the number of arrows ending at each element in the range. A function is not one to one if there is any element in the second set with more than one arrow ending at it.

For example, we can show that the function that squares the integers between and 2 is not a one-to-one function since many input values map onto the same output.

We can define these types of mappings and functions as follows.

### Definition: Types of Mapping

A one-to-many mapping is a mapping in which one element in the domain is mapped onto many elements in the range. These types of mappings are not functions.

A many-to-one mapping is one that maps many inputs onto the same output.

A one-to-one mapping is a function that is not many to one. Every element in the range must have a unique input associated with it.

It is worth reiterating that a function cannot be both many to one and one to one and that if a mapping is one to many, then it is not a function.

Another thing worth noting is that mappings and functions are defined entirely by how they map the elements of the domain. This means that we do not need a rule or equation to define a function since we only need to describe how the elements are mapped (e.g., using an arrow diagram). However, when dealing with mappings and functions, we will usually be given an equation or rule to link the inputs and outputs.

In our first example, we will determine whether a mapping in a given arrow diagram is one to one, one to many, or many to one.

### Example 1: Identifying the Type of Mapping from an Arrow Diagram

Determine whether the mapping in the given arrow diagram is one to one, one to many, or many to one.

We first recall that one-to-many mappings are ones that have elements in the domain being mapped to multiple elements in the range. We can determine if a mapping is one to many by checking if any element in the domain has 2 or more arrows originating from it.

We see that every element in the domain is mapped to a single element in the range, so this is not a one-to-many mapping. In fact, we can also notice that this is a function since every element in the domain is mapped to a single element in the range.

We can now recall that many-to-one functions are ones that have multiple inputs being mapped to the same output. We can see in the given diagram that both 1 and 4 are mapped to 1.

This means that the function must be many to one. We do not need to check if the mapping is one to one since a mapping cannot be both one to one and many to one. In particular, since the output, 1, has both 1 and 4 mapped onto it, the mapping is not one to one.

Hence, we were able to show that the arrow diagram shows a many-to-one function.

Arrow diagrams are not the only way of representing mappings; we can also sketch their graphs on a coordinate grid. To do this, we recall that we sketch a graph by marking the -coordinates of points in the domain and that the -coordinates are the values of the corresponding elements in the range.

This alternative way of representing mappings gives us alternative ways of determining the type of mapping. In the case of sketching graphs on a coordinate grid, we can check if a mapping is one to many by considering the maximum number of intersections between the graph and a vertical line.

For example, consider the mapping that takes a nonnegative real number and gives its square roots. We can represent this mapping with an equation; it is the values of that satisfy for nonnegative values of .

We know that there is both a positive and a negative root of any positive number, so we can sketch the graph of this map by sketching both and .

We can see that if we were to draw a vertical line , where , then the line would intersect the curve twice. For example, if we sketch , then we see that there are two points of intersection since 4 has two square roots: 2 and . This is equivalent to saying that the mapping maps 4 to two distinct values. Therefore, this is a one-to-many mapping.

In general, if any vertical line intersects the graph more than once, then that value is mapped to multiple values in the range. Hence, the graph represents a one-to-many mapping. We call this the vertical line test.

### Property: Vertical Line Test

If any vertical line intersects the graph of a mapping more than once, then the mapping is one to many.

If every vertical line intersects the graph of a mapping at most once, then the mapping is a function.

In the same way, we can determine if the graph of a function is one to one or many to one by considering the number of intersections between the graph and a horizontal line. To help us see this, consider the following graph of a parabola and a horizontal line.

We can see that this line intersects the graph twice. This means that there are two input values that give the same output; both and output 3. This means that the function is many to one. Therefore, if any horizontal line intersects the curve more than once, we have a many-to-one function. We call this the horizontal line test.

### Property: Horizontal Line Test

If any horizontal line intersects the graph of a function more than once, then the function is many to one.

If every horizontal line intersects the graph of a function at most once, then the function is one to one.

It is worth noting that we can restrict the domain of a mapping in order to make it a function by removing values in the domain that are mapped to multiple elements in the range. Similarly, we can restrict the domain of a function to make it one to one by removing elements in the domain with the same output. This is easier to do with the help of a graph. For example, in our parabola above, we can restrict the domain to so that all horizontal lines intersect the graph at most once.

Therefore, by the horizontal line test, the function is one to one on this domain.

In our next example, we will identify whether the given graph is a function and determine its mapping type.

### Example 2: Identifying Whether the Given Graph Is a Function and Determining Its Mapping Type

Determine whether the mapping represented in the graph below is a function of and whether it is one to one, one to many, or many to one.

We first recall that in the graph of a mapping the -coordinates of points on the curve represent the elements of the domain and that the corresponding -coordinates of any point on the curve are the corresponding elements in the range. We also recall that functions are mappings in which every element of the domain is mapped to a single element in the range.

We can check if a graph represents a function by checking if there are any two inputs that would map to multiple outputs. In a graph, this would be two points on the graph with the same -coordinate. We call this the vertical line test.

We can see in the given graph that there are points on the graph with the same -coordinate but different -coordinates. For example, the line intersects the curve twice.

This means that the element in the domain is mapped to two different values in the range, so the mapping is not a function. In particular, since there is an element in the domain that is mapped to many elements in the range, we say that the mapping is one to many.

We can apply this same reasoning to show that the mapping is not many to one. We see that any horizontal line intersects the graph at most once.

Thus, the mapping is not many to one.

Hence, we can conclude that this is not the graph of a function in since it is one to many.

In our next example, we will determine the type of a function and its range from its equation.

### Example 3: Identifying the Range and Type of Function

Find the range of the function with the domain , , and determine whether the function is one to one or many to one.

We first recall that the range of a function is the set of all possible outputs of a function given its domain. We can determine the range of a function by sketching its graph over its domain. To do this, we note that is the graph of translated 1 unit down. We also only want to sketch the curve for values of between and 3.

We can determine the -cooridnates of the endpoints of the curve by substituting and into the given function. We have

We can add this onto our sketch to get the following.

Since the values of and 3 are included in the domain, the endpoints of the curve are included in the graph. This means that 8 is an element of the range since . We can determine the range of a function from its graph by finding all the -coordinates of points that lie on the graph. Another way of thinking about this is the horizontal lines that intersect the curve.

We see that any horizontal line between and 8 intersects the curve, so any value between and 8 is an element of the range. We can also note that no other horizontal line intersects the curve. Thus, the range of the function is .

We can determine the type of the function from this sketch as well. We note that , either from the calculation above or from the horizontal line intersecting the curve twice. This means there are two inputs that map to the same output; we call functions like this many-to-one functions.

Hence, we were able to show that the range of the many-to-one function is .

In our next example, we will identify the arrow diagram of a given function.

### Example 4: Drawing the Arrow Diagram of a Function

Determine which of the following arrow diagrams represents the function , for .

In order to sketch an arrow diagram representing the function, we need to evaluate the function at each value in its domain. We are told the domain is , so we substitute these values into the function and evaluate to get

Therefore, in our arrow diagram, should be mapped to , 0 should be mapped to , and 1 should be mapped to 2. This gives us the following.

We can use an arrow diagram to determine the range of a function by recalling that the range of a function is the set of all output values of the function given its domain. The range of a function in an arrow diagram will be all of the elements with arrows pointing at them.

Hence, the range of , for , is .

In our final example, we will sketch the graph of a function in order to determine its range and type.

### Example 5: Sketching the Graph, Stating the Range, and Identifying the Type of a Function

By sketching the graph of , state the range of the function and determine whether it is a one-to-one or a many-to-one function.

We can sketch the graph of by noting that multiplying a function by a negative constant reflects its graph in the horizontal axis and then stretches it vertically by factor .

We reflect this in the horizontal axis to sketch .

We now need to stretch this curve vertically by a factor of 2. This gives us the following.

We note that since the graph of goes to infinity as approaches infinity, the graph of will go to negative infinity as approaches infinity. This allows us to determine its range by recalling that the range of a function is the set of possible outputs of the function given its domain.

We can determine the range of a function from its graph by finding the set of -coordinates of points on its curve. From the graph, we can see that any real number appears as an output of the function by seeing that any horizontal line intersects the curve.

Therefore, the range is all real values.

We can determine if the function is one to one or many to one by recalling that the horizontal line test tells us that a function is one to one if every horizontal line intersects its graph at most once. From the diagram, we can see that any horizontal line will intersect the graph exactly once, so the function is one to one.

Hence, the range of the function is , and it is one to one.

Let’s finish by recapping some of the important points from this explainer.

### Key Points

• A mapping is a rule to take elements of one set and relate them with elements of another set.
• A function is a mapping in which every element of the domain is mapped to a single element in the range.
• A one-to-many mapping is a mapping in which one element in the domain is mapped onto many elements in the range. These types of maps are not functions.
• A many-to-one mapping is one that maps many inputs onto the same output.
• A one-to-one mapping is a function that is not many to one. Every element in the range must have a unique input associated with it.
• The set of possible input values for a function is called its domain, and the set of all possible outputs of the function given its domain is called its range.
• If any vertical line intersects the graph of a mapping more than once, then the mapping is one to many. If every vertical line intersects the graph of a mapping at most once, then the mapping is a function.
• If any horizontal line intersects the graph of a function more than once, then the function is many to one. If every horizontal line intersects the graph of a function at most once, then the function is one to one.