Finding the Equation of a Line

Learning goals

  • Write point-slope form from a point and a slope
  • Find the slope from two points, checking first whether they're vertical
  • Convert to standard form with integer coefficients
  • Express a horizontal line as y=cy = c and a vertical as x=cx = c
  • Check an equation by substituting points that must lie on the line

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, with one exception to watch for: if the two points share an xx-coordinate, they sit on a vertical line, and a vertical line has no slope to compute (you saw why in the previous lesson). Otherwise, 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, or the vertical-line case below, 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

Start with the picture below. The line passes through (1,2)(1, 2) with slope 22. Moving from (1,2)(1, 2) to any other point (x,y)(x, y) on the line changes xx by x−1x - 1 and changes yy by y−2y - 2, and a slope of 22 means the vertical change is always twice the horizontal change:

y−2=2(x−1).y - 2 = 2(x - 1).
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).

That pattern works for any point and any slope, not only this one. 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 describe every point on the line 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 y−y1y - y_1 over the run x−x1x - x_1. Since every pair of points on the line reports the same slope mm, this ratio equals mm:

y−y1x−x1=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 x−x1x - x_1 to clear it:

y−y1=m(x−x1).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 also works in reverse: any pair (x,y)(x, y) that satisfies the equation lies on the line. When x≠x1x \neq x_1, dividing back by x−x1x - x_1 restores the slope condition, so that point is on the line too. When x=x1x = x_1, the equation forces y=y1y = y_1 on its own, since the right side becomes m(x1−x1)=0m(x_1 - x_1) = 0: the only pair with x=x1x = x_1 that satisfies the equation is the fixed point (x1,y1)(x_1, y_1) itself. So the single equation y−y1=m(x−x1)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: y−y1=m(x−x1)y - y_1 = m(x - x_1) is already a complete, correct equation of the line.

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 y−y1=m(x−x1)y - y_1 = m(x - x_1):

y−2=2(x−1).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:

y−2=2x−2,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, x−x1x - x_1 becomes x−(−4)=x+4x - (-4) = x + 4:

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

The equation y−5=−34(x+4)y - 5 = -\tfrac{3}{4}(x + 4) is complete. The most common slip here is to write x−4x - 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, first check whether they share an xx-coordinate. If they do, skip straight to the vertical-line case in the next section: the equation is x=cx = c, no slope needed. Otherwise, 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=3−12−(−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):

y−3=12(x−2).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:

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

The two equations look different, but check them against each other’s point and you will see they agree. Substitute (2,3)(2, 3) into the second equation:

3−1=12(2+2),2=2.3 - 1 = \tfrac{1}{2}(2 + 2), \qquad 2 = 2.

It holds, so both equations pass through both points. A line is fixed by two points, and no other line passes through both (−2,1)(-2, 1) and (2,3)(2, 3), so these two equations, written from different starting points, describe the very same line. 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 zero or positive, and the three numbers share no common factor other than 11. 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 integers.

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:

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

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

3(y−1)=−2(x−4).3(y - 1) = -2(x - 4).

Distribute on both sides:

3y−3=−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.

Check your understanding

Which equation is the standard form of the line through (2,5)(2, 5) with slope −12-\tfrac{1}{2}?

Answer choices

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 y−y1=0(x−x1)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(x−3),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, but what a substitution actually proves depends on what you started from.

For a two-point problem, substitute both points. The point you built the equation from always checks out, whatever slope you used, so the other point does the real work: with two different xx-coordinates, only the correct slope can make the equation true at both points.

For a point-and-slope problem, substituting the one given point is not enough by itself. Point-slope form is built so that the given point always satisfies it, whatever slope you used, so that substitution alone cannot catch a wrong slope. Use the slope to find a second point on the line, and check that one too.

Take the standard-form answer 2x+3y=112x + 3y = 11 from earlier, built from the point (4,1)(4, 1) and slope −23-\tfrac{2}{3}. Substituting the point confirms the location:

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

That matches, so (4,1)(4, 1) is on the line. To confirm the slope too, step one run of 33 and rise of −2-2 from (4,1)(4, 1) to the point (7,−1)(7, -1), and check it as well:

2(7)+3(−1)=14−3=11.2(7) + 3(-1) = 14 - 3 = 11.

Both points check out, so the location and the slope are both correct.

Common mistakes

Practice

Multiple Choice Questions (MCQ)

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

Core practice

Practice problems at the level of the course, to be worked out on paper. Hints one at a time, then the answer or the full worked solution, with your progress kept in this browser.

Core practice Work it out on paper 10 problems 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 with aa and bb not both zero, draws a straight line, and no other kind of curve comes from a degree-one equation. Degree two gives another family, one that includes 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.