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

One point is not enough: many lines pass through it in different directions. A slope alone is not enough either: many lines tilt the same way in different positions. Together, a point and a slope fix one line. The point fixes its location and the slope fixes its direction.

Try both choices in the figure. Keep the crossing at 33 and change the rise from −6-6 to 66. The lines turn through the same point (0,3)(0,3). Next set rise 22 and run 33, then change the crossing from −6-6 to 66. The tilt stays fixed while the line moves up or down. Fix both controls and you have one line. This widget uses a point on the vertical axis; point-slope form can use any point.

Fix a line by choosing its point and its slope

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 different points also fix a line. If their xx-coordinates differ, calculate the slope and use either point. If they share an xx-coordinate, the line is vertical and needs a different rule, x=cx=c.

As in Graphing Linear Equations, our equation must describe exactly the points of the required line: every point on it must satisfy the equation, and every solution must lie on it.

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).

To turn this pattern into a general rule, start with the slope formula and clear its denominator. We must also check the starting point, where that denominator is zero.

Deriving point-slope form from the slope formula#

Try a line through (2,−1)(2,-1) with slope 33. From that point to another point (x,y)(x,y) on the line, the run is x−2x-2 and the rise is y+1y+1. Since the line is nonvertical, an other point has x≠2x\ne2, so

y+1x−2=3,y+1=3(x−2).\frac{y+1}{x-2}=3,\qquad y+1=3(x-2).

The cleared equation also includes the starting point: at (2,−1)(2,-1) both sides are 00. For a numerical check away from it, a run of 11 and rise of 33 reaches (3,2)(3,2), where both sides are 33.

You can also start with a solution of the equation. For (4,5)(4,5), both sides of y+1=3(x−2)y+1=3(x-2) are 66. Its slope from (2,−1)(2,-1) is (5+1)/(4−2)=6/2=3(5+1)/(4-2)=6/2=3, so it lies on the required line.

Now use a known point (x1,y1)(x_1,y_1) and any slope mm. At every other point (x,y)(x,y) of the nonvertical line, x≠x1x\ne x_1, so the slope formula gives

y−y1x−x1=m.\frac{y-y_1}{x-x_1}=m.

Multiply by the nonzero run to get point-slope form:

y−y1=m(x−x1).y-y_1=m(x-x_1).

The starting point satisfies this equation too, since both sides are 00 there.

To check the reverse direction, take any solution of the cleared equation. If x≠x1x\ne x_1, divide by x−x1x-x_1: its slope from the known point is mm, so it lies on the required line. If x=x1x=x_1, the equation forces y=y1y=y_1, giving the known point itself. Thus the equation describes exactly the line.

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. 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

With two different points, first compare their xx-coordinates. If they agree, the line is vertical: write x=cx=c using that shared coordinate. Otherwise calculate the slope, then put it and either point into point-slope form. Choosing a different starting point changes how the equation looks, not the line.

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 different 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 same line. You can start from either point.

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.

For the rational slopes and coordinates used here, we write AA, BB, and CC as integers, with AA zero or positive and no common factor greater than 11. At least one of AA and BB must be nonzero: otherwise the equation would describe either no points or the whole plane.

This form puts both variable terms on the left. It can describe vertical lines as well as lines with a slope. Grouping like terms also helps you compare two equations or combine them by elimination, as in Systems of Equations. Other texts may use a different sign or coefficient convention.

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

A horizontal line has slope 00. Through (x1,y1)(x_1,y_1), point-slope form gives y−y1=0(x−x1)y-y_1=0(x-x_1), hence y=y1y=y_1. This is the form y=cy=c from graphing lines, with c=y1c=y_1 the height every point shares.

A vertical line has undefined slope, so there is no mm to put into point-slope form. Write x=cx=c directly, using the shared xx-coordinate of its points. For example, (5,−2)(5,-2) and (5,4)(5,4) share x=5x=5, so the line through them is x=5x=5.

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

For a two-point problem, substitute both given points. For a point-and-slope problem, use the slope to find a second point and check that too. The starting point satisfies point-slope form whatever slope you put in, so checking it on its own will not show a wrong slope.

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)

How could mathematicians organize all the different curves they studied? In his 1748 book Introduction to the Analysis of the Infinite, Leonhard Euler devoted the second volume to geometry described by equations. He began with general ideas about curves before treating familiar families one by one.

One organizing tool was the equation’s degree. A first-degree equation, such as 2x+3y=62x+3y=6, describes a straight line. Second-degree equations include circles and other curved shapes; still higher degrees bring further families. Degree counts the highest total power in a term, so even a mixed term such as xyxy counts as degree two.

Euler was building on earlier work, not inventing all these families. His book gathered them into a systematic account, treating straight lines before chapters on second-, third- and fourth-order curves. Readers could move from the simplest equations to increasingly complicated shapes within one book. (Euler Archive’s book record, English translation and chapter guide.)

Your progress

See all your progress →