Section 2.4: Graphing and Linear Functions

In the last section, we showed how post-composition of a given function with another function (esp. addition and multiplication by constants) affects the function algebraically, numerically, and geometrically.  We then applied our observations to develop a strategy for graphing.  In this section, we will apply these principles to the identity function to obtain a deeper understanding of linear functions (i.e., functions which graph as straight lines).  

Arithmetic Operations and Lines

In the last section, we showed how the three basic arithmetic operations (addition, multiplication, and negation) affect a function algebraically, numerically, and geometrically.  In that section and in an accompanying worksheet, we practiced analyzing the affect of doing all three operations (via post-composition with r(x) = -2x + 1) on several more complicated functions (specifically, a "generic" function given by a table of points, the absolute value function, the square root function, and the greatest integer function).  In this section, we want to think about what happens when we apply these operations to the identity function, f(x) = x.  While this may seem like a trivial example, it will provide a new perspective on what may already be familiar material for you.  

Algebraically, if we form , we are simply left with r, since .  Geometrically, the graph of y = f(x) = x is simply a 45° line through the origin:

going through the points:

x y = f(x) = x
.
.
.
-1
0
1
.
.
.
.
.
.
-1
0
1
.
.
.

Since this is a straight line, it is sufficient to plot only two points, but we will plot three points for good measure, at x = -1, 0, 1.

Using the technique we developed from the previous worksheet, we can analyze r, as follows:

Corresponding
Algebraic formula
x x 2x -2x -2x + 1
Geometric Effect   Take the graph of
the identity function
Stretch vertically
by a factor of 2
Flip the vertical axis Shift vertically,
up by 1
Numerical Effect Take the input Apply the
identity function
Multiply by 2 Multiply by -1 Add 1
Numerical 
Results
Inputs Outputs
-1 -1 -2 2 3
0 0 0 0 1
1 1 2 -2 -1

so that r goes through the points:  

x y = r(x) = -2x + 1
-1
0
1
3
1
-1

Notice that, while this analysis looks the same as that for y = -2ëxû + 1, since we know that this time the original graph, y = x, is a straight line, this time we can simply "connect-the-dots" to obtain the final graph.  

To be more specific, we know that stretching a 45° line vertically by 2 will make the graph steeper.  When we flip the vertical axis, the graph will switch from sloping upwards to sloping downwards (at the same angle).  Finally, shifting up by 1 will simply shift the graph up 1 unit (keeping the angle the same); it will no longer goes through the origin, but will cross the y-axis at y = 1.  We can verify this analysis by selecting the sequence of Examples from the following applet:

Based on this example, we can derive formulas for every sort of line in the plane.  We begin with the two exceptional cases:

Every other type of line can be obtained from y = x by stretching, flipping, and/or shifting vertically, so:

This is why refer to an equation like y = -2x + 1, or a function like r(x) = -2x + 1, as "linear", since their graphs correspond to straight lines.

Make sure that you understand the geometry of linear equations by completing the following exercises.


The Equation of a Linear Function

Based on our analysis in the previous section, we can view a linear function, f(x) = ± s x + t, algebraically, numerically, and geometrically. 

At this point, it is helpful to consider each term separately.

You can see this clearly in the example from the previous section:

x y = r(x) = -2x + 1  
-1
0
1
3
1
-1

"Starts" at y = 1
The "change", from 1 to -1, is by 2 units.  
In particular, it decreased by 2.

Important: Notice that the function decreases by 2 every time we increase x by 1 unit; for example, when the input increases from -1 to 0, the output decreases from 3 to 1.  This property actually characterizes linear functions; that is:

Any function that increases/decreases at a constant rate must be given by a linear equation, since its graph will necessarily be a straight line.

Armed with this understanding, we should now be able to work backwards from a table of values or graph of a function to derive its algebraic description.  For example, looking at the table:

x y
-1
0
1
-8
-2
4

we see that it "starts" at -2 and increases by 6 units at each step, so it must correspond to the equation y = 6x - 2.  Similarly, looking at the graph:

we can make a table of points on this graph:

x y
-1
0
1
2
3
3.5
3
2.5
2
1.5

to see that it "starts" at 3 and decreases by 0.5 = 1/2 as we increase x/move right 1 unit.  This means that it must correspond to the equation y = -x/2 + 3.  

We can even apply this analysis to create mathematical models in a variety of practical situations.

Notice that, in each case, the quantity whose units are a ratio ($/min., mi./hr., $/ticket) correspond to the scaling factor.  Moreover, see how the units in each equation combine correctly, when we write in the units by each term.:

Checking the units in this manner is one way to verify that a mathematical model is reasonable. 

Make sure that you can derive the equation for a linear function from a graph, table, or applied setting, by completing the following exercises.


Modeling Linear Functions

