Graphs of Linear Functions
Two competing telephone companies offer different payment plans. The two plans charge the same rate per long distance minute, but charge a different monthly flat fee. A consumer wants to determine whether the two plans will ever cost the same amount for a given number of long distance minutes used. The total cost of each payment plan can be represented by a linear function. To solve the problem, we will need to compare the functions. In this section, we will consider methods of comparing functions using graphs.
Graphing linear functions
In Linear Functions, we saw that the graph of a linear function is a straight line. We were also able to see the points of the function as well as the initial value from a graph. By graphing two functions, then, we can more easily compare their characteristics.
There are three basic methods of graphing linear functions. The first is by plotting points and then drawing a line through the points. The second is by using the -intercept and slope. And the third is by using transformations of the identity function .
Graphing a function by plotting points
To find points of a function, we can choose input values, evaluate the function at these input values, and calculate output values. The input values and corresponding output values form coordinate pairs. We then plot the coordinate pairs on a grid. In general, we should evaluate the function at a minimum of two inputs in order to find at least two points on the graph. For example, given the function , we might use the input values 1 and 2. Evaluating the function for an input value of 1 yields an output value of 2, which is represented by the point . Evaluating the function for an input value of 2 yields an output value of 4, which is represented by the point . Choosing three points is often advisable because if all three points do not fall on the same line, we know we made an error.
How to: given a linear function, graph by plotting points.
- Choose a minimum of two input values.
- Evaluate the function at each input value.
- Use the resulting output values to identify coordinate pairs.
- Plot the coordinate pairs on a grid.
- Draw a line through the points.
Example. Graph by plotting points.
Solution. Begin by choosing input values. This function includes a fraction with a denominator of 3, so let’s choose multiples of 3 as input values. We will choose 0, 3, and 6.
Evaluate the function at each input value, and use the output value to identify coordinate pairs.
Plot the coordinate pairs and draw a line through the points. The graph below represents the function .
The graph of the function is a line as expected for a linear function. In addition, the graph has a downward slant, which indicates a negative slope. This is also expected from the negative constant rate of change in the equation for the function.
Graph by plotting points.
The line through , , and Choose multiples of 4 as input values so every output is a whole number: , , and .Graphing a function using the y-intercept and slope
Another way to graph linear functions is by using specific characteristics of the function rather than plotting points. The first characteristic is its -intercept, which is the point at which the input value is zero. To find the -intercept, we can set in the equation.
The other characteristic of the linear function is its slope , which is a measure of its steepness. Recall that the slope is the rate of change of the function. The slope of a function is equal to the ratio of the change in outputs to the change in inputs. Another way to think about the slope is by dividing the vertical difference, or rise, by the horizontal difference, or run. We encountered both the -intercept and the slope in Linear Functions.
Let’s consider the following function.
The slope is . Because the slope is positive, we know the graph will slant upward from left to right. The -intercept is the point on the graph when . The graph crosses the -axis at . Now we know the slope and the -intercept. We can begin graphing by plotting the point . We know that the slope is rise over run, . From our example, we have , which means that the rise is 1 and the run is 2. So starting from our -intercept , we can rise 1 and then run 2, or run 2 and then rise 1. We repeat until we have a few points, and then we draw a line through the points as shown below.
Graphical interpretation of a linear function. In the equation :
- is the -intercept of the graph and indicates the point at which the graph crosses the -axis.
- is the slope of the line and indicates the vertical displacement (rise) and horizontal displacement (run) between each successive pair of points. Recall the formula for the slope:
Q&A. Do all linear functions have -intercepts?
Yes. All linear functions cross the -axis and therefore have -intercepts. (Note: a vertical line parallel to the -axis does not have a -intercept, but it is not a function.)
How to: given the equation for a linear function, graph the function using the -intercept and slope.
- Evaluate the function at an input value of zero to find the -intercept.
- Identify the slope as the rate of change of the input value.
- Plot the point represented by the -intercept.
- Use to determine at least two more points on the line.
- Sketch the line that passes through the points.
Example. Graph using the -intercept and slope.
Solution. Evaluate the function at to find the -intercept. The output value when is 5, so the graph will cross the -axis at .
According to the equation for the function, the slope of the line is . This tells us that for each vertical decrease in the “rise” of units, the “run” increases by 3 units in the horizontal direction. We can now graph the function by first plotting the -intercept on the graph below. From the initial value we move down 2 units and to the right 3 units. We can extend the line to the left and right by repeating, and then draw a line through the points.
The graph slants downward from left to right, which means it has a negative slope as expected.
The line above continues to the left of the vertical axis. Find the point on it whose -coordinate is by evaluating , and enter that point's -coordinate.
, so the point is Substitute into the rule; two negatives multiply to a positive, so .Graphing a function using transformations
Another option for graphing is to use transformations of the identity function . A function may be transformed by a shift up, down, left, or right. A function may also be transformed using a reflection, stretch, or compression.
Vertical stretch or compression
In the equation , the is acting as the vertical stretch or compression of the identity function. When is negative, there is also a vertical reflection of the graph. Notice in the graph below that multiplying the equation of by stretches the graph of by a factor of units if and compresses the graph of by a factor of units if . This means the larger the absolute value of , the steeper the slope.
The eight lines drawn are , , , , , , , and ; each is labelled by the expression that equals, written with a slash for the fraction.
Vertical shift
In , the acts as the vertical shift, moving the graph up and down without affecting the slope of the line. Notice in the graph below that adding a value of to the equation of shifts the graph of a total of units up if is positive and units down if is negative. The five lines are , , , , and , each labelled by the expression that equals.
Using vertical stretches or compressions along with vertical shifts is another way to look at identifying different types of linear functions. Although this may not be the easiest way to graph this type of function, it is still important to practice each method.
How to: given the equation of a linear function, use transformations to graph the linear function in the form .
- Graph .
- Vertically stretch or compress the graph by a factor .
- Shift the graph up or down units.
Example. Graph using transformations.
Solution. The equation for the function shows that , so the identity function is vertically compressed by . The equation for the function also shows that , so the identity function is vertically shifted down 3 units. First, graph the identity function, and show the vertical compression as below. The vertical arrows compare the two outputs: reaches 4 at , while reaches only 2.5 at .
Then show the vertical shift.
Graph using transformations.
Stretch by a factor of 2 to get , then shift up 4 units to reach .The stretch factor is the coefficient of and the shift is the constant term; the finished line passes through and .Q&A. In the example above, could we have sketched the graph by reversing the order of the transformations?
No. The order of the transformations follows the order of operations. When the function is evaluated at a given input, the corresponding output is calculated by following the order of operations. This is why we performed the compression first. For example, following the order, let the input be 2.
Writing the equation for a function from the graph of a line
Recall that in Linear Functions, we wrote the equation for a linear function from a graph. Now we can extend what we know about graphing linear functions to analyze graphs a little more closely. Begin by taking a look at the graph below. We can see right away that the graph crosses the -axis at the point , so this is the -intercept.
Then we can calculate the slope by finding the rise and run. We can choose any two points, but let’s look at the point . To get from this point to the -intercept, we must move up 4 units (rise) and to the right 2 units (run). So the slope must be
Substituting the slope and -intercept into the slope-intercept form of a line gives
How to: given a graph of a linear function, find the equation to describe the function.
- Identify the -intercept of an equation.
- Choose two points to determine the slope.
- Substitute the -intercept and slope into the slope-intercept form of a line.
Example. Match each equation of the linear functions with one of the lines in the graph below.
Solution. Analyze the information for each function.
- has a slope of 2 and a -intercept of 3. It must pass through the point and slant upward from left to right. We can use two points to find the slope, or we can compare it with the other functions listed. Function has the same slope, but a different -intercept. Lines I and III have the same slant because they have the same slope. Line III does not pass through , so must be represented by Line I.
- also has a slope of 2, but a -intercept of . It must pass through the point and slant upward from left to right. It must be represented by Line III.
- has a slope of and a -intercept of 3. This is the only function listed with a negative slope, so it must be represented by Line IV because it slants downward from left to right.
- has a slope of and a -intercept of 3. It must pass through the point and slant upward from left to right. Lines I and II pass through , but the slope of is less than the slope of , so the line for must be flatter. This function is represented by Line II.
Now we can re-label the lines as below.
Finding the x-intercept of a line
So far, we have been finding the -intercepts of a function: the point at which the graph of the function crosses the -axis. A function may also have an -intercept, which is the -coordinate of the point where the graph of the function crosses the -axis. In other words, it is the input value when the output value is zero.
To find the -intercept, set a function equal to zero and solve for the value of . For example, consider the function shown.
Set the function equal to 0 and solve for .
The graph of the function crosses the -axis at the point .
Q&A. Do all linear functions have -intercepts?
No. However, linear functions of the form , where is a nonzero real number, are the only examples of linear functions with no -intercept. For example, is a horizontal line 5 units above the -axis. This function has no -intercepts, as shown below.
Example. Find the -intercept of .
Solution. Set the function equal to zero to solve for .
The graph crosses the -axis at the point .
A graph of the function is shown below. We can see that the -intercept is as we expected.
Find the -intercept of . Enter its -coordinate.
gives , so the -intercept is Set the function equal to 0, then undo the subtraction and the multiplication by .Describing horizontal and vertical lines
There are two special cases of lines on a graph—horizontal and vertical lines. A horizontal line indicates a constant output, or -value. In the graph below, we see that the output has a value of 2 for every input value. The change in outputs between any two points, therefore, is 0. In the slope formula, the numerator is 0, so the slope is 0. If we use in the equation , the equation simplifies to . In other words, the value of the function is a constant. This graph represents the function .
| 0 | 2 | 4 | |||
|---|---|---|---|---|---|
| 2 | 2 | 2 | 2 | 2 |
A vertical line indicates a constant input, or -value. We can see that the input value for every point on the line below is 2, but the output value varies. Because this input value is mapped to more than one output value, a vertical line does not represent a function. Notice that between any two points, the change in the input values is zero. In the slope formula, the denominator will be zero, so the slope of a vertical line is undefined.
Notice that a vertical line, such as the one below, has an -intercept, but no -intercept unless it’s the line . This graph represents the line .
| 2 | 2 | 2 | 2 | 2 | |
|---|---|---|---|---|---|
| 0 | 2 | 4 |
Horizontal and vertical lines. Lines can be horizontal or vertical.
A horizontal line is a line defined by an equation in the form .
A vertical line is a line defined by an equation in the form .
Example. Write the equation of the line graphed below.
Solution. For any -value, the -value is , so the equation is .
Example. Write the equation of the line graphed below.
Solution. The constant -value is 7, so the equation is .
Determining whether lines are parallel or perpendicular
The two lines below are parallel lines: they will never intersect. Notice that they have exactly the same steepness, which means their slopes are identical. The only difference between the two lines is the -intercept. If we shifted one line vertically toward the -intercept of the other, they would become the same line.
We can determine from their equations whether two lines are parallel by comparing their slopes. If the slopes are the same and the -intercepts are different, the lines are parallel. If the slopes are different, the lines are not parallel.
Unlike parallel lines, perpendicular lines do intersect. Their intersection forms a right, or 90-degree, angle. The two lines below are perpendicular.
Perpendicular lines do not have the same slope. The slopes of perpendicular lines are different from one another in a specific way. The slope of one line is the negative reciprocal of the slope of the other line. The product of a number and its reciprocal is 1. So, if and are negative reciprocals of one another, they can be multiplied together to yield .
To find the reciprocal of a number, divide 1 by the number. So the reciprocal of 8 is , and the reciprocal of is 8. To find the negative reciprocal, first find the reciprocal and then change the sign.
As with parallel lines, we can determine whether two lines are perpendicular by comparing their slopes, assuming that the lines are neither horizontal nor vertical. The slope of each line below is the negative reciprocal of the other, so the lines are perpendicular.
The product of the slopes is .
Parallel and perpendicular lines.
Two lines are parallel lines if they do not intersect. The slopes of the lines are the same.
If and only if and , we say the lines coincide. Coincident lines are the same line.
Two lines are perpendicular lines if they intersect at right angles.
Example. Given the functions below, identify the functions whose graphs are a pair of parallel lines and a pair of perpendicular lines.
Solution. Parallel lines have the same slope. Because the functions and each have a slope of 2, they represent parallel lines. Perpendicular lines have negative reciprocal slopes. Because and are negative reciprocals, the equations and represent perpendicular lines.
A graph of the lines is shown below.
The graph shows that the lines and are parallel, and the lines and are perpendicular.
Writing the equation of a line parallel or perpendicular to a given line
If we know the equation of a line, we can use what we know about slope to write the equation of a line that is either parallel or perpendicular to the given line.
Writing equations of parallel lines
Suppose for example, we are given the following equation.
We know that the slope of the line formed by the function is 3. We also know that the -intercept is . Any other line with a slope of 3 will be parallel to . So the lines formed by all of the following functions will be parallel to .
Suppose then we want to write the equation of a line that is parallel to and passes through the point . We already know that the slope is 3. We just need to determine which value for will give the correct line. We can begin with the point-slope form of an equation for a line, and then rewrite it in the slope-intercept form.
So is parallel to and passes through the point .
How to: given the equation of a function and a point through which its graph passes, write the equation of a line parallel to the given line that passes through the given point.
- Find the slope of the function.
- Substitute the given values into either the general point-slope equation or the slope-intercept equation for a line.
- Simplify.
Example. Find a line parallel to the graph of that passes through the point .
Solution. The slope of the given line is 3. If we choose the slope-intercept form, we can substitute , , and into the slope-intercept form to find the -intercept.
The line parallel to that passes through is .
We can confirm that the two lines are parallel by graphing them. The graph below shows that the two lines will never intersect; a dashed right-1, up-3 step on each line makes the shared slope of 3 visible.
Writing equations of perpendicular lines
We can use a very similar process to write the equation for a line perpendicular to a given line. Instead of using the same slope, however, we use the negative reciprocal of the given slope. Suppose we are given the following function:
The slope of the line is 2, and its negative reciprocal is . Any function with a slope of will be perpendicular to . So the lines formed by all of the following functions will be perpendicular to .
As before, we can narrow down our choices for a particular perpendicular line if we know that it passes through a given point. Suppose then we want to write the equation of a line that is perpendicular to and passes through the point . We already know that the slope is . Now we can use the point to find the -intercept by substituting the given values into the slope-intercept form of a line and solving for .
The equation for the function with a slope of and a -intercept of 2 is
So is perpendicular to and passes through the point . Be aware that perpendicular lines may not look obviously perpendicular on a graphing calculator unless we use the square zoom feature.
Q&A. A horizontal line has a slope of zero and a vertical line has an undefined slope. These two lines are perpendicular, but the product of their slopes is not . Doesn’t this fact contradict the definition of perpendicular lines?
No. For two perpendicular linear functions, the product of their slopes is . However, a vertical line is not a function, so the definition is not contradicted.
How to: given the equation of a function and a point through which its graph passes, write the equation of a line perpendicular to the given line.
- Find the slope of the function.
- Determine the negative reciprocal of the slope.
- Substitute the new slope and the values for and from the coordinate pair provided into .
- Solve for .
- Write the equation for the line.
Example. Find the equation of a line perpendicular to that passes through the point .
Solution. The original line has slope , so the slope of the perpendicular line will be its negative reciprocal, or . Using this slope and the given point, we can find the equation for the line.
The line perpendicular to that passes through is .
A graph of the two lines is shown below.
Given the function , write an equation for the line passing through that is parallel to . Enter the expression that equals.
Parallel lines share a slope, and a line through the origin has -intercept 0.Given the function , write an equation for the line passing through that is perpendicular to . Enter the expression that equals.
Use the negative reciprocal of 2 as the slope, and remember the line passes through the origin.How to: given two points on a line and a third point, write the equation of the perpendicular line that passes through the point.
- Determine the slope of the line passing through the points.
- Find the negative reciprocal of the slope.
- Use the slope-intercept form or point-slope form to write the equation by substituting the known values.
- Simplify.
Example. A line passes through the points and . Find the equation of a perpendicular line that passes through the point .
Solution. From the two points of the given line, we can calculate the slope of that line.
Find the negative reciprocal of the slope.
We can then solve for the -intercept of the line passing through the point .
The equation for the line that is perpendicular to the line passing through the two given points and also passes through point is
A line passes through the points and . Find the equation of a perpendicular line that passes through the point . Enter the expression that equals.
The slope through the two given points is ; take its negative reciprocal, then substitute to find .Solving a system of linear equations using a graph
A system of linear equations includes two or more linear equations. The graphs of two lines will intersect at a single point if they are not parallel. Two parallel lines can also intersect if they are coincident, which means they are the same line and they intersect at every point. For two lines that are not parallel, the single point of intersection will satisfy both equations and therefore represent the solution to the system.
To find this point when the equations are given as functions, we can solve for an input value so that . In other words, we can set the formulas for the lines equal to one another, and solve for the input that satisfies the equation.
Example. Find the point of intersection of the lines and .
Solution. Set .
This tells us the lines intersect when the input is .
We can then find the output value of the intersection point by evaluating either function at this input.
These lines intersect at the point .
Looking at the graph below, this result seems reasonable.
Q&A. If we were asked to find the point of intersection of two distinct parallel lines, should something in the solution process alert us to the fact that there are no solutions?
Yes. After setting the two equations equal to one another, the result would be the contradiction “0 = nonzero real number.”
Use the graph of and above to answer the following questions about .
Find the -intercept of . Enter its -coordinate.
gives , so the intercept is The graph crosses the horizontal axis where the output is 0.Find the slope of .
Rewrite the rule in the form ; the coefficient of is the slope.Which description transforms the identity toolkit function into ?
Compare the slope of with the slope of the identity function, then compare their -intercepts.Example. A company sells sports helmets. The company incurs a one-time fixed cost of $250,000. Each helmet costs $120 to produce, and sells for $140. Find the cost function to produce helmets, in dollars; the revenue function from the sales of helmets, in dollars; and the break-even point, the point of intersection of the two graphs and .
Solution. The cost function is the sum of the fixed cost, $250,000, and the variable cost, $120 per helmet.
The revenue function is the total revenue from the sale of helmets.
The break-even point is the point of intersection of the graph of the cost and revenue functions. To find the -coordinate of the coordinate pair of the point of intersection, set the two equations equal, and solve for .
To find , evaluate either the revenue or the cost function at 12,500.
The break-even point is .
This means if the company sells 12,500 helmets, they break even; both the sales and cost incurred equaled 1.75 million dollars. See the graph below.
Key concepts
- Linear functions may be graphed by plotting points or by using the -intercept and slope.
- Graphs of linear functions may be transformed by using shifts up, down, left, or right, as well as through stretches, compressions, and reflections.
- The -intercept and slope of a line may be used to write the equation of a line.
- The -intercept is the point at which the graph of a linear function crosses the -axis.
- Horizontal lines are written in the form .
- Vertical lines are written in the form .
- Parallel lines have the same slope.
- Perpendicular lines have negative reciprocal slopes, assuming neither is vertical.
- A line parallel to another line, passing through a given point, may be found by substituting the slope value of the line and the - and -values of the given point into the equation , and using the that results. Similarly, the point-slope form of an equation can also be used.
- A line perpendicular to another line, passing through a given point, may be found in the same manner, with the exception of using the negative reciprocal slope.
- A system of linear equations may be solved by setting the two equations equal to one another and solving for . The -value may be found by evaluating either one of the original equations using this -value.
- A system of linear equations may also be solved by finding the point of intersection on a graph.
Key terms
-intercept — the point on the graph of a linear function when the output value is 0; the point at which the graph crosses the horizontal axis. horizontal line — a line defined by , where is a real number. The slope of a horizontal line is 0. vertical line — a line defined by , where is a real number. The slope of a vertical line is undefined. parallel lines — two or more lines with the same slope. perpendicular lines — two lines that intersect at right angles and have slopes that are negative reciprocals of each other.
This section is adapted from Precalculus 2e, Section 2.2: Graphs of Linear Functions by Jay Abramson and OpenStax, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recreated all twenty-three graphs as accessible inline SVGs generated from explicit formulas, matching the printed window, intercepts, slope triangles, and annotations of each; because these figures are monochrome, every line the source distinguishes only by colour is labelled with its own formula, written compactly ( for ) so that the eight stretch lines and the five shift lines still fit one grid, and the prose names each family in full; presented the horizontal-line and vertical-line coordinate tables as Markdown tables and the “change of output over change of input” annotation as a displayed fraction; omitted the media links and end-of-section exercises; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback, using the graphing component where the source answer is itself a graph, multiple choice where the answer is a verbal transformation description, and a single requested coordinate where the source answer is an ordered pair. Two response-mode adaptations are worth naming: where the source asks for any point with a negative -value, this page asks for the output at , one of the source’s own listed answers, so that a single response can be graded; and of the six parts of the last Try It, this page keeps the -intercept, the slope, and the transformation description, the three that are not already exercised elsewhere in the section. Two corrections to the source art are disclosed here: the Analysis figure for the perpendicular-line example is drawn with that example’s own line , where the printed figure is labelled ; and the break-even figure’s left-hand annotation reads “sales < cost” above “Company loses money”, where the printed art reads “cost < sales”, which contradicts both the label beneath it and the figure’s own alt text. Two further upstream defects were found and deliberately not propagated: the pinned CNXML’s alt text for the parallel-lines figure gives its slopes as while the printed geometry is , and its alt text for the write-the-equation figure describes a line through while both the printed figure and the surrounding prose give ; in each case this page follows the printed figure and the prose.