Steply

Line (-2, -1) (2, 7)

Step by step, with the reason for every step · Equation of a line through two points · Algebra 1

Step by step

The question

Question: find the equation of the line through (−2, −1) and (2, 7).

(−2, −1) and (2, 7)

Every line that is not straight up and down is y = mx + b.

m is the slope.

b is where the line crosses the y-axis: where we start.

So we need m and b.

y = mx + b
m = slope
b = start

1 Find the slope

We call the slope m.

m = rise over run.

m = riserun

The top is the change in y: second y minus first y.

The bottom is the change in x: second x minus first x.

m = y2 − y1x2 − x1

Put the numbers in.

The second point is (2, 7).

The first point is (−2, −1).

m = 7 − (−1)2 − (−2)

Taking away a negative is the same as adding.

− (−) = +

So it becomes (7 + 1)/(2 + 2).

m = 7 + 12 + 2

7 plus 1 is 8.

2 plus 2 is 4.

m = 84

8 divided by 4 is 2.

So m = 2.

m = 2

2 Find b

In y = mx + b, put m = 2.

Then use the point (−2, −1): put x = −2 and y = −1 in.

−1 = 2 × (−2) + b

Minus times plus is minus.

2 times −2 is −4.

−1 = −4 + b

We want b by itself.

The − 4 is in the way.

To remove − 4, we add 4.

We do it on both sides, so they stay equal.

−1 + 4 = −4 + b + 4

−4 and + 4 make zero.

Cross them out.

−1 plus 4 is 3.

So b = 3.

3 = b

3 Write the equation

Put m = 2 and b = 3 into y = mx + b.

So the line is y = 2x + 3.

y = 2x + 3

4 Check

Let's check: put x = −2 in.

We get −1, the y of (−2, −1).

y = 2(−2) + 3 = −4 + 3 = −1

Now x = 2 in.

We get 7, the y of (2, 7).

y = 2(2) + 3 = 4 + 3 = 7

Let's see it.

Both points are on the line y = 2x + 3.

And it crosses the y-axis at 3, just like b says.

Let's look back.

First: find the slope.

Then: find b.

Then: write the equation.

Last: check.

Answer
y = 2x + 3

Your turn

Try this one yourself, then check:

Find the equation of the line through (−3, −1) and (3, 5)
Show the answer
y = x + 2

More from Equation of a line through two points

The whole lesson: Equation of a line through two points →