There are a few different ways to write the equation of a line. One of the most common ways is called "slope-intercept" form. It's called this because it clearly identifies the slope and the y-intercept in the equation. The slope is the number written before the x. The y-intercept is the constant written at the end.
For example, the line y = 3x - 8 has a slope of 3 (the coefficient of the x-term) and a y-intercept of -8 (the constant at the end).
Using Points to Write Slope-Intercept Equation
If you know two points on a line, you can use them to write the equation of the line in slope-intercept form. The first step will be to use the points to find the slope of the line. This will give you the value of m that you can plug into y = mx + b. The second step will be to find the y-intercept. Once you know m and b, you can write the equation of the line.
Step 1: Find the slope (m)
The slope of the line through two points (x1,y1) and (x2,y2) can be found by using the formula below. Make sure to check out our lesson on using points to find slope if you need extra help on this step.
Once you know the slope of the line, plug it in for m in y = mx + b. For example, if you used the formula and found that the slope is 2, you would write y = 2x + b.
Once you know the slope (m), you're halfway there. Now all that's left to find is the y-intercept (b). To find the y-intercept, choose one of the points on the line. It does not matter which point you choose. Plug in the values for x and y into the equation and solve for b.
For example, let's say you had written y = 2x + b after the first step and one of your points was (3,9). You would plug in 3 for x and 9 for y. This would give you 9 = 2(3) + b. This is now an equation with only one variable left: the b. You can simplify it to 9 = 6 + b and subtract 6 from both sides to see that b = 3.
Step 3: Write the equation in slope-intercept form (y = mx + b)
At this point, you've solved for both m and b. All that's left to do is to plug them both in and write the equation in slope-intercept form (y = mx + b).
In the example we used above, we found that the slope (m) was 2 and the y-intercept (b) was 3. If we plug in m and b, our equation would be y = 2x + 3.
Step 4: Check Your Equation
It's always a good idea to check your work when possible. To double check the accuracy of your equation, you can use the other point that's on the line (the one you didn't use in Step 2 to find b). Plug in the x value from this point into your y = mx + b equation and see if it comes out to the correct y value.
For example, let's say the second point we were given was (4,11). We would plug in 4 for x into the equation y = 2x + 3 and make sure the y value comes out to 11. 2(4) + 3 = 8 + 3 = 11, so we can see that our equation is correct.
Example: Write the equation of the line through (4,7) and (6,13)
Step 1: Find the slope (m). Use the formula to find the slope between the two points.
Once you know the slope, plug it in for m in y = mx + b. This gives you y = 3x + b.
Step 2: Find the y-intercept (b). Pick oneof the points on the line and use the x and y values to find b. It does not matter which point you choose. We'll pick the first point (4,7) and plug in 4 for x and 7 for y.
Step 3: Write the equation in slope-intercept form (y = mx + b) Now that we know m = 3 and b = -5, we can plug these values in and write the equation in slope-intercept form.
Step 4: Check your answer We used the point (4,7) in Step 2, so to check our equation we need to use the other point: (6,13). If you use the same point twice, it will not find a mistake. Make sure to use the point you didn't use to find the y-intercept in Step 2.
Plug in the x value from the other point and see if it works. If we plug in 6 for x in our equation, the y value should come out to 13.
3(6) - 5 = 18 - 5 = 13. It works!
If we had plugged in 6 and it came out to a number that wasn't 13, that would tell us that we had made a mistake somewhere along the way. If this happens to you, start by double checking to make sure you calculated the slope correctly. You may have used the formula incorrectly or missed a negative sign somewhere.
Practice
Ready to try a few problems on your own? Click the START button below to try a practice quiz!