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.
Let's look at an example: y = 3x + 2. The coefficient of the x-term is 3, this means the line has a slope of 3. The constant being added at the end is 2. This means the y-intercept (where the line crosses the y-axis) is at positive 2.
What do you do if there's a minus sign in between the two terms? For example, what about the equation y = 5x - 8? We can rewrite subtracting 8 as adding a negative 8. This means the y-intercept is at -8.
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. Don't forget slope is rise over run: subtract the y-values in the numerator to get the rise and subtract the x-values in the denominator (in the same order!) to get the run.
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. The example below shows the first steps you would take if you needed to write an equation of the line through the points (2,5) and (4,13).
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 (just pick the one that looks easiest to you). Plug in the values for x and y into the equation and solve for b.
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).
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.
Example 2: 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.
Ready to try a few problems on your own? Click the START button below to try a practice quiz!