Skip to content

Relations and Functions

By the end of this section, you will be able to: find the domain and range of a relation, determine if a relation is a function, and find the value of a function.

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 #)(\text{Student name},\ \text{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)(x,y). All the xx-values in the ordered pairs together make up the domain. All the yy-values in the ordered pairs together make up the range.

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

(a) Find the domain of the relation.

(b) Find the range of the relation.

Solution.

(a) The domain is the set of all xx-values of the relation: {1,2,3,4,5}\{1,2,3,4,5\}.

(b) The range is the set of all yy-values of the relation: {1,4,9,16,25}\{1,4,9,16,25\}.

For the relation {(1,1),(2,8),(3,27),(4,64),(5,125)}\{(1,1),(2,8),(3,27),(4,64),(5,125)\}, enter the domain as a comma-separated list.

For the relation {(1,3),(2,6),(3,9),(4,12),(5,15)}\{(1,3),(2,6),(3,9),(4,12),(5,15)\}, enter the range as a comma-separated list.

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. Use the mapping of the relation shown to (a) list the ordered pairs of the relation, (b) find the domain of the relation, and (c) find the range of the relation.

NameBirthday
AlisonApril 25
PenelopeMay 23
JuneAugust 2
GregorySeptember 15
GeoffreyJanuary 12
LaurenMay 10
StephenJuly 24
AliceFebruary 3
LizAugust 2
DannyJuly 24

Solution. (a) The arrow shows the matching of the person to their birthday. We create ordered pairs with the person’s name as the xx-value and their birthday as the yy-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)}\{(\text{Alison},\text{April 25}),(\text{Penelope},\text{May 23}), (\text{June},\text{August 2}),(\text{Gregory},\text{September 15}), (\text{Geoffrey},\text{January 12}),(\text{Lauren},\text{May 10}), (\text{Stephen},\text{July 24}),(\text{Alice},\text{February 3}), (\text{Liz},\text{August 2}),(\text{Danny},\text{July 24})\}.

(b) The domain is the set of all xx-values of the relation: {Alison,Penelope,June,Gregory,Geoffrey,Lauren,Stephen,Alice,Liz,Danny}\{\text{Alison},\text{Penelope},\text{June},\text{Gregory}, \text{Geoffrey},\text{Lauren},\text{Stephen},\text{Alice},\text{Liz}, \text{Danny}\}.

(c) The range is the set of all yy-values of the relation: {January 12,February 3,April 25,May 10,May 23,July 24,August 2,September 15}\{\text{January 12},\text{February 3},\text{April 25},\text{May 10}, \text{May 23},\text{July 24},\text{August 2},\text{September 15}\}.

In the source mapping, Khanh Nguyen is paired with which student ID number?

In the source mapping, Maria is paired with which birthday?

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 xx-coordinates is the domain of the relation and the set of all yy-coordinates is the range. Generally we write the numbers in ascending order for both the domain and range.

Example. Use the graph of the relation to (a) list the ordered pairs of the relation, (b) find the domain of the relation, and (c) find the range of the relation.

xy

Solution. (a) The ordered pairs of the relation are {(1,5),(3,1),(4,2),(0,3),(2,2),(3,4)}\{(1,5),(-3,-1),(4,-2),(0,3),(2,-2),(-3,4)\}.

(b) The domain is the set of all xx-values of the relation: {3,0,1,2,4}\{-3,0,1,2,4\}. Notice that while 3-3 repeats, it is only listed once.

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

For the source graph with points (3,3),(2,2),(1,0),(0,1),(2,2),(4,4)(-3,3),(-2,2),(-1,0),(0,-1),(2,-2),(4,-4), enter the domain as a comma-separated list.

For the source graph with points (3,0),(3,5),(3,6),(1,2),(1,2),(4,4)(-3,0),(-3,5),(-3,-6),(-1,-2),(1,2),(4,-4), enter the range as a comma-separated list in the order shown in the Answer Key.

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 xx-value is matched with only one yy-value.

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

