Writing Equations in Slope-Intercept Form

To write an equation in slope-intercept form, find the slope m and the y-intercept b, then put them into y = mx + b. If you don’t know b, substitute the slope and one point into y = mx + b and solve for b. This works for a graph, two points or a word problem.

Before this lesson: You should know slope-intercept form, the slope formula and how to solve two-step equations.

What You Need to Write the Equation

Every line in slope-intercept form needs two numbers: the slope m and the y-intercept b. What you do depends on what you’re given.

What you knowWhat to do
The slope and the y-interceptPut them straight into y = mx + b.
The slope and one pointSubstitute the slope and the point into y = mx + b, then solve for b.
Two pointsFind the slope with the slope formula first. Then use one point to solve for b.
A graphRead b where the line crosses the y-axis. Count the rise and run to find m.

How to Find b From the Slope and a Point

  1. Write y = mx + b with your slope in place of m.
  2. Put the point’s x-value in for x and its y-value in for y.
  3. Solve the equation for b.
  4. Write the final equation with your m and b.
  5. Check: put the point back in and make sure both sides match.

Here is why this works. Every point on a line makes its equation true. So when you plug in a point, the only unknown left is b.

Worked Examples

Example 1: Slope and y-intercept

Write the equation of the line with slope −4 and y-intercept 7.

Step 1. Put m = -4 and b = 7 into y = mx + b.

Answer: y = -4x + 7

Example 2: Slope and one point

Write the equation of the line with slope 3 that passes through (2, 1).

Step 1. Start with y = 3x + b.

Step 2. Put in x = 2 and y = 1, then solve for b.

\begin{aligned}
1 &= 3(2) + b \\
1 &= 6 + b \\
-5 &= b
\end{aligned}

Answer: y = 3x - 5

Check: 3(2) - 5 = 1. The point (2, 1) is on the line.

Example 3: Two points

Write the equation of the line through (−2, 5) and (4, −1).

Step 1. Find the slope.

m = \frac{-1 - 5}{4 - (-2)} = \frac{-6}{6} = -1

Step 2. Use the point (−2, 5) to find b.

\begin{aligned}
5 &= -1(-2) + b \\
5 &= 2 + b \\
3 &= b
\end{aligned}

Answer: y = -x + 3

Check with the other point: -(4) + 3 = -1. The point (4, −1) is on the line too.

Example 4: From a graph

Write the equation of the line in the graph.

Graph of a line that crosses the y-axis at (0, −2) and passes through (3, 2). A dashed path goes right 3 and up 4, so the slope is 4/3.
The line crosses the y-axis at (0, −2) and passes through (3, 2), so its slope is 4/3.

Step 1. The line crosses the y-axis at (0, −2), so b = -2.

Step 2. Find another point where the line crosses grid corners exactly: (3, 2).

Step 3. From (0, −2) to (3, 2), the line goes up 4 and right 3. So m = \frac{4}{3}.

Answer: y = \frac{4}{3}x - 2

Example 5: Word problem

A taxi charges a starting fee plus a cost per mile. A 3-mile ride costs $10.50, and an 8-mile ride costs $20.50. Write an equation for the cost C of a ride of d miles.

Step 1. Write the facts as points (miles, cost): (3, 10.50) and (8, 20.50).

Step 2. Find the slope, which is the cost per mile.

m = \frac{20.50 - 10.50}{8 - 3} = \frac{10}{5} = 2

Step 3. Use (3, 10.50) to find b, the starting fee.

\begin{aligned}
10.50 &= 2(3) + b \\
10.50 &= 6 + b \\
4.50 &= b
\end{aligned}

Answer: C = 2d + 4.50. The taxi charges $2 per mile plus a $4.50 starting fee.

Common Mistakes

