2.2.2: Graphing Linear Functions

Learning OutcomeS

  • Graph a linear function using a table of values
  • Graph a linear function using slope and yy-intercept
  • Graph vertical and horizontal lines
  • Identify parallel and perpendicular lines from a graph

Graphing Linear Functions Using Tables

One way to graph any function is to create a table of values. This is particularly useful when we do not know the general shape of the graphed function. We have already seen that the graph of a linear function is a line, but let’s make a table to see how it can be helpful.

To build a table of values we make a table consisting of two columns; one for xx and the other for y=f(x)y=f(x):

xx f(x)f(x)

We then choose several values for xx and enter them in separate rows in the xx column. The values we choose are totally up to us – there is no “right” or “wrong” values to pick, just go for it. It is a good idea to include negative values, positive values, and zero and ensure that we have enough points to determine the shape of the graph.

Suppose we’d like to graph the function f(x)=3x+2f(x)=3x+2. We start by adding our chosen xx-values to the table:

xx f(x)=3x+2f(x)=3x+2
22
11
00
11
33

We then evaluate the function for each chosen value of xx, and write the result in the f(x)f(x) column in the same row as  the xx value we used.

To evaluate the function values, we replace xx in the function with one of our chosen values:


xx

f(x)=3x+2f(x)=3x+2
22 f(2)=3(2)+2=4f(2)=3(2)+2=4
11 f(1)=3(1)+2=1f(1)=3(1)+2=1
00 f(0)=3(0)+2=2f(0)=3(0)+2=2
11 f(1)=3(1)+2=5f(1)=3(1)+2=5
33 f(3)=3(3)+2=11f(3)=3(3)+2=11

Note that your table of values may be different from someone else’s as you may each choose different values for xx.

Now that we have a table of values, we can use it to help us draw both the shape and location of the function by plotting (x,f(x))(x,f(x)) as coordinate points (x,y)(x,y). Each point we plot is a point on the graph. But there are an infinite number of points that make up the graph, so when we are sure the graph is a line, we join the dots using a straightedge to represent the entire graph.

The points negative 2, negative 4; the point negative 1, negative 1; the point 0, 2; the point 1, 5; the point 3, 11.

A line through the points in the previous graph.

Example 1

Graph f(x)=x+1f(x)=x+1.

Start with a table of values. Choose any values for xx that make sense to you, but remember that it is helpful to include 00, some positive values, and some negative values.


xx

f(x)=x+1f(x)=x+1
22 f(2)=(2)+1=3f(2)=(2)+1=3
11 f(1)=(1)+1=2f(1)=(1)+1=2
00 f(0)=(0)+1=1f(0)=(0)+1=1
11 f(1)=(1)+1=0f(1)=(1)+1=0
22 f(2)=(2)+1=1f(2)=(2)+1=1

Plot the points:                                                                                       Use a straightedge to draw the line:

The point negative 2, 3; the point negative 1, 2; the point 0, 1; the point 1, 0; the point 2, negative 1.

Line through the points in the last graph.

 

The following video shows an example of how to graph a linear function on a coordinate plane.

Example 2

Build a table of values then graph the function g(x)=3x4g(x)=3x4.

Solution

Choose any xx-values that include positives, negatives and 0, then determine the corresponding function values.

xx g(x)=3x4g(x)=3x4
-3 g(3)=3(3)4=13g(3)=3(3)4=13
-2 g(2)=3(2)4=10g(2)=3(2)4=10
0 g(0)=3(0)=4g(0)=3(0)=4
1  g(1)=3(1)4=1g(1)=3(1)4=1
4 g(4)=3(4)4=8g(4)=3(4)4=8

Now plot the points and join the dots:

Line creating by joining plotted points

Try It 1

Build a table of values then graph the function h(x)=2x+5h(x)=2x+5.

Try It 2

Build a table of values then graph the function h(x)=4x5h(x)=4x5.

Graphing Linear Functions Using Slope and y-Intercept