The birthday example 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 as their birthday and that June and Liz share August 2. Since each person has exactly one birthday, the relation in the example is a function.

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

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

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

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

Solution. (a) Each xx-value is matched with only one yy-value. So this relation is a function. The domain is {3,2,1,0,1,2,3}\{-3,-2,-1,0,1,2,3\}. The range is {27,8,1,0}\{27,8,1,0\}; we do not list range values twice.

(b) The xx-value 99 is matched with two yy-values, both 33 and 3-3. So this relation is not a function. The domain is {0,1,4,9}\{0,1,4,9\}; we do not list domain values twice. The range is {3,2,1,0,1,2,3}\{-3,-2,-1,0,1,2,3\}.

Is the relation {(3,6),(2,4),(1,2),(0,0),(1,2),(2,4),(3,6)}\{(-3,-6),(-2,-4),(-1,-2),(0,0),(1,2),(2,4),(3,6)\} a function?

Is the relation {(27,3),(8,2),(1,1),(0,0),(1,1),(8,2),(27,3)}\{(27,-3),(8,-2),(1,-1),(0,0),(1,1),(8,2),(27,3)\} a function?

Example. Use the mapping to (a) determine whether the relation is a function, (b) find the domain of the relation, and (c) find the range of the relation.

The mapping pairs Lydia with 321-549-3327 home and 321-964-7324 cell; Eugene with 427-658-2314 cell; Janet with 427-658-2314 cell; Rick with 798-367-8541 cell; and Marty with 684-358-7961 home and 684-369-7231 cell.

Solution. (a) Both Lydia and Marty have two phone numbers. So each xx-value is not matched with only one yy-value. So this relation is not a function.

(b) The domain is {Lydia,Eugene,Janet,Rick,Marty}\{\text{Lydia},\text{Eugene},\text{Janet},\text{Rick}, \text{Marty}\}.

(c) The range is {321-549-3327,427-658-2314,321-964-7324,684-358-7961,684-369-7231,798-367-8541}\{321\text{-}549\text{-}3327, 427\text{-}658\text{-}2314,321\text{-}964\text{-}7324, 684\text{-}358\text{-}7961,684\text{-}369\text{-}7231, 798\text{-}367\text{-}8541\}.

The source mapping pairs NBC with three programs, HGTV with three programs, and HBO with three programs. Is the relation a function?

In the source phone-number mapping, Neal, Krystal, Kelvin, George, Christa, and Mike are each paired with exactly one number. Is the relation a function?

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 yy. If each value of xx results in only one value of yy, then the equation defines a function.

Example. Determine whether each equation is a function. Assume xx is the independent variable.

(a) 2x+y=72x+y=7   (b) y=x2+1y=x^2+1   (c) x+y2=3x+y^2=3

Solution. (a) For each value of xx, we multiply it by 2-2 and then add 77 to get the yy-value. For example, if x=3x=3:

y=2x+7Substitute x=3.y=23+7y=1 \begin{array}{lrcl} & y &=& -2x+7 \\[4pt] \text{Substitute }x=3. & y &=& -2\cdot3+7 \\[4pt] & y &=& 1 \end{array}

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

(b) For each value of xx, we square it and then add 11 to get the yy-value. For example, if x=2x=2:

y=x2+1Substitute x=2.y=22+1y=5 \begin{array}{lrcl} & y &=& x^2+1 \\[4pt] \text{Substitute }x=2. & y &=& 2^2+1 \\[4pt] & y &=& 5 \end{array}

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

(c)