In the previous section, we were able to derive linear equations in a variety of situations.  Specifically, if we were given a table or graph of a function where the values for inputs of 0 and 1 were clearly visible, it was an easy matter to write down the equations.  Since a line is determined by any two points, we should be able to derive the equation for a linear function from its values at any two inputs.  We can, and this follows from some basic algebra.

For example, if we know that a linear function, y = f(x) = a x + b takes the values:

x y = f(x)
-3
2
4
8

we then know, by plugging-in y = f(x) = a x + b, that the two equations:

4 = a (-3) + b
8 = a (2) + b

must be true.  Subtracting the second equation from the first gives:

4 - 8 = -3a  - 2a + b - b

or -4 = -5a, so that a = 4/5 or 0.8.  Plugging this value for a into the second equation gives 8 = (4/5) (2) + b, or b = 8 - 8/5 = 32/5 or 6.2.  This means that f(x) = 4/5 x + 32/5 or f(x) = 0.8x + 6.2.

Although we can simply apply this procedure any time we wish to determine a linear equation, if we perform this procedure using variables in place of specific points, we can derive some useful formulas.  Note: This is typically how all mathematical formulas are discovered -- by generalizing what we know from specific examples, and is one of the most important uses of Algebra.  So let's repeat the previous calculation assuming that the linear function, y = f(x) = a x + b takes the values:

x y = f(x)
x1
x2
y1
y2

Notice how we use the subscripts 1 and 2 to allow us to reuse the basic variables names, x and y, to create four different variables with descriptive names.

We then have the two equations:

y1 = a x1 + b
y2 = a x2 + b

so that, by subtracting one equation from the other:

y1 - y2 = ax1  - ax2 + b - b

or y1 - y2 = a(x1  - x2), so that .  We can summarize what we have discovered as follows:

If a linear function, f(x) = a x + b, goes through the two points (x1, y1) and (x2, y2) , then .  This quantity is known as the slope of the line.  

Note: We can plug the slope formula for a into the second equation to obtain the formula ; in practice, it is easiest to carry out the procedure to solve for b with specific numbers, since this formula is so complex. 

This formula allows us to quickly determine the equation of a linear function from two points, read either from a table or graph.  For example, consider the line:

Notice how the axes were chosen to intersect at (4,4), instead of (0,0); that is because we chose a plot window of [4,16] on the horizontal and vertical axes.  There are three clearly identifiable points at (5, 7), (10, 10), and (15, 13).  From this, we can calculate the slope of k, a = (10 - 7)/(10 - 5) = 3/5, so we know that k(x) = 3/5 x + b.  

Since we cannot see where this graph will cross the y-axis, we need to solve for b.  We can simply plug-in any one of these points and solve to determine b: 7 = k(5) = 3/5 (5) + b = 3 + b, so 7 = 3 + b, or 4 = b, and k(x) = 3/5 x + 4Note: We will get the same equation, no matter what points on the graph we use to calculate the slope or plug-in to find b

Even though we already have one geometric interpretation for the multiplier, a (as the scaling factor/steepness of the line together with a possible flip factor), this gives another powerful interpretation of this number.  Since y1 - y2 measures the change in the outputs and x1 - x2 measures the change in inputs, their ratio, , measures the rate of change (increase or decrease) of the outputs relative to the inputs.  Notice that, since (by multiplying top and bottom by -1), the order of the points is not important, as long as we are consistent.  

As we mentioned before, this gives an effective test to see if a table of values corresponds to a linear formula:

If the slope calculated between any two input/output pairs of a function is always the same, the function must be given by a linear equation.  

Note: It turns out that, if we are given a list of pairs, it is sufficient to only check all consecutive pairs in the list.  For example, we can tell, without graphing, that:

x y = g(x) slope
-3
-1
0
3
7
7
3
1
-5
-13

(7-3)/(-3-(-1)) = -2
(3-1)/(-1-0) = -2
(1-(-5))/(0-3) = -2
(-5-(-13))/(3-7) = -2

will graph as a straight line, since the slopes are all the same.  You may verify this in XFunctions by selecting g from the list of functions on the left:

In fact, it will be given by the equation g(x) = -2 x + 1, since it crosses the y-axis at 1.  By selecting the Example, you can see that the plot of g and the plot of y = -2 x + 1 overlap completely.

In contrast, we can tell that:

x y = h(x) slope
-2
1
3
5
-5
-4
-3
-2

(-5-(-4))/(-2-1) = 1/3
(-4-(-3))/(1-3) = 1/2
(-3-(-2))/(3-5) = 1/2

will have a bend at x = 1; the slope of h changes from 1/3 to 1/2, so the graph will get steeper at that point.  Again, you may verify this by selecting h from the list of functions:

Make sure that you can distinguish a linear function from a non-linear one, and determine its equation from a graph or table, by completing the following exercises.


Go to Pre-Composition and Graphing


Table of Contents Send questions or comments to jwicks@northpark.edu Glossary