Another way to graph a linear function is by using its slope and yy-intercept. The slope and yy-intercept of a linear function define a unique function, consequently there is only one possible graph that represents the function. The yy-intercept gives us a starting point on the coordinate plane, while the slope determines the direction we go in to determine another point on the line. Once we have two points on the line, we have a unique line. However, it is always better to determine three or more points.

As an example, consider the function f(x)=12x+1f(x)=12x+1.

The function is in slope-intercept form, f(x)=mx+bf(x)=mx+b. so the slope is 1212 and the yy-intercept is the point (0, 1). Because the slope is positive, we know the graph will slant upward from left to right. The yyintercept is the point on the graph where the graph crosses the yy-axis. We can begin graphing by plotting the point (0,1)(0,1). We know that the slope m=riserunm=riserun, so the slope m=12m=12 means that the rise is 11 and the run is 22. Starting from our yy-intercept (0,1)(0,1), we can move vertically using the rise 11 and then move horizontally using the run 22, or first move horizontally using the run 22 and then move vertically using the rise 11 to get to the point (2, 2). We then repeat this process until we have a few points. Figure 1 shows this process and the result that all found points lie on a line. To form the complete line with an infinite number of coordinate points, we draw a line through the points (figure 1).

graph of the line y = (1/2)x +1 showing the "rise", or change in the y direction as 1 and the "run", or change in x direction as 2, and the y-intercept at (0,1)

Figure 1. Graph of f(x)=12x+1f(x)=12x+1

Graphical Interpretation of a Linear Function

The function f(x)=mx+bf(x)=mx+b is interpreted graphically as a line where,

  • bb is the yy-coordinate of the yy-intercept of the graph and indicates the point (0,b)(0,b) at which the graph crosses the yy-axis.
  • mm is the slope of the line and indicates the vertical displacement (rise) and horizontal displacement (run) between each successive pair of points.

All linear functions cross the yy-axis and therefore have yy-intercepts. The slope then locks in the direction and steepness of the line. This means that if we know the slope and yy-intercept, we know the unique graphical representation of the function.

Note: At this point you may be thinking that a vertical line parallel to the yy-axis does not have a yy-intercept. However, a vertical line is not a function as it represents a one-to-many mapping.

graphING A linear function using the y-intercept and slope

  1. Evaluate the function at x=0x=0 to find the yyintercept.
  2. Identify the slope.
  3. Plot the point represented by the yyintercept.
  4. Identify the rise and the run from the slope and use these to determine at least one more point on the line.
  5. Draw the unique line that passes through all of the points.

Example 3

Graph f(x)=23x+5f(x)=23x+5 using the yyintercept and slope.

Solution

Evaluate the function at x=0x=0 to find the yyintercept. f(0)=23(0)+5=5f(0)=23(0)+5=5, so the graph will cross the yy-axis at (0,5)(0,5).

According to the equation for the function, the slope of the line is 2323. This tells us that the “rise” of 22 units accompanies the “run” of 33 units. We can now graph the function by first plotting the yy-intercept. Then, from the initial value (0,5)(0,5), we move down 22 units and to the right 33 units. We can extend the line to the left and right by using this relationship to plot additional points and then drawing a line through the points.

graph of the line y = (-2/3)x + 5 showing the change of -2 in y and change of 3 in x.

The graph slants downward from left to right, which means it has a negative slope as expected.

This should remind you of a staircase. As long as the rise and run of the staircase are constant from step to step, the stairs form a line from one floor to the next.

Try It 3

     Note: The graph in OHM will accept only 2 points to draw a line.

The following video shows an example of how to graph a linear function given the yyintercept and the slope.

Example 4

Graph f(x)=34x+6f(x)=34x+6 using the slope and yy-intercept.

Solution

The function is of the form f(x)=mx+bf(x)=mx+b, so the slope of this function is 3434 and the yy-intercept is (0,6)(0,6). We can start graphing by plotting the yy-intercept and counting down three units (rise = -3) and right 44 units (run = 4). The first stop is the point (4,3)(4,3), and the next stop is the point (8,0)(8,0). Then join the dots to form the line.

