3.2: Graphs of Linear Functions
- Page ID
- 92745
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)
( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\id}{\mathrm{id}}\)
\( \newcommand{\Span}{\mathrm{span}}\)
\( \newcommand{\kernel}{\mathrm{null}\,}\)
\( \newcommand{\range}{\mathrm{range}\,}\)
\( \newcommand{\RealPart}{\mathrm{Re}}\)
\( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)
\( \newcommand{\Argument}{\mathrm{Arg}}\)
\( \newcommand{\norm}[1]{\| #1 \|}\)
\( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)
\( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)
\( \newcommand{\vectorA}[1]{\vec{#1}} % arrow\)
\( \newcommand{\vectorAt}[1]{\vec{\text{#1}}} % arrow\)
\( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vectorC}[1]{\textbf{#1}} \)
\( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)
\( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)
\( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)
\( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)
\( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)
\(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)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
Previously, we saw that 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:
- Plot the points and then drawing a line through the points.
- Use the y-intercept and slope.
- Use transformations of the identity function \(f(x)=x\).
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, \(f(x)=2x\), 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 \((1,2)\). Evaluating the function for an input value of 2 yields an output value of 4, which is represented by the point \((2,4)\). Choosing three points is often advisable because if all three points do not fall on the same line, we know we made an error.
- 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.
Graph \(f(x)=−\frac{2}{3}x+5\) 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.
\[\begin{align*} x&=0 & f(0)&=-\dfrac{2}{3}(0)+5=5\rightarrow(0,5) \\ x&=3 & f(3)&=-\dfrac{2}{3}(3)+5=3\rightarrow(3,3) \\ x&=6 & f(6)&=-\dfrac{2}{3}(6)+5=1\rightarrow(6,1) \end{align*}\]
Plot the coordinate pairs and draw a line through the points. Figure \(\PageIndex{1}\) represents the graph of the function \(f(x)=−\frac{2}{3}x+5\).
Analysis
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 \(f(x)=−\frac{3}{4}x+6\) by plotting points.
- Answer
Graphing a Function Using 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 y-intercept, which is the point at which the input value is zero. To find the y-intercept, we can set \(x=0\) in the equation.
The other characteristic of the linear function is its slope \(m\), 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 y-intercept and the slope in Linear Functions.
Let’s consider the following function.
\[f(x)=\dfrac{1}{2}x+1\]
The slope is \(\frac{1}{2}\). Because the slope is positive, we know the graph will slant upward from left to right. The y-intercept is the point on the graph when \(x=0\). The graph crosses the y-axis at \((0,1)\). Now we know the slope and the y-intercept. We can begin graphing by plotting the point \((0,1)\) We know that the slope is rise over run, \(m=\frac{\text{rise}}{\text{run}}\). From our example, we have \(m=\frac{1}{2}\), which means that the rise is 1 and the run is 2. So starting from our y-intercept \((0,1)\), 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 in Figure \(\PageIndex{3}\).
In the equation \(f(x)=mx+b\)
- \(b\) is the y-intercept of the graph and indicates the point \((0,b)\) at which the graph crosses the y-axis.
- \(m\) 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:
\[m=\dfrac{\text{change in output (rise)}}{\text{change in input (run)}}=\dfrac{{\Delta}y}{{\Delta}x}=\dfrac{y_2-y_1}{x_2-x_1}\]
Do all linear functions have y-intercepts?
- Answer
-
Yes. All linear functions cross the y-axis and therefore have y-intercepts. (Note: A vertical line parallel to the y-axis does not have a y-intercept, but it is not a function.)
- Evaluate the function at an input value of zero to find the y-intercept.
- Identify the slope as the rate of change of the input value.
- Plot the point represented by the y-intercept.
- Use \(\frac{\text{rise}}{\text{run}}\) to determine at least two more points on the line.
- Sketch the line that passes through the points.
Graph \(f(x)=−\frac{2}{3}x+5\) using the y-intercept and slope.
Solution
Evaluate the function at \(x=0\) to find the y-intercept. The output value when \(x=0\) is 5, so the graph will cross the y-axis at \((0,5)\).
According to the equation for the function, the slope of the line is \(-\frac{2}{3}\). This tells us that for each vertical decrease in the “rise” of –2 units, the “run” increases by 3 units in the horizontal direction. We can now graph the function by first plotting the y-intercept on the graph in Figure \(\PageIndex{4}\). From the initial value \((0,5)\) 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.
Analysis
The graph slants downward from left to right, which means it has a negative slope as expected.
Find a point on the graph we drew in Example \(\PageIndex{2}\) that has a negative x-value.
- Answer
-
Possible answers include \((−3,7)\), \((−6,9)\), or \((−9,11)\).
Graphing a Function Using Transformations
Another option for graphing is to use transformations of the identity function \(f(x)=x\). 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 \(f(x)=mx\), the \(m\) is acting as the vertical stretch or compression of the identity function. When \(m\) is negative, there is also a vertical reflection of the graph. Notice in Figure \(\PageIndex{5}\) that multiplying the equation of \(f(x)=x\) by \(m\) stretches the graph of \(f\) by a factor of \(m\) units if \(m>1\) and compresses the graph of \(f\) by a factor of \(m\) units if \(0<m<1\). This means the larger the absolute value of \(m\), the steeper the slope.
Vertical Shift
In \(f(x)=mx+b\), the \(b\) acts as the vertical shift, moving the graph up and down without affecting the slope of the line. Notice in Figure \(\PageIndex{6}\) that adding a value of \(b\) to the equation of \(f(x)=x\) shifts the graph of \(f\) a total of \(b\) units up if \(b\) is positive and \(|b|\) units down if \(b\) is negative.
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.
Given the equation of a linear function, use transformations to graph the linear function in the form \(f(x)=mx+b\).
- Graph \(f(x)=x\).
- Vertically stretch or compress the graph by a factor \(m\).
- Shift the graph up or down \(b\) units.
Graph \(f(x)=\frac{1}{2}x−3\) using transformations.
Solution
The equation for the function shows that \(m=\frac{1}{2}\) so the identity function is vertically compressed by \(\frac{1}{2}\). The equation for the function also shows that \(b=−3\) so the identity function is vertically shifted down 3 units. First, graph the identity function, and show the vertical compression as in Figure \(\PageIndex{7}\).
Then show the vertical shift as in Figure \(\PageIndex{8}\).
Graph \(f(x)=4+2x\), using transformations.
- Answer
In Example 2.2.3, 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.
\[\begin{align} f(2)&=\dfrac{1}{2}(2)-3 \\ &=1-3\\ &=-2 \end{align}\]
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 Figure \(\PageIndex{10}\). We can see right away that the graph crosses the y-axis at the point \((0, 4)\) so this is the y-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 (−2,0). To get from this point to the y-intercept, we must move up 4 units (rise) and to the right 2 units (run). So the slope must be
\[m=\dfrac{\text{rise}}{\text{run}}=\dfrac{4}{2}=2\]
Substituting the slope and y-intercept into the slope-intercept form of a line gives
\[y=2x+4\]
Given a graph of linear function, find the equation to describe the function.
- Identify the y-intercept of an equation.
- Choose two points to determine the slope.
- Substitute the y-intercept and slope into the slope-intercept form of a line.
Match each equation of the linear functions with one of the lines in Figure \(\PageIndex{11}\).
- \(f(x)=2x+3\)
- \(g(x)=2x−3\)
- \(h(x)=−2x+3\)
- \(j(x)=\frac{1}{2}x+3\)
Solution
Analyze the information for each function.
- This function has a slope of 2 and a y-intercept of 3. It must pass through the point \((0, 3)\) 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 \(g\) has the same slope, but a different y-intercept. Lines I and III have the same slant because they have the same slope. Line III does not pass through \((0, 3)\) so \(f\) must be represented by line I.
- This function also has a slope of 2, but a y-intercept of −3. It must pass through the point \((0,−3)\) and slant upward from left to right. It must be represented by line III.
- This function has a slope of –2 and a y-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.
- This function has a slope of \(\frac{1}{2}\) and a y-intercept of 3. It must pass through the point (0, 3) and slant upward from left to right. Lines I and II pass through \((0, 3)\), but the slope of \(j\) is less than the slope of \(f\) so the line for \(j\) must be flatter. This function is represented by Line II.
Now we can re-label the lines as in Figure \(\PageIndex{12}\).
Finding the x-intercept of a Line
So far, we have been finding the y-intercepts of a function: the point at which the graph of the function crosses the y-axis. A function may also have an x-intercept, which is the x-coordinate of the point where the graph of the function crosses the x-axis. In other words, it is the input value when the output value is zero.
To find the x-intercept, set a function \(f(x)\) equal to zero and solve for the value of \(x\). For example, consider the function shown.
\[f(x)=3x−6\]
Set the function equal to 0 and solve for \(x\).
\[\begin{align} 0&=3x-6 \\ 6&=3x \\ 2&=x \\ x&=2 \end{align}\]
The graph of the function crosses the x-axis at the point \((2, 0)\).
The x-intercept of the function is value of \(x\) when \(f(x)=0\). It can be solved by the equation \(0=mx+b\).
Find the x-intercept of \(f(x)=\frac{1}{2}−3\).
Solution
Set the function equal to zero to solve for \(x\).
\[\begin{align*} 0&=\dfrac{1}{2}x-3 \\ 3&=\dfrac{1}{2}x \\ 6 &= x \\ x&=6 \end{align*}\]
The graph crosses the x-axis at the point \((6, 0)\).
Analysis
A graph of the function is shown in Figure \(\PageIndex{14}\). We can see that the x-intercept is \((6, 0)\) as we expected.
Find the x-intercept of \(f(x)=\frac{1}{4}x−4\).
- Answer
-
\((16, 0)\)
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 y-value. In Figure \(\PageIndex{15}\), 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 \(m=0\) in the equation \(f(x)=mx+b\), the equation simplifies to \(f(x)=b\). In other words, the value of the function is a constant. This graph represents the function \(f(x)=2\).
A vertical line indicates a constant input, or x-value. We can see that the input value for every point on the line 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 in Figure \(\PageIndex{17}\), has an x-intercept, but no y-intercept unless it’s the line \(x=0\). This graph represents the line \(x=2\).
Lines can be horizontal or vertical.
- A horizontal line is a line defined by an equation in the form \(f(x)=b\).
- A vertical line is a line defined by an equation in the form \(x=a\).
Write the equation of the line graphed in Figure \(\PageIndex{18}\).
Solution
For any x-value, the y-value is −4, so the equation is \(y=−4\).
Write the equation of the line graphed in Figure \(\PageIndex{19}\).
Solution
The constant x-value is 7, so the equation is \(x=7\).
Key Concepts
- Linear functions may be graphed by plotting points or by using the y-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 y-intercept and slope of a line may be used to write the equation of a line.
- The x-intercept is the point at which the graph of a linear function crosses the x-axis.
- Horizontal lines are written in the form, \(f(x)=b\).
- Vertical lines are written in the form, \(x=b\).
Glossary
horizontal line
a line defined by \(f(x)=b\), where \(b\) is a real number. The slope of a horizontal line is 0.
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
vertical line
a line defined by \(x=a\), where a is a real number. The slope of a vertical line is undefined.
x-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