This site is a work in progress. New lessons are added regularly. Contact us

Finding the Equation of a Line

Learning goals

  • Write point-slope form from a point and a slope
  • Find the slope first when given two points
  • Convert to standard form with integer coefficients
  • Express a horizontal line as y=cy = c and a vertical as x=cx = c
  • Check by substituting the given points back in

A point and a direction fix a line

Think about what it takes to nail down a single straight line. One point is not enough: infinitely many lines pass through any given point, fanning out in every direction like the spokes of a wheel. A direction alone is not enough either: all the lines with a given slope tilt the same way, a whole family of them sliding across the plane. But pin both at once, one point the line must pass through and one slope it must have, and exactly one line survives. It has to go through that point, and from there only one tilt is allowed, so there is nothing left to choose.

Both halves of that argument are things you can do to the figure below. The figure sets a line’s slope and its crossing point separately, so either one can be held while the other moves.

Fix the crossing at 33 and leave it alone while you walk the rise from 6-6 up to 66. Every line you produce passes through that same point on the vertical axis. The lines fan out through that point exactly as described: one point does not fix a line. Now set the rise back to 22 over a run of 33 and walk the crossing instead, from 6-6 up to 66. This time the tilt never changes and the whole family slides up the plane, each line parallel to the last: a slope does not fix a line either. Only when you stop moving both does a single line survive. One caveat, since the figure is narrower than the lesson: its point is always the crossing point on the vertical axis. The form in the next section, by contrast, accepts any point at all.

Line explorer

y = (2/3)x + 3. Rise 2 over run 3 is a slope of 2/3, so from any point on the line, 3 to the right and 2 up lands back on it. And it crosses the vertical axis at 3. A coordinate plane with a straight line drawn across it. Use the controls below the figure to change the rise, the run, where the line crosses the vertical axis. -6 -4 -2 2 4 6 -6 -4 -2 2 4 6
Rise Run Crosses at

y = (2/3)x + 3. Rise 2 over run 3 is a slope of 2/3, so from any point on the line, 3 to the right and 2 up lands back on it. And it crosses the vertical axis at 3.

A line on a coordinate plane whose tilt and whose crossing point on the vertical axis are set by separate controls, so one of the two can be held fixed while the other is moved through its whole range.

Two points pin a line for the same reason. Two points hand you the slope through the previous lesson’s formula, and once you have a slope and a point you are back to the first case. So every “find the equation” task in this lesson is really the point-and-slope task, sometimes with a quick slope calculation in front.

What does “the equation of the line” mean here? From the graphing lesson, the equation of a line is the rule its points obey. A pair (x,y)(x, y) satisfies that equation exactly when the point sits on the line. The job now is to turn “passes through this point with this slope” into such a rule.

Point-slope form

Suppose you know one point on a line and the line’s slope. Call the known point (x1,y1)(x_1, y_1) and the slope mm. To capture every other point at once, give it a name: let (x,y)(x, y) stand for an arbitrary point on the line. The slope between the known point and this general point is something you can write down with the slope formula. Because a line has only one slope, that expression has to equal the slope mm. Setting it equal to mm and clearing the fraction produces the equation.

Deriving point-slope form from the slope formula#

Let the line have slope mm and pass through the fixed point (x1,y1)(x_1, y_1). Take any other point (x,y)(x, y) on the line. Using the two points (x1,y1)(x_1, y_1) and (x,y)(x, y), the slope formula gives the slope as the rise yy1y - y_1 over the run xx1x - x_1. Since every pair of points on the line reports the same slope mm, this ratio equals mm:

yy1xx1=m.\frac{y - y_1}{x - x_1} = m.

This already ties xx and yy together, but the fraction is awkward, so multiply both sides by the run xx1x - x_1 to clear it:

yy1=m(xx1).y - y_1 = m(x - x_1).

This is point-slope form. Every point (x,y)(x, y) on the line satisfies it, because that is exactly how it was built. It passes the reverse test too: any pair (x,y)(x, y) that satisfies it lies on the line, since dividing back by xx1x - x_1 restores the slope condition. One case deserves its own check, the fixed point itself. Substituting x=x1x = x_1 and y=y1y = y_1 gives yy1=0y - y_1 = 0 on the left and m(x1x1)=0m(x_1 - x_1) = 0 on the right. That gives 0=00 = 0, so (x1,y1)(x_1, y_1) is included, even though the original fraction had a zero denominator there. So the single equation yy1=m(xx1)y - y_1 = m(x - x_1) is satisfied by exactly the points of the line: it is the line’s equation.

The name tells you how to read it. The two numbers x1x_1 and y1y_1 come from the point, and mm is the slope. To use it, substitute your point and your slope, and stop. You do not have to simplify: yy1=m(xx1)y - y_1 = m(x - x_1) is already a complete, correct equation of the line.

The line through (1, 2) with slope 2A line drawn through the marked point (1, 2), with a slope triangle showing a run of 1 and a rise of 2.xy1220(1, 2)run = 1rise = 2m = 2
A point and a slope fix one line. The line must pass through (1, 2), and from there the slope 2 (a run of 1, a rise of 2) locks its direction, so no other line qualifies. Its equation in point-slope form is y - 2 = 2(x - 1).

Worked example 1 Write the equation of the line through (1,2)(1, 2) with slope 22

Point-slope form needs a point and a slope, and you have both: (x1,y1)=(1,2)(x_1, y_1) = (1, 2) and m=2m = 2. Substitute them into yy1=m(xx1)y - y_1 = m(x - x_1):

y2=2(x1).y - 2 = 2(x - 1).

That is the equation, and you may leave it exactly like this. If you want the line’s rule in the shortest form, distribute and simplify:

y2=2x2,y=2x.y - 2 = 2x - 2, \qquad y = 2x.

Both forms describe the same line. As a check, the point (1,2)(1, 2) satisfies y=2xy = 2x, since 2=2(1)2 = 2(1).

Worked example 2 Write the equation of the line through (4,5)(-4, 5) with slope 34-\tfrac{3}{4}

Substitute into point-slope form again, this time watching the signs. Here (x1,y1)=(4,5)(x_1, y_1) = (-4, 5) and m=34m = -\tfrac{3}{4}. Because x1=4x_1 = -4 is negative, xx1x - x_1 becomes x(4)=x+4x - (-4) = x + 4:

y5=34(x(4))=34(x+4).y - 5 = -\tfrac{3}{4}\left(x - (-4)\right) = -\tfrac{3}{4}(x + 4).

The equation y5=34(x+4)y - 5 = -\tfrac{3}{4}(x + 4) is complete. The most common slip here is to write x4x - 4 instead of x+4x + 4; subtracting a negative coordinate turns it into addition.

Check your understanding

Which equation is the point-slope form of the line through (3,2)(3, -2) with slope 55?

Answer choices

Finding a line through two points

When you are handed two points instead of a point and a slope, find the slope first, then feed that slope and either point into point-slope form. The phrase “either point” is worth pausing on. Both points sit on the same line, so both must produce the same line, and they do. Choosing one point over the other changes only how the equation looks before you simplify, never which line it describes.

The line through (-2, 1) and (2, 3)A line drawn through the two marked points (-2, 1) and (2, 3), with a slope triangle showing a run of 4 and a rise of 2.xy-22130(-2, 1)(2, 3)run = 4rise = 2m = 1/2
One line runs through both (-2, 1) and (2, 3). Its slope is the rise 2 over the run 4, which is 1/2, and point-slope form with either point gives the same line: y - 3 = (1/2)(x - 2) using the right point, or y - 1 = (1/2)(x + 2) using the left one.

Worked example 3 Find the equation of the line through (2,1)(-2, 1) and (2,3)(2, 3)

Step one is the slope, from the previous lesson’s formula. Take (x1,y1)=(2,1)(x_1, y_1) = (-2, 1) and (x2,y2)=(2,3)(x_2, y_2) = (2, 3):

m=312(2)=24=12.m = \frac{3 - 1}{2 - (-2)} = \frac{2}{4} = \tfrac{1}{2}.

Step two is point-slope form with this slope and one of the points. Using (2,3)(2, 3):

y3=12(x2).y - 3 = \tfrac{1}{2}(x - 2).

That is a complete equation of the line. To see that the other point gives the same line, use (2,1)(-2, 1) instead:

y1=12(x+2).y - 1 = \tfrac{1}{2}(x + 2).

The two look different, but they are the same line in disguise. Clear each fraction and tidy up, and both collapse to a single equation. From the first,

2(y3)=x2,2y6=x2,x2y=4,2(y - 3) = x - 2, \qquad 2y - 6 = x - 2, \qquad x - 2y = -4,

and from the second,

2(y1)=x+2,2y2=x+2,x2y=4,2(y - 1) = x + 2, \qquad 2y - 2 = x + 2, \qquad x - 2y = -4,

the very same equation. So it truly does not matter which point you start from.

Check your understanding

Which equation represents the line through (1,4)(1, 4) and (3,10)(3, 10)?

Answer choices

Standard form

Point-slope form is the fastest to write, but answers are often requested in standard form, which lines the variables up on one side:

Ax+By=C.Ax + By = C.

Here AA, BB, and CC are integers, and AA and BB are not both zero. By convention AA is made zero or positive (and, when possible, the three share no common factor). Standard form hides the slope and the point from view, but it treats xx and yy evenly. Standard form is also the natural way to write a vertical line, and it makes lines easy to compare and combine later.

To convert, start from point-slope form, distribute the slope, and move the xx-term and the constants to the sides that match Ax+By=CAx + By = C. When the slope is a fraction, multiply through to clear the denominator so the coefficients come out as whole numbers.

Worked example 4 Write the line through (4,1)(4, 1) with slope 23-\tfrac{2}{3} in standard form

Begin with point-slope form:

y1=23(x4).y - 1 = -\tfrac{2}{3}(x - 4).

The slope has denominator 33, so multiply both sides by 33 to clear it:

3(y1)=2(x4).3(y - 1) = -2(x - 4).

Distribute on both sides:

3y3=2x+8.3y - 3 = -2x + 8.

Now collect xx and yy on the left and the constants on the right by adding 2x2x to both sides and adding 33 to both sides:

2x+3y=11.2x + 3y = 11.

This is standard form with A=2A = 2, B=3B = 3, and C=11C = 11, and AA is positive. As a check, substitute the original point (4,1)(4, 1): 2(4)+3(1)=8+3=112(4) + 3(1) = 8 + 3 = 11, matching CC.

Horizontal and vertical lines

Two kinds of lines need a moment of care, because one of them breaks point-slope form.

A horizontal line has slope 00. Point-slope form still works: through a point (x1,y1)(x_1, y_1) with m=0m = 0 it gives yy1=0(xx1)y - y_1 = 0(x - x_1), and the right side is just 00, so the equation collapses to y=y1y = y_1. That matches what you already know, that a horizontal line has the constant equation y=cy = c, where cc is the shared height of all its points.

A vertical line is the exception. Its slope is undefined, so there is no mm to substitute and point-slope form cannot be used at all. You do not need it. Every point on a vertical line has the same xx-coordinate, so the equation simply states that: x=cx = c, where cc is that shared xx-value. Reach for this directly whenever the points share an xx-coordinate, or the line is described as vertical.

Worked example 5 Equations of a horizontal and a vertical line through (3,2)(3, -2)

For the horizontal line through (3,2)(3, -2), the slope is 00. Point-slope form gives

y(2)=0(x3),y+2=0,y=2.y - (-2) = 0(x - 3), \qquad y + 2 = 0, \qquad y = -2.

Every point on it has height 2-2, so the equation is y=2y = -2.

For the vertical line through (3,2)(3, -2), the slope is undefined, so point-slope form does not apply. Instead use the fact that every point shares the xx-coordinate 33:

x=3.x = 3.

The two lines cross at the point (3,2)(3, -2) they were built from, the horizontal one running flat across it and the vertical one standing straight up through it.

Check your understanding

What is the equation of the vertical line through (5,2)(5, -2)?

Answer choices

Checking your equation

Every equation you write can be checked, and checking takes only a substitution. The point, or points, you started from must satisfy the finished equation, so put the coordinates in and confirm the two sides agree. This catches sign slips and arithmetic errors before they cost you anything.

Take the standard-form answer 2x+3y=112x + 3y = 11 from earlier, built to pass through (4,1)(4, 1). Substitute:

2(4)+3(1)=8+3=11.2(4) + 3(1) = 8 + 3 = 11.

The left side equals 1111, matching the right, so (4,1)(4, 1) is on the line and the equation checks out. For a two-point problem, test both given points, since a wrong slope can still accidentally satisfy one of them. A single substitution is cheap insurance on every equation you find.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

Progressively harder sets of questions. Each opens on its own page.

Free Response Questions (FRQ)

Longer questions in parts, to be worked out on paper. Progressive hints, the answer on its own so you can check yourself and try again, then the full worked solution, plus a rubric to mark your own work against.

Free response Work it out on paper 5 questions Start →
More practice (optional)

Extra sets, as hard as the Challenge set. Each one opens on its own page.

More resources (optional)

Other explanations of this lesson, if you want a second take.

A bit of history (Optional)

By the middle of the 1600s a curve could be written as an equation. The grid had made that possible. But the line, the circle and the parabola were still three separate subjects, each with its own drawings, its own proofs and its own experts. Nothing said how the whole crowd of curves fitted together.

Leonhard Euler, a Swiss mathematician working in the 1700s, found the order in it. In a book of 1748 he sorted curves by a single number, the highest power that shows up in the equation. That number is the degree. Every equation of degree one, meaning every equation you can rearrange into ax+by+c=0ax + by + c = 0, draws a straight line, and nothing else does. Degree two gives the next family: circles, ellipses, parabolas and hyperbolas. Degree three gives the family after that.

One idea turned a crowd of jumbled curves into an ordered shelf. It also settles something about this lesson. Point-slope form, the two-point method and standard form look like three separate rules to memorize. They are not separate at all. Each of them rearranges into ax+by+c=0ax + by + c = 0, so each of them has degree one, so each of them has to draw a line. The named forms are a convenience for teaching. The degree is the fact underneath them.

Your line sits on the first shelf, the simplest curve there is. That is why a first course in algebra spends so long getting it exactly right.