8.3: Graph a Line Given its Equation
Learning Outcomes
- Identify the slope and y-intercept from the equation of a line.
- Plot the y-intercept of a line given its equation.
- Plot a second point on a line given the y-intercept and the slope.
- Graph a line given its equation in slope y-intercept form.
Often we are given an equation of a line and we want to visualize it. For this reason, it is important to be able to graph a line given its equation. We will look at lines that are in slope intercept form: \(y=a + bx\) where \(a\) is the y-intercept of the line and \(b\) is the slope of the line. The y-intercept is the value of \(y\) where the line crosses the y-axis. The slope is the rise over run. If we write the slope as a fraction, then the numerator tells us how far to move up (or down if it is negative) and the denominator tells us how far to the right we need to go. The main application to statistics is in regression analysis which is the study of how to use a line to make a prediction about one variable based on the value of the other variable.
Example \(\PageIndex{1}\)
Graph the line given by the equation:
\[y=1+\frac{3}{2}x \nonumber\]
Solution
We follow the three step process:
Step 1: Plot the y-intercept
The y-intercept is the number that is not associated with the \(x\). For this example, it is 1. The x-coordinate of the y-intercept is always 0. So the coordinates of the y-intercept are (0, 1). Thus start at the origin and move up 1:
Step 2: Plot the Slope.
The slope of a line is the coefficient of the \(x\) term. Here it is \(\dfrac{3}{2}\). What this means is that we rise 3 and run to the right 2. Rising 3 from an original y-coordinate of 1 gives a new y-coordinate of 4. Running 2 to the right from an initial x-coordinate of 0 gives a new x-coordinate of 2. Thus we next plot the point (2, 4).
Step 3: Connect the Dots
The last thing we need to do is connect the dots with a line:
Example \(\PageIndex{2}\)
A study was done to look at the relationship between the weight of a car, \(x\), in tons and its gas mileage in mpg, \(y\). The equation of the regression line was found to be:
\[y=110-70x \nonumber\]
Graph this line.
Solution
The fist step is to note that the y-intercept is 110, hence the graph goes through the point (0, 110). The next step is to see that the slope is -70. We can always put a number over 1 in order to make it a fraction. The slope of \(-\dfrac{70}{1}\) tells us that \(y\) goes down by 70 if \(x\) goes up by 1. We use this to find the second point. The y-coordinate is: \(110\:-\:70\:=\:40\). The x-coordinate is 1. Thus, a second point is (1, 40). We can now plot the two points and connect the dots with a line.
Exercise
The regression line that relates the ounces of beer consumed just before a test, \(x\), and the score on the test, \(y\), is given by
\(y=93-1.2x\)
Graph this line.
- Answer
-
Additional video resources: