Find the Equation of a Line
How do online companies know that “you may also like” a particular item based on something you just ordered? How can economists know how a rise in the minimum wage will affect the unemployment rate? How do medical researchers create drugs to target cancer cells? How can traffic engineers predict the effect on your commuting time of an increase or decrease in gas prices? It’s all mathematics.
The physical sciences, social sciences, and the business world are full of situations that can be modeled with linear equations relating two variables. To create a mathematical model of a linear relation between two variables, we must be able to find the equation of the line. In this section, we will look at several ways to write the equation of a line. The specific method we use will be determined by what information we are given.
Find an equation of the line given the slope and y-intercept
We can easily determine the slope and intercept of a line if the equation is written in slope-intercept form, . Now we will do the reverse—we will start with the slope and -intercept and use them to find the equation of the line.
Example. Find the equation of a line with slope and -intercept .
Since we are given the slope and -intercept of the line, we can substitute the needed values into the slope-intercept form, .
Find the equation of a line with slope and -intercept .
Substitute and into .Find the equation of a line with slope and -intercept .
Substitute and into .Sometimes, the slope and intercept need to be determined from the graph.
Example. Find the equation of the line shown in the graph.
We need to find the slope and -intercept of the line from the graph so we can substitute the needed values into the slope-intercept form, . To find the slope, we choose two points on the graph. The -intercept is and the graph passes through .
Find the equation of the line shown in the graph immediately above.
Read the -intercept, then use the marked point to count the rise and run.Find the equation of the line shown in the graph immediately above.
Read the -intercept, then use the marked point to count the rise and run.Find an equation of the line given the slope and a point
Finding an equation of a line using the slope-intercept form of the equation works well when you are given the slope and -intercept or when you read them off a graph. But what happens when you have another point instead of the -intercept?
We are going to use the slope formula to derive another form of an equation of the line. Suppose we have a line that has slope and that contains some specific point and some other point, which we will just call . We can write the slope of this line and then change it to a different form.
This format is called the point-slope form of an equation of a line.
We can use the point-slope form of an equation to find an equation of a line when we know the slope and at least one point. Then, we will rewrite the equation in slope-intercept form. Most applications of linear equations use the slope-intercept form.
Example. Find an equation of a line with slope that contains the point . Write the equation in slope-intercept form.
Find the equation of a line with slope and containing the point .
Substitute the slope and point into , then solve for .Find the equation of a line with slope and containing the point .
Substitute the slope and point into , then solve for .We list the steps for easy reference.
To find an equation of a line given the slope and a point.
- Identify the slope.
- Identify the point.
- Substitute the values into the point-slope form, .
- Write the equation in slope-intercept form.
Example. Find an equation of a horizontal line that contains the point . Write the equation in slope-intercept form.
Every horizontal line has slope . We can substitute the slope and point into the point-slope form, .
It is in -form, but could be written . Did we end up with the form of a horizontal line, ?
Find the equation of a horizontal line containing the point .
Every horizontal line has slope and keeps the same -coordinate.Find the equation of a horizontal line containing the point .
Every horizontal line has slope and keeps the same -coordinate.Find an equation of the line given two points
When real-world data is collected, a linear model can be created from two data points. In the next example we’ll see how to find an equation of a line when just two points are given.
So far, we have two options for finding an equation of a line: slope-intercept or point-slope. When we start with two points, it makes more sense to use the point-slope form.
But then we need the slope. Can we find the slope with just two points? Yes. Then, once we have the slope, we can use it and one of the given points to find the equation.
Example. Find an equation of a line that contains the points and . Write the equation in slope-intercept form.
Find the equation of a line containing the points and .
First use the two points to find the slope, then use either point in point-slope form.Find the equation of a line containing the points and .
First use the two points to find the slope, then use either point in point-slope form.The steps are summarized here.
To find an equation of a line given two points.
- Find the slope using the given points, .
- Choose one point.
- Substitute the values into the point-slope form: .
- Write the equation in slope-intercept form.
Example. Find an equation of a line that contains the points and . Write the equation in slope-intercept form.
Again, the first step will be to find the slope.
The slope is undefined. This tells us it is a vertical line. Both of our points have an -coordinate of . So our equation of the line is . Since there is no , we cannot write it in slope-intercept form.
You may want to sketch a graph using the two given points. Does your graph agree with our conclusion that this is a vertical line?
Find the equation of a line containing the points and .
The two points have the same -coordinate, so the line is vertical.Find the equation of a line containing the points and .
The two points have the same -coordinate, so the line is vertical.We have seen that we can use either the slope-intercept form or the point-slope form to find an equation of a line. Which form we use will depend on the information we are given.
| If given | Use | Form |
|---|---|---|
| Slope and -intercept | slope-intercept | |
| Slope and a point | point-slope | |
| Two points | point-slope |
Find an equation of a line parallel to a given line
Suppose we need to find an equation of a line that passes through a specific point and is parallel to a given line. We can use the fact that parallel lines have the same slope. So we will have a point and the slope—just what we need to use the point-slope equation.
First, let’s look at this graphically. This graph shows . We want to graph a line parallel to this line and passing through the point .
We know that parallel lines have the same slope. So the second line will have the same slope as . That slope is . We’ll use the notation to represent the slope of a line parallel to a line with slope . (Notice that the subscript looks like two parallel lines.)
The second line will pass through and have . To graph the line, we start at and count out the rise and run. With (or ), we count out the rise and the run . We draw the line, as shown in the graph.
Do the lines appear parallel? Does the second line pass through ? We were asked to graph the line; now let’s see how to do this algebraically. We can use either the slope-intercept form or the point-slope form to find an equation of a line. Here we know one point and can find the slope. So we will use the point-slope form.
Example. Find an equation of a line parallel to that contains the point . Write the equation in slope-intercept form.
Look at the graph with the parallel lines shown previously. Does this equation make sense? What is the -intercept of the line? What is the slope?
Find an equation of a line parallel to that contains the point .
A parallel line has the same slope. Use that slope and the given point in point-slope form.Find an equation of a line parallel to that contains the point .
A parallel line has the same slope. Use that slope and the given point in point-slope form.Find an equation of a line parallel to a given line.
- Find the slope of the given line.
- Find the slope of the parallel line.
- Identify the point.
- Substitute the values into the point-slope form: .
- Write the equation in slope-intercept form.
Find an equation of a line perpendicular to a given line
Now, let’s consider perpendicular lines. Suppose we need to find a line passing through a specific point and which is perpendicular to a given line. We can use the fact that perpendicular lines have slopes that are negative reciprocals. We will again use the point-slope equation, like we did with parallel lines.
This graph shows . Now, we want to graph a line perpendicular to this line and passing through .
We know that perpendicular lines have slopes that are negative reciprocals. We’ll use the notation to represent the slope of a line perpendicular to a line with slope . (Notice that the subscript looks like the right angles made by two perpendicular lines.)
We now know the perpendicular line will pass through with . To graph the line, we will start at and count out the rise and the run . Then we draw the line.
Do the lines appear perpendicular? Does the second line pass through ? We were asked to graph the line; now, let’s see how to do this algebraically.
We can use either the slope-intercept form or the point-slope form to find an equation of a line. In this example we know one point, and can find the slope, so we will use the point-slope form.
Example. Find an equation of a line perpendicular to that contains the point . Write the equation in slope-intercept form.
Find an equation of a line perpendicular to that contains the point .
The perpendicular slope is the negative reciprocal of . Use it with the point in point-slope form.Find an equation of a line perpendicular to that contains the point .
The perpendicular slope is the negative reciprocal of . Use it with the point in point-slope form.Find an equation of a line perpendicular to a given line.
- Find the slope of the given line.
- Find the slope of the perpendicular line.
- Identify the point.
- Substitute the values into the point-slope form, .
- Write the equation in slope-intercept form.
Example. Find an equation of a line perpendicular to that contains the point . Write the equation in slope-intercept form.
Again, since we know one point, the point-slope option seems more promising than the slope-intercept option. We need the slope to use this form, and we know the new line will be perpendicular to . This line is vertical, so its perpendicular will be horizontal. This tells us .
Sketch the graph of both lines. On your graph, do the lines appear to be perpendicular?
Find an equation of a line that is perpendicular to and contains the point .
A line perpendicular to a vertical line is horizontal and keeps the point’s -coordinate.Find an equation of a line that is perpendicular to and contains the point .
A line perpendicular to a vertical line is horizontal and keeps the point’s -coordinate.In the preceding example, we used the point-slope form to find the equation. We could have looked at this in a different way. We want to find a line that is perpendicular to that contains the point . The first graph shows us the line and the point .
We know every line perpendicular to a vertical line is horizontal, so we will sketch the horizontal line through .
Do the lines appear perpendicular? If we look at a few points on this horizontal line, we notice they all have -coordinates of . So, the equation of the line perpendicular to the vertical line is .
Example. Find an equation of a line that is perpendicular to that contains the point . Write the equation in slope-intercept form.
The line is a horizontal line. Any line perpendicular to it must be vertical, in the form . Since the perpendicular line is vertical and passes through , every point on it has an -coordinate of . The equation of the perpendicular line is . You may want to sketch the lines. Do they appear perpendicular?
Find an equation of a line that is perpendicular to and contains the point .
A line perpendicular to a horizontal line is vertical and keeps the point’s -coordinate.Find an equation of a line that is perpendicular to and contains the point .
A line perpendicular to a horizontal line is vertical and keeps the point’s -coordinate.Key terms
point-slope form — the form of an equation of a line with slope containing the point . parallel lines — lines in the same plane that do not intersect and have the same slope. perpendicular lines — lines that intersect at a right angle and whose slopes are negative reciprocals.
This section is adapted from Intermediate Algebra 2e, Section 3.3: Find the Equation of a Line by Lynn Marecek, Andrea Honeycutt Mathis, and OpenStax, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: recreated the coordinate-plane figures as accessible interactive graphs; omitted the Be Prepared quiz, media links, and end-of-section exercises; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback.