How to Find Equations of Lines

by Shelley Walsh ©2001

Once you have learned to graph equations you are ready for the more interesting side to analytical geometry, finding equations that produce given graphs. The simplest and most basic case of this is the line. The goal is to take given characteristics that we want the line to have and find equations whose graphs have them. Here are the standard things that you need to master in order to do this.

Slope

The slope of a line is a measure of its steepness. There are a number of ways that you could measure the steepness of a line, but the way we do it for the slope is to compare the amount that it climbs or rises to the amount that it goes from left to right or runs.
To give a number that represents a comparison between the rise and run in such a way that bigger numbers indicate more steepness we divide the rise by the run and call that number the slope.
slope= rise
run

For analytical geometry it is necessary to be able to compute the slope given two points on the line (x1,y1) and (x2,y2). The traditional letter used to stand for the slope is m. Since the y coordinate represents how far up or down the point is, the rise will be the difference between the y's. Since the x coordinate represents how far to the right or left the point is, the run will be the difference between the x's. So this gives us
 

m= y2-y1
x2-x1

for the slope formula. By making the order matter in this formula we can make the slope be positive when the line is going uphill from left to right and negative when the line is going downhill from left to right. But for this we don't have to worry about which point is point number one and which is point number two, as long as we are consistent, because if we reversed the order of both the difference in the numerator and the one in the denominator the sign changes would cancel out.

Examples:

Find the slope of the line passing throught the given two points.

Example 1:

(1,3) and (7,8)

Solution:

m= 8-3
7-1
= 5
6

Notice that if I had reversed the order of the points I would have gotten
 

m= 3-8
1-7
= -5
-6
= 5
6
,
but I need to be consistent, because
 
3-8
7-1
=
5
-6
,

which is not the same thing. We can tell from this slope of 5/6 that the line goes uphill from left to right and it rises 5/6 as much as it travels from left to right. A line with slope 1 would be one that makes a 45° angle with the axes, so a line of slope 5/6 would be just a little less steep than that.

Example 2:

(2,7) and (7,-1)

Solution:

ã
m=
-1-7
7-2
=
-8
5

The line passing through these two points must be going downhill from left to right and it is somewhat steeper than the last one.

Slope-Point

The key formula for all of this is the slope-point formula. It is the formula that tells you how to find the equation of a line given its slope and one point that it passes through. The formula

y-y1=m(x-x1)

tells us that if we want to find the equation of the line with slope m that passes through the point (x1,y1), then we can get this equation simply by writing down y-y1=m(x-x1) and simplifying.

Example:

Find the equation of the line whose slope is 3 and passes through the point (1,2).

Solution:

The given point is (1,2), so that means that x1=1 and y1=2. Since the slope is 3, m=3. Replacing x1, y1, and m with these numbers in the formula, we get

y-2=3(x-1)

and now all we have to do is simplify.

y-2=3x-3
y=3x-1.

This says that this is the equation I would need to use if I wanted to get a line that passed through (1,2) and went uphill from left to right 3 times as fast as it went from left to right.

Why does this formula work and how would you go about figuring it out if you didn't know it? Well, to derive a formula like this we can use a standard strategy that is very often used in analytic geometry. What we do is we figure out an entrance test that any point on the line will pass and that only points on the line can pass. This technique comes up all over the place in analytical geometry, for another example see Equations of Circles. The way to do it in this case is to realize that the slope can be computed with ANY two points on the line. We already have one point given, so by using our point that needs to pass the entrance test as the other point, we should be able to write down an expression that has to be equal to the slope.

Using these two points to compute the slope, we get
 
y-y1
x-x1
.

But we have already been given that the slope is m, so that means that in order for (x,y) to be on our line, this expression must be equal to m, which gives us this equation for our entrance test.
 

y-y1
x-x1
=m

We get make it look nicer by multiplying both sides by x-x1, and that gives us

y-y1=m(x-x1)

for our point slope formula.

This formula is quite powerful. We can get pretty much everything we need out of it.

Slope-Intercept

Suppose now that we want to find the equation of the line with a given slope and given y intercept. The y intercept is the place where the graph crosses the y axis, and for this sort of problem we normally use the slope-intercept formula. But the y intercept is after all just a special point, so we could get it as well from the slope-point formula, or better yet, we can derive it in general from it.

A y intercept is a point of the form (0,b). For a point of that form the slope-point formula becomes

y-b=m(x-0)=mx.

Adding b to both sides this becomes

y=mx+b,

the slope-intercept formula.

Example:

Find the equation of the line with slope 2 and y intercept (0,4).

Solution:

m=2 and b=4, just replace m and b with these in the formula, so the equation is

y=2x+4.

Two Points

Two points determine a line, so given two points there ought to be a way to find the equation of the line passing through them. Some people like to write down a formula for this, but it isn't really necessary, because it is just a combination of two formulas that we already have. If you have two points you can find the slope and then you have more than you need, you have two points and a slope, so if you throw out one of the points you have a slope and a point, so you can use the slope-point formula.

Example:

Find the equation of the line passing through the points (1,2) and (-3,10).

Solution:

m= 10-2
-3-1
=
8
-4
=-2

Use (1,2) for the point, because the numbers are smaller, but we would get the same answer if we used (-3,10). Substituting into the slope-point formula, we get

y-2=-2(x-1)
y-2=-2x+2
y=-2x+4.

One interesting thing about this method is that you can apply to things other than analytical geometry. It sort of tells you how to do algebra backwards. You have two solutions to a two variable linear equation and you want to figure out what the equation that gives them is. You have a relation between two things and two data points and you know it is a linear relation, and you want to know what the equation is.

Example:

Sometimes I forget what the formula for converting Celcius temperature to Farheit, but I know it is a linear equation and I know that 0°C=32°F and 100°C=212°F.

Solution:

Since the equation I remember was for F in terms of C, I think of C as x and F as y, so the two points are (0,32) and (100,212). First I find the slope, (which actually probably all I need, because I usually remember the +32 part of it).
 
m= 212-32
100-0
= 180
100
= 9
5

Then I see that this one is really easier than the general case, because one of my points (0,32) is the y intercept, so I don't need to use the more complicated slope-point formula, instead I can use the slope-intercept formula, where m=9/5 and b=32, so the equation and formula is
 

F= 9
5
C+32.

Relationship between Slope-Point and Slope-Intercept

So far we have two important formulas for finding equations of lines, the slope-point and the slope-intercept.

Slope-intercept:  y=mx+b
Slope-point:  y-y1=m(x-x1)

Here is something interesting about them. Clearly the slope-intercept is a special case of the slope-point, because the y intercept is after all a point, so if you forget the first of these formulas, you can do it all with the second one. But what is not so clear is that you can actually do the reverse. If you forget the slope-point formula you can do it all with the slope intercept formula by a little algebra trick. If you have a slope and an arbitrary point that is not the y intercept what you do is you plug in the m in the slope-intercept formula and leave the b as b. Then you substitute in the point into the equation, because in order for the point to be on the line, it must satisfy the equation. After you do that you will have only one letter in the equation, the b, so you just treat that like a variable in solve for it. Once you have the b, you just substitute it back into the equation, and the equation will be complete.

Example:

Find the equation of the line with slope -2 passing through the point (1,3).

Solution:

This time I am going to pretend that I have panicked out on an exam and forgotten the slope-point formula, but I remember the slope-intercept formula. I know m, m=-2, so my equation is of the form

y=-2x+b,

for some b. Now I just need to find out what that b is. Since my line passes through the point (1,3), (1,3) must satisfy the equation, so I will find the b that makes this happen. Replacing x with 1 and y with 3, I get

3=-2(1)+b
3=-2+b.

I add 2 to both sides to solve for b and get b=5, so my equation is

y=-2x+5.

Parallel and Perpendicular

An important goal in analytical geometry is to be able to express all of the usual geometrical things in terms of coordinates and algebra in order to make that important connection between geometry and algebra that aids the understanding of both subjects. So we ought to be able to tell in some way having to do with equations and coordinates whether two lines are parallel or perpendicular. As a measure of the steepness of a line, the slope is likely to be useful for this. What we need to find is the relationship between the slopes of parallel and perpendicular lines.

Parallel is pretty easy, because they are going the same direction, so their slopes must be equal.

Parallel:  m1=m2

For perpendicular lines the relation is a bit more complicated. The slopes of perpendicular lines are negative reciprocals of each other.

Perpendicular:  m1=-1/m2

To see why this is true, let's look at a picture of two perpendicular lines.

I've drawn the lines passing through the origin to make things simpler, which is okay to do, because the location of the lines won't effect their slopes. I've also drawn rises and runs for them, so that we can figure out what the slopes are. After drawing them for line 1 and naming them a and b, I went up a distance of b for the rise for line 2. To figure out the relation between the slopes we need to figure out what the distance represented by the question mark is. It looks like it is a. If this indeed the case we can get the relation, because then the slope of line 2 would be -b/a, and since the slope of line 1 is a/b, the slope of line 2 would indeed by the negative reciprocal of that of line 1.

But pictures can be deceiving, so we want to see this by some kind of good geometric reasoning. The way to do this is to show that the two triangles are congruent. In congruent triangles all of the corresponding pieces, the three sides and three angles, have the same measures, but various geometry theorems tell us that in most cases three out of six of these pieces is enough to guarantee the rest. In particular, any two angles and one side, SAA, will do it. For these two triangles one angle and one side are easy to get. They are both right triangles and I have constructed the second one so that the b sides are the same.

What I would like to show is that the red angle and the pink angle in the picture below have the same measures.

Let's see if I can do it. The pink angle plus the yellow angle is 90°, because the coordinate axes are perpendicular. The red angle plus the yellow angle is 90°, because line 1 and line 2 are perpendicular. So since

pink+yellow=red+yellow,

we must have

pink=red

This gives us two angles and a side, so the two triangles must be congruent, and since they are congruent all of their other corresponding pieces must have the same measure, so the question mark side must have a length of a, so we have it.

Now that we know how what the slopes of parallel and perpendicular lines, we can also use this to find some equations of lines. We can find the equation of the line passing through a given point and parallel or perpendicular to a given line.

Example 1:

Find the equation of the line passing through the point (3,4) and parallel to the line y=4x+5.

Solution:

m1=4
m2=4
y-4=4(x-3)
y-4=4x-12
y=4x-8

Explanation:

For this kind of problem you need to combine some of the things that you have learned. You need to first find the slope of the line whose equation you want, and then use the point slope formula to find the equation. To find the slope of the line you are looking for, you need to first find the slope of the line it is supposed to be parallel or perpendicular to. Here since the equation is in the form y=mx+b, the slope of the original line will just be the coefficient on x, in this case 4.  Since we are looking for a line that is parallel to this line, its slope will also be 4. Now we have the slope and a point (3,4), so we can use the slope-point formula to find the equation of the line.

Example 2:

Find the equation of the line passing through the point (2,-1) and perpendicular to the line y=(3/4)x-7.

Solution:

m1=3/4
m2=-4/3
y-2=-4/3(x+1)
y-2=(-4/3)x-4/3
y=(-4/3)x+2/3

Explanation:

Just like in the last one, to find the slope of the original line, we just look for the coefficient on x, so we get 3/4, but this time the line we want is to be perpendicular, so to get its slope we need to find the negative reciprocal of 3/4, which is -4/3. Then we have everything we need to find the equation of the new line, since we know its slope and a point that it passes through, (2,-1), so we just plug these into the slope-point formula and simplify to get the equation.

Example 3:

Find the equation of the line passing through the point (4,-3) and parallel to the line x+2y=5.

Solution:

2y=-x+5
y=(-1/2)x+5/2
m1=-1/2
m2=-1/2
y+3=(-1/2)(x-4)
y+3=(-1/2)x+2
y=(-1/2)x-1

Explanation:

This one is a little bit harder, because the equation hasn't been given in y=mx+b form, so we have to first get it into that form in order to find its slope. The way to do this is to solve for y in terms of x. After that again the slope is just the coefficient on x, -1/2. Since we were asked to find a line which is parallel to this, just like in Example 1, the slope of our new line will be -1/2, and we use this combined with the given point (4,-3) in the slope-point formula to get the equation.

Example 4:

Find the equation of the line passing through the point (-2,-3) and perpendicular to the line 3x+y=6.

Solution:

y=-3x+6
m1=-3
m2=1/3
y+3=(1/3)(x+2)
y+3=(1/3)x+2/3
y=(1/3)x-7/3

Explanation:

This one is similar to the last one in that we have to first solve to y in terms of x in order to find the slope of the original equation, but this time we want the perpendicular line, so after finding the slope of the original line -3, we have to find its negative reciprocal to get the slope of the new line. The negative reciprocal of -3 is 1/3, so that is the slope of our new line. Then again we use the slope-point formula and simplify to get the equation of our line.

Essential Formulas to Know

m=(y2-y1)/(x2-x1)
Slope-intercept:  y=mx+b
Slope-point:  y-y1=m(x-x1)
Parallel:  m1=m2
Perpendicular:  m1=-1/m2
Shelley's Math Articles