Screen Shot 2016-07-13 at 1.35.32 PM

 Try It 4

Identify the slope and the yy-intercept, then graph the function d(x)=23x+3d(x)=23x+3 using the slope and yy-intercept.

Vertical and Horizontal Lines

We saw in the last section that a horizontal line has a slope of zero and therefore the function f(x)=bf(x)=b represents a horizontal line that passes through the yy-intercept (0,b)(0,b).

For example, suppose we want to graph the function f(x)=2f(x)=2. No matter what xx-value we choose, the function value will always equal –2. Therefore, the points (2,2),(0,2),(3,2)(2,2),(0,2),(3,2), and (5,2)(5,2) all lie on the graph. If we plot these points we see that they form a horizontal line:

Graph of horizontal line through (0, -2)

Figure 2. Graph of function f(x)=2f(x)=2.

We also saw in the last section that a vertical line does NOT represent a function, but it is a relation. In order for a line to be vertical, all of the xx-values must be the same. Therefore, the equation of a vertical line is given as x=cx=c where cc is a constant. The slope of a vertical line is undefined (since the run is zero, and we can’t divide by 0), and regardless of the yyvalue of any point on the line, the xxcoordinate of the point will always be c.

For example, suppose we want to graph the equation x=3x=3. The graph will contain the following points: (3,5),(3,1),(3,3)(3,5),(3,1),(3,3), and (3,5)(3,5). If we plot these points, we see they form a vertical line:

Graph of vertical line through (-3, 0)

Figure 3. Graph of equation x=3x=3.

VERTICAL AND HORIZONTAL LINES

A linear function whose graph has a slope of zero forms a horizontal line. The function is of the form f(x)=bf(x)=b where bb is a real number and is represented graphically by the yy-intercept (0,b)(0,b).

 

A vertical line represents the equation x=cx=c where cc is a real number. This equation is NOT a function.

Example 5

Graph:

1. f(x)=4f(x)=4

2. x=1x=1

Solution

1. The function f(x)=4f(x)=4 is represented by a horizontal line that passes through (0, 4).

2. The equation x=1x=1 is represented by a vertical line that passes through (–1, 0).

Both graphs are shown:

Horizontal line through (0, 4) and vertical line through (-1, 0)

 

Try It 5

Graph:

1. f(x)=6f(x)=6

2. x=4x=4

Parallel and Perpendicular Lines

Parallel lines have the same slope but different y-intercepts. Lines that are parallel to each other will never intersect. For example, figure 4 shows the graphs of three lines with the same slope, m=2m=2. Notice that each line goes in exactly the same direction because they have the same slope. Notice also that each line has a different yy-intercept. If these lines all had the same slope and the same yy-intercept, they would all lie on top of each other and be the same line. Such lines are referred to as coincidental lines, and we will see the significance of such lines later in this course.

Coordinate plane with the x-axis ranging from negative 8 to 8 in intervals of 2 and the y-axis ranging from negative 7 to 7. Three functions are graphed on the same plot: y = 2 times x minus 3; y = 2 times x plus 1 and y = 2 times x plus 5.Figure 4. Parallel lines.

Parallel Lines

Two or more lines are parallel to each other if they have identical slopes but different yy-intercepts.

If one line has a slope of m1m1 and a yy-intercept at (0,b1)(0,b1) and another line has a slope of m2m2 and a yy-intercept at (0,b2)(0,b2), the lines are parallel if m1=m2m1=m2 and b1b2b1b2.

Example 6

Determine if the graph represents two parallel lines:

Graph of two lines

Solution

The blue line passes through the points (–6, 0) and (0, 4). m1=ΔyΔx=400(6)=46=23m1=ΔyΔx=400(6)=46=23.

The green line passes through the points (0, –3) and (6, 1). m1=ΔyΔx=1(3)60)=46=23m1=ΔyΔx=1(3)60)=46=23.