MistakeWhat it looks likeHow to fix it
Using the point’s y-value as bSlope 3 through (2, 1) written as y = 3x + 1b is the y-value only when x = 0. Solve for b.
Adding instead of subtracting5 = 2 + b, so b = 7Subtract 2 from both sides: b = 3.
Slope upside downPoints (1, 3) and (3, 11) give m = \frac{2}{8}The y-values go on top: m = \frac{8}{2} = 4.
Sign errors with negatives-1(-2) = -2A negative times a negative is positive: -1(-2) = 2.
Skipping the checkWriting an equation that misses one of the pointsPut the other point into your equation. Both sides should match.

Special Cases

  • Horizontal lines: The line through (−4, 3) and (6, 3) has slope \frac{0}{10} = 0. Its equation is y = 3.
  • Vertical lines: The line through (3, 1) and (3, 8) has the same x-value for both points. Its slope is undefined, so the equation is x = 3. It can’t be written as y = mx + b. See Horizontal and Vertical Lines.
  • Another method: Point-slope form, y - y_1 = m(x - x_1), is another way to write a line from a point and a slope. It has its own lesson later in this unit.

Practice Problems

Write each equation in slope-intercept form.

  1. Slope 5, y-intercept −2
  2. Slope -\frac{2}{3}, y-intercept 4
  3. Slope 2, through (3, 10)
  4. Slope −3, through (−1, 8)
  5. Slope \frac{1}{4}, through (8, 1)
  6. Through (1, 3) and (3, 11)
  7. Through (−2, 6) and (2, −2)
  8. Through (0, −5) and (5, 0)
  9. Through (−4, 3) and (6, 3)
  10. A plumber charges a fixed fee plus an hourly rate. A 2-hour job costs $190, and a 5-hour job costs $340. Write an equation for the cost C of an h-hour job.
Show answers
  1. y = 5x - 2
  2. y = -\frac{2}{3}x + 4
  3. 10 = 2(3) + b, so b = 4. The equation is y = 2x + 4.
  4. 8 = -3(-1) + b, so 8 = 3 + b and b = 5. The equation is y = -3x + 5.
  5. 1 = \frac{1}{4}(8) + b, so 1 = 2 + b and b = -1. The equation is y = \frac{1}{4}x - 1.
  6. m = \frac{11 - 3}{3 - 1} = 4. Then 3 = 4(1) + b, so b = -1. The equation is y = 4x - 1.
  7. m = \frac{-2 - 6}{2 - (-2)} = \frac{-8}{4} = -2. Then 6 = -2(-2) + b, so b = 2. The equation is y = -2x + 2.
  8. m = \frac{0 - (-5)}{5 - 0} = 1, and (0, −5) is the y-intercept. The equation is y = x - 5.
  9. m = \frac{3 - 3}{6 - (-4)} = 0. The equation is y = 3.
  10. m = \frac{340 - 190}{5 - 2} = \frac{150}{3} = 50. Then 190 = 50(2) + b, so b = 90. The equation is C = 50h + 90: $50 per hour plus a $90 fee.

Writing Equations FAQ

How do you write an equation in slope-intercept form from two points?

Find the slope with m = \frac{y_2 - y_1}{x_2 - x_1}. Then put the slope and one of the points into y = mx + b and solve for b.

How do you find b in y = mx + b?

Put the slope and any point on the line into y = mx + b, then solve for b. If you have a graph, b is where the line crosses the y-axis.

How do you write an equation from a graph?

Read the y-intercept where the line crosses the y-axis. Then count the rise and run between two grid points to find the slope.

Can you write a vertical line in slope-intercept form?

No. A vertical line has an undefined slope, so you write it as x = a instead.

Summary

  • Slope-intercept form is y = mx + b. You need m and b.
  • With two points, find the slope first.
  • To find b, put the slope and one point into y = mx + b and solve.
  • On a graph, b is where the line crosses the y-axis.
  • Always check your equation with a second point.

Previous lesson: Slope-Intercept Form

Next lesson: Point-Slope Form

Next unit: Systems of Equations

Back to the Algebra 1 Index

Similar Posts