**3.5 Relations and Functions**

Topics covered in this section are:

- Find the domain and range of a relation
- Determine if a relation is a function
- Find the value of a function

**3.5.1 Find the Domain and Range of a Relation**

As we go about our daily lives, we have many data items or quantities that are paired to our names. Our social security number, student ID number, email address, phone number and our birthday are matched to our name. There is a relationship between our name and each of those items.

When your professor gets her class roster, the names of all the students in the class are listed in one column and then the student ID number is likely to be in the next column. If we think of the correspondence as a set of ordered pairs, where the first element is a student name and the second element is that student’s ID number, we call this a **relation**.

**(Student name, Student ID #)**

The set of all the names of the students in the class is called the **domain** of the relation and the set of all student ID numbers paired with these students is the range of the relation.

There are many similar situations where one variable is paired or matched with another. The set of ordered pairs that records this matching is a relation.

**RELATION**

A **relation** is any set of ordered pairs, $(x, y)$. All the $x$-values in the ordered pairs together make up the **domain**. All the $y$-values in the ordered pairs together make up the **range**.

**Example 1**

For the relation $\{(1, 1), (2, 4), (3, 9), (4, 16), (5, 25)\}$:

- Find the domain of the relation.
- Find the range of the relation.

**Solution**

$\{(1, 1), (2,4), (3, 9), (4, 16), (5, 25) \}$ | |

The domain is the set of all $x$-values of the relation. | $\{1, 2, 3, 4, 5\}$ |

The range is the set of all $y$-values of the relation. | $\{1, 4, 9, 16, 25\}$ |

**MAPPING**

A **mapping** is sometimes used to show a relation. The arrows show the pairing of the elements of the domain with the elements of the range.

**Example 2**

Use the **mapping** of the relation shown to:

- list the ordered pairs of the relation
- find the domain of the relation
- find the range of the relation

**Solution**

- The arrow shows the matching of the person to their birthday. We create ordered pairs with the person’s name as the $x$-value and their birthday as the $y$-value.

{(Alison, April 25), (Penelope, May 23), (June, August 2), (Gregory, September 15), (Geoffrey, January 12), (Lauren, May 10), (Stephen, July 24), (Alice, February 3), (Liz, August 2), (Danny, July 24)}

- The domain is the set of all $x$-values of the relation.

{Alison, Penelope, June, Gregory, Geoffrey, Lauren, Stephen, Alice, Liz, Danny} - The range is the set of all $y$-values of the relation.

{January 12, February 3, April 25, May 10, May 23, July 24, August 2, September 15}

A graph is yet another way that a relation can be represented. The set of ordered pairs of all the points plotted is the relation. The set of all $x$-coordinates is the domain of the relation and the set of all $y$-coordinates is the range. Generally we write the numbers in ascending order for both the domain and range.

**Example 3**

Use the graph of the relation to:

- list the ordered pairs of the relation
- find the domain of the relation
- find the range of the relation

**Solution**

- The ordered pairs of the relation are: $\{(1, 5), (-3, -1), (4, -2), (0, 3), (2, -2), (-3, 4)\}$.
- The domain is the set of all $x$-values of the relation: $\{-3, 0, 1, 2, 4\}$.

Notice that while $-3$ repeats, it is only listed once. - The range is the set of all $y$-values of the relation: $\{-2, -1, 3, 4, 5\}$.

Notice that while $-2$ repeats, it is only listed once.

**3.5.2 Determine if a Relation is a Function**

A special type of relation, called a **function**, occurs extensively in mathematics. A function is a relation that assigns to each element in its domain exactly one element in the range. For each ordered pair in the relation, each $x$-value is matched with only one $y$-value.

**FUNCTION**

A **function** is a relation that assigns to each element in its domain exactly one element in the range.

The birthday example from Example 2 helps us understand this definition. Every person has a birthday but no one has two birthdays. It is okay for two people to share a birthday. It is okay that Danny and Stephen share July 24^{th} as their birthday and that June and Liz share August 2^{nd}. Since each person has exactly one birthday, the relation in Example 2 is a function.

The relation shown by the graph in Example 3 includes the ordered pairs $(-3, -1)$ and $(-3, 4)$. Is that okay in a function? No, as this is like one person have two different birthdays.

**Example 4**

Use the set of ordered pairs to (i) determine whether the relation is a function (ii) find the domain of the relation (iii) find the range of the relation.

- $\{(−3, 27), (−2, 8), (−1, 1), (0, 0), (1, 1), (2, 8), (3, 27)\}$
- $\{(9, −3), (4, −2), (1, −1), (0, 0), (1, 1), (4, 2), (9, 3)\}$

**Solution**

- $\{(−3, 27), (−2, 8), (−1, 1), (0, 0), (1, 1), (2, 8), (3, 27)\}$

(i) Each $x$-value is matched with only one $y$-value. So this relation is a function.

(ii) The domain is the set of all $x$-values in the relation. The domain is: $\{−3, −2, −1, 0, 1, 2, 3\}$.

(iii) The range is the set of all $y$-values in the relation. Notice we do not list range values twice. The range is $\{27, 8, 1, 0\}$.

- $\{(9, −3), (4, −2), (1, −1), (0, 0), (1, 1), (4, 2), (9, 3)\}$

(i) The $x$-value $9$ is matched with two $y$-values, both $3$ and $−3$. So this relation is not a function.

(ii) The domain is the set of all $x$-values in the relation. Notice we do not list domain values twice. The domain is: $\{0, 1, 2, 4, 9\}$.

(iii) The range is the set of all $y$-values in the relation. The range is: $\{−3, −2, −1, 0, 1, 2, 3\}$.

**Example 5**

Use the mapping to:

- determine whether the relation is a function
- find the domain of the relation
- find the range of the relation

**Solution**

- Both Lydia and Marty have two phone numbers. So each $x$-value is not matched with only one $y$-value. So this relation is not a function.
- The domain is the set of all $x$-values in the relation. The domain is: {Lydia, Eugene, Janet, Rick, Marty}
- The range is the set of all $y$-values in the relation. The range is: $\{321-549-3327, 427-658-2314, 321-964-7324, 684-358-7961,6 84-369-7231, 798-367-8541\}$.

In algebra, more often than not, functions will be represented by an equation. It is easiest to see if the equation is a function when it is solved for $y$. If each value of $x$ results in only one value of $y$, then the equation defines a function.

**Example 6**

Determine whether each equation is a function. Assume $x$ is the independent variable.

- $2x+y=7$
- $y=x^{2}+1$
- $x+y^2=3$

**Solution**

- $2x+y=7$

For each value of $x$, we multiply by $-2$ and then add $7$ to get the $y$-value.

$y=-2x+7$ | |

For example, if $x=3$ | $y=-2 \cdot \textcolor{red}{3} + 7$ |

$y=1$ |

We have that when $x=3$, then $y=1$. It would work similarly for any value of $x$. Since each value of $x$, corresponds to only one value of $y$ the equation defines a function.

- $y=x^{2}+1$

For each value of $x$, we square it and then add $1$ to get the $y$-value.

$y=x^{2}+1$ | |

For example, if $x=2$ | $y=2^{\textcolor{red}{2}} + 1$ |

$y=5$ |

We have that when $x=2$, then $y=5$. It would work similarly for any value of $x$. Since each value of $x$, corresponds to only one value of *y* the equation defines a function.

- $x+y^{2}=3$

$x+y^{2}=3$ | |

Isolate the $y$-term. | $y^{2}=-x+3$ |

Let’s substitute $x=2$ | $y^{2}=-\textcolor{red}{2}+3$ |

$y^{2}=1$ | |

This gives us two values for $y$. | $y=1$ and $y=-1$ |

We have shown that when $x=2$, then $y=1$ and $y=−1$. It would work similarly for any value of $x$. Since each value of $x$ does not corresponds to only one value of $y$ the equation does not define a function.

**3.5.3 Find the Value of a Function**

It is very convenient to name a function and most often we name it $f, g, h, F, G$, or $H$. In any function, for each $x$-value from the domain we get a corresponding $y$-value in the range. For the function $f$, we write this range value $y$ as $f(x)$. This is called function notation and is read $f$ of $x$ or the value of $f$ at* *$x$. In this case the parentheses does not indicate multiplication.

**FUNCTION NOTATION**

For the function $y=f(x)$

$ \ \ \ \ \ \ \ \ \ \ f$ is the name of the function

$ \ \ \ \ \ \ \ \ \ \ x$ is the domain value

$ \ \ \ \ \ \ \ \ \ \ f(x)$ is the range value $y$ corresponding to the value $x$

We read $f(x)$ as $f$ of $x$ or the value of $f$ at $x$.

We call $x$ the independent variable as it can be any value in the domain. We call $y$ the dependent variable as its value depends on $x$.

**INDEPENDENT AND DEPENDENT VARIABLES**

For the function $y=f(x)$,

$\ \ \ \ \ x$ is the independent variable as it can be any value in the domain

$\ \ \ \ \ y$ is the dependent variable as its value depends on $x$

Much as when you first encountered the variable $x$, function notation may be rather unsettling. It seems strange because it is new. You will feel more comfortable with the notation as you use it.

Let’s look at the equation $y=4x−5$. To find the value of $y$ when $x=2$, we know to substitute $x=2$ into the equation and then simplify.

$y=4x-5$ | |

Let $x=2$ | $y=4 \cdot \textcolor{red}{2} – 5$ |

$y=3$ |

The value of the function at $x=2$ is $3$.

We do the same thing using function notation, the equation $y=4x−5$ can be written as $f(x)=4x−5$. To find the value when $x=2$, we write:

$f(x)=4x-5$ | |

Let $x=2$ | $f(2)=4 \cdot \textcolor{red}{2} – 5$ |

$f(2)=3$ |

The value of the function at $x=2$ is $3$.

This process of finding the value of $f(x)$ for a given value of $x$ is called *evaluating* *the function.*

**Example 7**

For the function $f(x)=2x^{2}+3x-1$, evaluate the function.

- $f(3)$
- $f(-2)$
- $f(a)$

**Solution**

**Part 1**

$f(x)=2x^{2}+3x-1$ | |

To evaluate $f(3)$, substitute $3$ for $x$. | $f(\textcolor{red}{3})=2(\textcolor{red}{3})^{2}+3 \cdot \textcolor{red}{3} – 1$ |

Simplify. | $f(3)=2 \cdot 9 + 3 \cdot 3 – 1$ |

$f(3)=18+9-1$ | |

$f(3)=26$ |

**Part 2**

$f(x)=2x^{2}+3x-1$ | |

To evaluate $f(-2)$, substitute $\textcolor{red}{-2}$ for $x$. | $f(\textcolor{red}{-2})=2(\textcolor{red}{-2})^{2}+3 (\textcolor{red}{-2}) – 1$ |

Simplify. | $f(-2)=2 \cdot 4 + (-6) – 1$ |

$f(-2)=8+(-6)-1$ | |

$f(-2)=1$ |

**Part 3**

$f(x)=2x^{2}+3x-1$ | |

To evaluate $f(a)$, substitute $a$ for $x$. | $f(\textcolor{red}{a})=2(\textcolor{red}{a})^{2}+3 \cdot \textcolor{red}{a} – 1$ |

Simplify. | $f(a)=2a^{2}+3a – 1$ |

In the last example, we found $f(x$) for a constant value of $x$. In the next example, we are asked to find $g(x)$ with values of $x$ that are variables. We still follow the same procedure and substitute the variables in for the $x$.

**Example 8**

For the function $g(x)=3x-5$, evaluate the function.

- $g(h^{2})$
- $g(x+2)$
- $g(x)+g(2)$

**Solution**

**Part 1**

$g(x)=3x-5$ | |

To evaluate $g(h^{2})$, substitute $h^{2}$ for $x$. | $g(\textcolor{red}{h^{2}})=3\textcolor{red}{h^{2}} – 5$ |

$g(h^{2})=3h^{2}-5$ |

**Part 2**

$g(x)=3x-5$ | |

To evaluate $g(x+2)$, substitute $x+2$ for $x$. | $g(\textcolor{red}{x+2})=3(\textcolor{red}{x+2}) – 5$ |

$g(x+2)=3x+6-5$ | |

$g(x+2)=3x+1$ |

**Part 3**

$g(x)=3x-5$ | |

To evaluate $g(x)+g(2)$, first find $g(2)$. | $g(\textcolor{red}{2})=3 \cdot \textcolor{red}{2}) – 5$ |