Since the slopes are equal, the lines are parallel.

Try It 6

Determine if the graph represents two parallel lines:

Graph of two lines

Lines that are perpendicular intersect to form a 9090 angle (a right angle). The product of the slopes of perpendicular lines always equals –1.

If one line has a slope of m1m1 and another line has a slope of m2m2, the lines are perpendicular if m1m2=1m1m2=1. This means that m1=1m2m1=1m2 and m2=1m1m2=1m1, i.e. the slopes are the negative reciprocal of each other.

For example, in figure 5 the orange line has a slope of m1=3m1=3 and the blue line has a slope of m2=13m2=13. The product of these two slopes is 3(13)=13(13)=1. Notice that 3=313=31 and 1313 are negative reciprocals of one another. i.e. if we turn one slope upside down and take it’s opposite, we get the other slope.

Coordinate plane with the x-axis ranging from negative 3 to 6 and the y-axis ranging from negative 2 to 5. Two functions are graphed on the same plot: y = 3 times x minus 1 and y = negative x/3 minus 2. Their intersection is marked by a box to show that it is a right angle.Figure 5. Perpendicular lines

Perpendicular Lines

Two lines are perpendicular to each other if the product of their slopes equals –1.

If one line has a slope of m1m1 and another line has a slope of m2m2, the lines are perpendicular if m1m2=1m1m2=1.

This means that m1=1m2m1=1m2 and m2=1m1m2=1m1, i.e. the slopes are the negative reciprocal of each other.

Example 7

Determine if the graph represents two perpendicular lines:

Graph of two lines

Solution

The blue line passes through the points (0, 6) and (4, –4).

This results in a slope of m1=ΔyΔx=6(4)04=104=52m1=ΔyΔx=6(4)04=104=52.

The green line passes through the points (0, –3) and (5, 0), resulting in a slope of m1=ΔyΔx=0(3)50=35m1=ΔyΔx=0(3)50=35.

m1m2=5235=321m1m2=5235=321

Since the product of the slopes is not equal to –1, the lines are not perpendicular.

Try It 7

Determine if the graph represents two perpendicular lines:

Graph of two lines

 

Example 8

Graph the equations, and state whether the resulting lines are parallel, perpendicular, or neither: 3y=4x+33y=4x+3 and 3x4y=83x4y=8.

Solution

We can graph the lines using a table of values. To determine the corresponding yy-values we must substitute the chosen xx-value and solve the resulting equation in one variable.

Table of values for line 1:

x=3x=3

3y=4x+33y=4(3)+33y=12+33y=15y=53y=4x+33y=4(3)+33y=12+33y=15y=5

x=0x=0

3y=4x+33y=4(0)+33y=3y=13y=4x+33y=4(0)+33y=3y=1

x=3x=3

3y=4x+33y=4()+33y=12+33y=9y=33y=4x+33y=4()+33y=12+33y=9y=3

 

xx 3y=4x+33y=4x+3
33 5
0 1
3 –3

Table of values for line 2:

x=4x=4

3x4y=83(4)4y=8124y=84y=20y=53x4y=83(4)4y=8124y=84y=20y=5

x=0x=0

3x4y=83(0)4y=84y=8y=23x4y=83(0)4y=84y=8y=2

x=4x=4

3x4y=83(4)4y=8124y=84y=4y=13x4y=83(4)4y=8124y=84y=4y=1

xx 3x4y=83x4y=8
–4 –5
0 –2
4 1

 

Graph of two linesNow plot the points and graph each line:

From the graph, we can see that the lines appear perpendicular, but we must compare the slopes.

m1=43m2=34m1m2=(43)(34)=1m1=43m2=34m1m2=(43)(34)=1

The slopes are negative reciprocals of each other, confirming that the lines are perpendicular.

 

Try It 8

Graph the equations, and state whether the resulting lines are parallel, perpendicular, or neither:  2yx=102yx=10 and 2y=x+42y=x+4.