x+y2=3Isolate the y term.y2=x+3Let’s substitute x=2.y2=2+3y2=1This gives us two values for y.y=1,1 \begin{array}{lrcl} & x+y^2 &=& 3 \\[4pt] \text{Isolate the }y\text{ term.} & y^2 &=& -x+3 \\[4pt] \text{Let's substitute }x=2. & y^2 &=& -2+3 \\[4pt] & y^2 &=& 1 \\[4pt] \text{This gives us two values for }y. & y &=& 1,-1 \end{array}

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

Determine whether 4x+y=34x+y=-3 defines yy as a function of xx.

Determine whether x+y2=4x+y^2=4 defines yy as a function of xx.

Find the value of a function

It is very convenient to name a function and most often we name it ff, gg, hh, FF, GG, or HH. In any function, for each xx-value from the domain we get a corresponding yy-value in the range. For the function ff, we write this range value as f(x)f(x). This is called function notation and is read f of x or the value of ff at xx. In this case the parentheses does not indicate multiplication.

Function notation. For the function y=f(x)y=f(x):

  • ff is the name of the function.
  • xx is the domain value.
  • f(x)f(x) is the range value yy corresponding to the value xx.

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

We call xx the independent variable as it can be any value in the domain. We call yy the dependent variable as its value depends on xx.

Independent and dependent variables. For the function y=f(x)y=f(x), xx is the independent variable as it can be any value in the domain, and yy is the dependent variable as its value depends on xx.

Much as when you first encountered the variable xx, 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=4x5y=4x-5. To find the value of yy when x=2x=2, we know to substitute x=2x=2 into the equation and then simplify.

y=4x5Let x=2.y=425y=3 \begin{array}{lrcl} & y &=& 4x-5 \\[4pt] \text{Let }x=2. & y &=& 4\cdot2-5 \\[4pt] & y &=& 3 \end{array}

The value of the function at x=2x=2 is 33.

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

f(x)=4x5Let x=2.f(2)=425f(2)=3 \begin{array}{lrcl} & f(x) &=& 4x-5 \\[4pt] \text{Let }x=2. & f(2) &=& 4\cdot2-5 \\[4pt] & f(2) &=& 3 \end{array}

The value of the function at x=2x=2 is 33. This process of finding the value of f(x)f(x) for a given value of xx is called evaluating the function.

Example. For the function f(x)=2x2+3x1f(x)=2x^2+3x-1, evaluate the function.

(a) f(3)f(3)   (b) f(2)f(-2)   (c) f(a)f(a)

Solution.

f(x)=2x2+3x1To evaluate f(3), substitute 3 for x.f(3)=2(3)2+331Simplify.f(3)=29+331f(3)=18+91f(3)=26 \begin{array}{lrcl} & f(x) &=& 2x^2+3x-1 \\[4pt] \text{To evaluate }f(3),\text{ substitute }3\text{ for }x. & f(3) &=& 2(3)^2+3\cdot3-1 \\[4pt] \text{Simplify.} & f(3) &=& 2\cdot9+3\cdot3-1 \\[4pt] & f(3) &=& 18+9-1 \\[4pt] & f(3) &=& 26 \end{array} f(x)=2x2+3x1To evaluate f(2), substitute 2 for x.f(2)=2(2)2+3(2)1Simplify.f(2)=24+(6)1f(2)=8+(6)1f(2)=1 \begin{array}{lrcl} & f(x) &=& 2x^2+3x-1 \\[4pt] \text{To evaluate }f(-2),\text{ substitute }-2\text{ for }x. & f(-2) &=& 2(-2)^2+3(-2)-1 \\[4pt] \text{Simplify.} & f(-2) &=& 2\cdot4+(-6)-1 \\[4pt] & f(-2) &=& 8+(-6)-1 \\[4pt] & f(-2) &=& 1 \end{array} f(x)=2x2+3x1To evaluate f(a), substitute a for x.f(a)=2(a)2+3a1Simplify.f(a)=2a2+3a1 \begin{array}{lrcl} & f(x) &=& 2x^2+3x-1 \\[4pt] \text{To evaluate }f(a),\text{ substitute }a\text{ for }x. & f(a) &=& 2(a)^2+3\cdot a-1 \\[4pt] \text{Simplify.} & f(a) &=& 2a^2+3a-1 \end{array}

For f(x)=3x22x+1f(x)=3x^2-2x+1, evaluate f(3)f(3).

For f(x)=2x2+4x3f(x)=2x^2+4x-3, evaluate f(3)f(-3).

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

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

(a) g(h2)g(h^2)   (b) g(x+2)g(x+2)   (c) g(x)+g(2)g(x)+g(2)

Solution.

g(x)=3x5To evaluate g(h2), substitute h2 for x.g(h2)=3h25 \begin{array}{lrcl} & g(x) &=& 3x-5 \\[4pt] \text{To evaluate }g(h^2),\text{ substitute }h^2\text{ for }x. & g(h^2) &=& 3h^2-5 \end{array} g(x)=3x5To evaluate g(x+2), substitute x+2 for x.g(x+2)=3(x+2)5Simplify.g(x+2)=3x+65g(x+2)=3x+1 \begin{array}{lrcl} & g(x) &=& 3x-5 \\[4pt] \text{To evaluate }g(x+2),\text{ substitute }x+2\text{ for }x. & g(x+2) &=& 3(x+2)-5 \\[4pt] \text{Simplify.} & g(x+2) &=& 3x+6-5 \\[4pt] & g(x+2) &=& 3x+1 \end{array} g(x)=3x5To evaluate g(x)+g(2), first find g(2).g(2)=325g(2)=1Now find g(x)+g(2).g(x)+g(2)=3x5+1Simplify.g(x)+g(2)=3x4 \begin{array}{lrcl} & g(x) &=& 3x-5 \\[4pt] \text{To evaluate }g(x)+g(2),\text{ first find }g(2). & g(2) &=& 3\cdot2-5 \\[4pt] & g(2) &=& 1 \\[4pt] \text{Now find }g(x)+g(2). & g(x)+g(2) &=& 3x-5+1 \\[4pt] \text{Simplify.} & g(x)+g(2) &=& 3x-4 \end{array}

Notice the difference between parts (b) and (c). We get g(x+2)=3x+1g(x+2)=3x+1 and g(x)+g(2)=3x4g(x)+g(2)=3x-4. So we see that g(x+2)g(x)+g(2)g(x+2)\ne g(x)+g(2).

For g(x)=4x7g(x)=4x-7, evaluate g(m2)g(m^2).

For h(x)=2x+1h(x)=2x+1, evaluate h(x)+h(1)h(x)+h(1).

Many everyday situations can be modeled using functions.

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

(a) Determine the independent and dependent variable.

(b) Find N(5)N(5). Explain what this result means.

Solution. (a) The number of unread emails is a function of the number of days. The number of unread emails, NN, depends on the number of days, tt. Therefore, the variable NN is the dependent variable and the variable tt is the independent variable.

(b)

N(t)=75+10tSubstitute in t=5.N(5)=75+105Simplify.N(5)=75+50N(5)=125 \begin{array}{lrcl} & N(t) &=& 75+10t \\[4pt] \text{Substitute in }t=5. & N(5) &=& 75+10\cdot5 \\[4pt] \text{Simplify.} & N(5) &=& 75+50 \\[4pt] & N(5) &=& 125 \end{array}

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

Bryan's account has 100 unread emails and gains 15 a day, so N(t)=100+15tN(t)=100+15t. Find N(7)N(7).

Anthony's account has 110 unread emails and gains 25 a day, so N(t)=110+25tN(t)=110+25t. Find N(14)N(14).

Key terms

relation — any set of ordered pairs, (x,y)(x,y). domain of a relation — all the xx-values in the ordered pairs. range of a relation — all the yy-values in the ordered pairs. mapping — a representation of a relation in which arrows show the pairing of the elements of the domain with the elements of the range. function — a relation that assigns to each element in its domain exactly one element in the range. function notation — for the function y=f(x)y=f(x), f(x)f(x) is the range value yy corresponding to the domain value xx. independent variable — a variable that can be any value in the domain. dependent variable — a variable whose value depends on the independent variable.


This section is adapted from Intermediate Algebra 2e, Section 3.5: Relations and Functions by Lynn Marecek, Andrea Honeycutt Mathis, and OpenStax, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recreated the coordinate-plane figure as an accessible interactive graph; represented mapping figures as accessible tables or complete prose; omitted the Be Prepared quiz, media links, and end-of-section exercises; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback.