Find the Equation of a Line
The physical sciences, social sciences, and the business world are full of situations that can be modeled with linear equations relating two variables. If data appears to form a straight line when graphed, an equation of that line can be used to predict the value of one variable based on the value of the other. 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 look at several ways to write the equation of a line — the method we use is determined by what information we are given.
Find an equation of the line given the slope and -intercept
If we already know the slope and -intercept of a line, we can find its equation by substituting the values directly into the slope-intercept form, .
Example. Find an equation of a line with slope and -intercept .
We substitute and into :
Example. Find the equation of the line shown, whose -intercept is and which also passes through .
We find the slope by counting the rise and run between the two points: . Substituting and into :
Find an equation of a line with slope and y-intercept .
Substitute the slope for m and the y-intercept's y-value for b into y = mx + b.Find an equation of a line with slope -1 and y-intercept (0, -3).
Substitute the slope for m and the y-intercept's y-value for b into y = mx + b.Find an equation of the line given the slope and a point
The slope-intercept form works well when we know the slope and -intercept. But what if we know the slope and some other point that isn’t the -intercept? We can derive another form of the equation by starting with the slope formula for a line through a specific point and some other point :
Multiplying both sides by and simplifying gives .
Point-slope form of an equation of a line. The point-slope form of an equation of a line with slope and containing the point is
We can use the point-slope form to find an equation of a line when we are given the slope and one point, then rewrite the equation in slope-intercept form.
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 line with slope that contains the point . Write the equation in slope-intercept form.
Substituting and into the point-slope 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 . Substituting and :
This is the equation of the horizontal line .
Find an equation of a line with slope that contains the point . Write the equation in slope-intercept form.
Substitute m and the point into , then simplify and solve for y.Find an equation of the line given two points
When real-world data is collected, a linear model can often be created from just two data points. We have two options so far for finding an equation of a line: slope-intercept or point-slope. Since we will know two points rather than the slope directly, it makes more sense to first find the slope from the two points, then use the point-slope form.
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.
First we find the slope:
Choosing the point and substituting into the point-slope form:
Using the other point, , gives the same equation.
Example. Find an equation of a line that contains the points and . Write the equation in slope-intercept form.
Finding the slope:
The slope is undefined, telling us this is a vertical line. Both points have -coordinate , so the equation of the line is . Since there is no , we cannot write it in slope-intercept form.
To write an equation of a line
| 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 that contains the points (3, 1) and (5, 6). Write the equation in slope-intercept form.
Find the slope from the two points first, then substitute one point into and solve for y.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. Since parallel lines have the same slope, we already have the slope we need — we just combine it with the given point using the point-slope form. We write for the slope of a line parallel to a line with slope .
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 — parallel lines have the same 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 line parallel to that contains the point . Write the equation in slope-intercept form.
The given line is in slope-intercept form with . Since parallel lines have the same slope, . Substituting and into the point-slope form:
Find an equation of a line parallel to the line that contains the point . Write the equation in slope-intercept form.
Parallel lines share the same slope. Substitute and the point into , then solve for y.Find an equation of a line perpendicular to a given line
Now consider finding a line through a specific point that is perpendicular to a given line. Perpendicular lines have slopes that are negative reciprocals of each other, so we again already have the slope we need. We write for the slope of a line perpendicular to a line with slope .
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 — perpendicular slopes are negative reciprocals of each other.
- 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.
The given line has , so the perpendicular slope is the negative reciprocal, . Substituting and :
Example. Find an equation of a line perpendicular to that contains the point . Write the equation in slope-intercept form.
The line is vertical, so any line perpendicular to it must be horizontal, with slope . Substituting and :
Example. Find an equation of a line perpendicular to that contains the point . Write the equation in slope-intercept form.
The line is horizontal, so any line perpendicular to it must be vertical, in the form . Since the perpendicular line passes through , every point on it has -coordinate . The equation of the perpendicular line is .
Find an equation of a line perpendicular to the line that contains the point . Write the equation in slope-intercept form.
The perpendicular slope is the negative reciprocal of . Substitute that slope and the point into , then solve for y.A line is perpendicular to . What form must its equation take?
A line perpendicular to a vertical line is horizontal, and every horizontal line has slope 0.Key terms
point-slope form — the form of an equation of a line with slope that contains the point ; useful whenever the slope and any one point (not necessarily the -intercept) are known, or when two points are known and the slope is found first.
This section is adapted from Elementary Algebra 2e, Section 4.6: Find the Equation of a Line by Lynn Marecek, MaryAnne Anthony-Smith, and Andrea Honeycutt Mathis, © OpenStax, licensed under CC BY-NC-SA 4.0. Access the original for free at openstax.org. Changes: condensed the worked examples and tables; omitted the Be Prepared quiz, Media links, Self Check checklist, and Section Exercises; and converted the practice problems (“Try Its”) into interactive exercises with instant feedback.