$g(2)=1$ | |

Now find $g(x)+g(2)$ | |

Simplify. | $g(x)+g(2)=3x-5+1$ |

$g(x)+g(2)=3x-4$ |

Notice the difference between part 2 and part 3. We get $g(x+2)=3x+1$ and $g(x)+g(2)=3x-4$. So we see that $g(x+2)≠g(x)+g(2)$.

Many everyday situations can be modeled using functions.

**Example 9**

The number of unread emails in Sylvia’s account is $75$. This number grows by $10$ unread emails a day. The function $N(t)=75+10t$ represents the relation between the number of emails, $N$, and the time, $t$, measured in days.

- Determine the independent and dependent variable.
- Find $N(5)$. Explain what this result means.

**Solution**

- The number of unread emails is a function of the number of days. The number of unread emails, $N$, depends on the number of days, $t$. Therefore, the variable $N$, is the dependent variable and the variable $t$ is the independent variable.
- Find $N(5)$. Explain what this result means.

$N(t)=75+10t$ | |

Substitute in $t=5$. | $N(\textcolor{red}{5})=75+10 \cdot \textcolor{red}{5}$ |

Simplify. | $N(5)=75+50$ |

$N(5)=125$ |

Since $5$ is the number of days, $N(5)$, is the number of unread emails after $5$ days. After $5$ days, there are $125$ unread emails in the account.

*Licenses & Attributions*

*Licenses & Attributions*

*CC Licensed Content, Original*

*Revision and Adaption. Provided by: Minute Math. License: CC BY 4.0*

*CC Licensed Content, Shared Previously*

*Marecek, L., & Mathis, A. H. (2020). Relations and Functions. In Intermediate Algebra 2e. OpenStax. https://openstax.org/books/intermediate-algebra-2e/pages/3-5-relations-and-functions*.*License: CC BY 4.0. Access for free at https://openstax.org/books/intermediate-algebra-2e/pages/1-introduction*