Equation for a Line

When Knowing One Point and Slope

We can calculate the equation of a line, if we know what the slope is and one of the points.

Say we know what the value of the slope is, m. And we know the value of one of the points on the line (x1, y1). Then we can use the equation,

y - y1 = m(x - x1) to give us an equation for the line, that would end up looking like,

y = mx + (some number)

Example: Equation for line when knowing one point in the line and slope of line

Question: Find the equation for the line with the slope 3 and that passes through the point (1, 4).

We know two things from the question,

The slope of the line is 3

A point along that line is (1, 4)

We are looking for the equation of that line,

The equation y - y1 = m(x - x1) can give us that equation,

m = 3

x1 = 1 and y1 = 4,

Subbing those values in,

y - 4 = 3(x - 1)

y - 4 = 3x -3

Add 4 to both sides,

y + 0 = 3x - 3 + 4

y = 3x + 1

There we have our equation for the line that has the slope of 3 and passes through the point (1, 4)

[for “fun” lets sub (1, 4) into our equation,

(4) = 3(1) + 1

4 = 3 + 1

4 = 4]

When Knowing Two points on the Line

We can also find the equation for a line when we only know two points on the line.

[We will use the same equation as we did when we knew one point and the slope]

y - y1 = m(x - x1)

Say our two points on the line are A(x1, y1) and B(x2, y2), we can actually use either of those points and sub them into the equation above. However, we still need to calculate m (slope). Remember,

m =  
change in y
change in x
  =  
Δ y
Δ x
  =  
y2 - y1
x2 - x1

So our first step to working out what the equation is will be calculating the slope. As we know two points on the line

A(x1, y1) and B(x2, y2) we can calculate the slope.

m =  
y2 - y1
x2 - x1

Once we have the slope, m, sub that into,

y - y1 = m(x - x1)

Then solve by subbing in the values of either A or B. So our general equation for calculating an equation when we know two points of a line is

y - y1 = m(x - x1), with m =  
y2 - y1
x2 - x1

Example: finding equation when knowing two points on a line

Question: Calculate the equation to the line with the points M (3, 7) and N (4, 8).

We know when working with two points to calculate the equation of the line that those two points lie on,

y - y1 = m(x - x1), with m =  
y2 - y1
x2 - x1

First, we need to calculate m,

So, with M(3, 7) as our first point, x1 = 3 and y1 = 7

And N (4, 8) as our second point, x2 = 4 and y2 = 8

So,

m =  
y2 - y1
x2 - x1
m =  
8 - 7
4 - 3
  =  
1
1

= 1

Now we have our slope, m = 1, this is only half of the work we need to do! Now we can sub this into,

y - y1 = m(x - x1),

y - y1 = (1)(x - x1)

And now, sub in either our M or N point (both will work as the x1 and y1 we sub in can be any point on the line we are trying to calculate the equation for)

Lets choose M(3, 7), with x1 = 3 and y1 = 7,

y - 7 = (1)(x - 3)

y - 7 = x - 3

Add 7 to both sides,

y - 7 + 7 = x - 3 + 7

y = x + 4

And there we have our equation for the line with the two points M and N on it.