GED Free

Writing the Equation of a Line Through Two Points

Find the slope from two points, then use it with either point to write the equation of the line.

Practice this skill 25 min Line from two points Leer en español
Key idea

What you'll learn

Two points are all you need to draw a straight line — and all you need to write its equation. The plan is always the same:

  1. Use the two points to find the slope.
  2. Use the slope and either point to find the equation (exactly like the previous lesson).

You will learn to:

  • compute slope with the formula m = \dfrac{y_2 - y_1}{x_2 - x_1}, including negatives and fractions;
  • write the line in point-slope and slope-intercept form;
  • read two points off a graph or a table;
  • handle horizontal and vertical lines;
  • turn two real-life data pairs (such as "4 miles costs $13; 10 miles costs $25") into an equation, and use it to predict.

Why it matters on the GED: Questions such as "Which equation represents the line that passes through (-2, 5) and (4, -7)?" are common, and so are graphs with two marked points. Word problems give two situations and ask for the rate, the starting value, or a prediction. Every one of these is the same two-step plan.

Words to know

  • Point / ordered pair — (x, y). In (x_1, y_1) and (x_2, y_2), the little numbers just mean "first point" and "second point."
  • Slope (m) — steepness: \dfrac{\text{rise}}{\text{run}} = \dfrac{\text{change in } y}{\text{change in } x}. Example: from (1, 2) to (3, 8) the slope is \tfrac{6}{2} = 3.
  • Rise — the vertical change, y_2 - y_1 (up is positive, down is negative).
  • Run — the horizontal change, x_2 - x_1 (right is positive).
  • Slope formula — m = \dfrac{y_2 - y_1}{x_2 - x_1}.
  • y-intercept (b) — where the line crosses the y-axis, the point (0, b).
  • Slope-intercept form — y = mx + b.
  • Point-slope form — y - y_1 = m(x - x_1).
  • Horizontal line — slope 0; equation y = c. Example: through (1, 4) and (6, 4): y = 4.
  • Vertical line — undefined slope; equation x = c. Example: through (3, 1) and (3, 9): x = 3.
  • Linear model — a line used to describe a real situation with a constant rate, such as cost per mile.

All Math words in the glossary

Step 1: Find the slope from two points

m = \frac{y_2 - y_1}{x_2 - x_1}

Rule 1: Subtract in the same order, top and bottom. If you start with the second point's y on top, start with the second point's x on the bottom. Either point can be "first" — you get the same slope.

Example: (2, 3) and (6, 11): m = \dfrac{11 - 3}{6 - 2} = \dfrac{8}{4} = 2.

Reverse order: \dfrac{3 - 11}{2 - 6} = \dfrac{-8}{-4} = 2 ✓ Same.

Rule 2: y on top, x on the bottom. Rise over run, never run over rise.

Rule 3: Subtracting a negative means adding.

Example: (-2, 5) and (4, -7): m = \dfrac{-7 - 5}{4 - (-2)} = \dfrac{-12}{6} = -2.

Coordinate plane with the points (-2, 5) and (4, -7) and the line y = -2x + 1 through them. A green slope triangle goes right 6 (run) and down 12 (rise -12) from (-2, 5) to (4, -7), so the slope is -12/6 = -2.−4−22−6−4−2460xyrun = 6rise = −12(−2, 5)(4, −7)y = −2x + 1

Rule 4: Simplify fractions; keep the sign in front. \dfrac{-4}{6} = -\dfrac{2}{3}; \dfrac{-9}{-6} = \dfrac{3}{2}.

Rule 5: Special cases.

PointsRise / RunSlopeEquation
(1, 4), (6, 4)\tfrac{0}{5}0 (horizontal)y = 4
(3, 1), (3, 9)\tfrac{8}{0}undefined (vertical)x = 3

You can never divide by zero, so a vertical line has no slope and cannot be written as y = mx + b.

Coordinate plane with two special lines. The horizontal blue line y = 4 passes through (1, 4) and (6, 4): rise 0, slope 0. The vertical red line x = 3 passes through (3, 1) and (3, 9): run 0, slope undefined.−11245678−112356789100xy(1, 4)(6, 4)(3, 1)(3, 9)y = 4, slope 0x = 3undefined

Sign check: a line that goes up from left to right has a positive slope; one that goes down has a negative slope. Look at the x-values from small to large and see whether y grows or shrinks.

Coordinate plane from -5 to 5 on both axes. A line passes through the points (-2, -3) and (1, 3). A dashed slope triangle shows run = 1 - (-2) = 3 and rise = 3 - (-3) = 6, so the slope is 6/3 = 2. The line crosses the y-axis at (0, 1), so its equation is y = 2x + 1.−5−4−3−2−112345−5−4−3−2−1123450xyrun = 1 − (−2) = 3rise = 3 − (−3) = 6(−2, −3)(1, 3)(0, 1)

Two points, (-2, -3) and (1, 3). Run = 1 - (-2) = 3, rise = 3 - (-3) = 6, so m = \tfrac{6}{3} = 2. The line crosses the y-axis at (0, 1): y = 2x + 1.

Step 2: Use the slope and one point to write the equation

Once you know m, pick either point — choose the one with smaller or friendlier numbers.

Point-slope form: put m and the point into y - y_1 = m(x - x_1).

Slope-intercept form: put m and the point into y = mx + b, then solve for b.

Example: (-2, 5) and (4, -7), where we found m = -2.

Using (-2, 5): 5 = -2(-2) + b = 4 + b, so b = 1.

Using (4, -7): -7 = -2(4) + b = -8 + b, so b = 1 ✓

Either way the line is y = -2x + 1. In point-slope form it could be written y - 5 = -2(x + 2) or y + 7 = -2(x - 4) — both are correct, and both simplify to y = -2x + 1.

Rule 6: Use the second point as your check. You used one point to find b; plug the other point in. If it works, the whole equation is right.

Shortcut when one point is on the y-axis: if a point has x = 0, such as (0, 4), then b = 4 immediately.

Two points in disguise: graphs, tables, and stories

The GED often hides the two points.

From a graph: pick two points where the line crosses grid corners exactly. Count the rise and run, or read off the coordinates and use the formula. If the line crosses the y-axis at a grid point, that is b.

From a table:

x (hours)258
y (dollars)70145220

Any two columns are two points. m = \dfrac{145 - 70}{5 - 2} = \dfrac{75}{3} = 25. Then 70 = 25(2) + b, so b = 20: y = 25x + 20. (Check the third column: 25(8) + 20 = 220 ✓)

Graph of the table: hours from 0 to 9 across and dollars from 0 to 250 up. The points (2, 70), (5, 145) and (8, 220) lie on the line y = 25x + 20, which starts at (0, 20). A green slope triangle from (2, 70) to (5, 145) shows 3 hours add 75 dollars: slope 75/3 = 25.0123456789050100150200250x (hours)y (dollars)3 hours+$75(2, 70)(5, 145)(8, 220)b = 20y = 25x + 20

From a story: each sentence like "a 4-mile ride costs $13" is a point (\text{input}, \text{output}) = (4, 13).

  • Input (the thing you choose or the time) is x.
  • Output (the cost, the amount, the height) is y.
  • The slope is the rate: change in output ÷ change in input, with units ("dollars per mile").
  • b is the starting value — the output when the input is 0.

Example: A ride of 4 miles costs $13; a ride of 10 miles costs $25. m = \dfrac{25 - 13}{10 - 4} = \dfrac{12}{6} = 2 dollars per mile. 13 = 2(4) + b, so b = 5: a $5 base fare. C = 2d + 5.

Work-backwards questions: "The points (1, 5), (4, 11) and (k, 21) are on the same line. Find k." Find the equation from the two complete points (y = 2x + 3), then put in the known coordinate: 21 = 2k + 3, so k = 9.

Formula

The formulas (all on the GED formula sheet)

m = \frac{y_2 - y_1}{x_2 - x_1} \qquad y - y_1 = m(x - x_1) \qquad y = mx + b
  • (x_1, y_1), (x_2, y_2) — the two given points
  • m — slope (rate of change); b — y-intercept (starting value)

The slope formula, point-slope form and slope-intercept form are all printed on the GED formula sheet. What you must remember yourself: keep the subtraction order the same on top and bottom, put y on top, and finish by checking the second point.

Worked example

Example 1 (easy): (1, 3) and (3, 11)

Problem: Write the equation of the line through (1, 3) and (3, 11) in slope-intercept form.

  1. Slope: m = \dfrac{11 - 3}{3 - 1} = \dfrac{8}{2} = 4.
  2. Use (1, 3) in y = 4x + b: 3 = 4(1) + b = 4 + b.
  3. Solve: b = 3 - 4 = -1.
  4. Equation: y = 4x - 1.
Coordinate plane with the points (1, 3) and (3, 11) and the line y = 4x - 1 through them. A green slope triangle goes right 2 and up 8 from (1, 3) to (3, 11): slope 8/2 = 4. The line crosses the y-axis at (0, -1).−2−1123451456789101112xyrun 2rise 8(1, 3)(3, 11)(0, −1)y = 4x − 1

Answer: y = 4x - 1

Check: Second point (3, 11): 4(3) - 1 = 12 - 1 = 11 ✓

Worked example

Example 2 (medium): negative coordinates

Problem: Find the equation of the line through (-4, 6) and (2, -3).

  1. Slope: m = \dfrac{-3 - 6}{2 - (-4)} = \dfrac{-9}{6} = -\dfrac{3}{2}.
  2. Use (-4, 6): 6 = -\tfrac{3}{2}(-4) + b.
  3. Multiply: -\tfrac{3}{2} \times (-4) = +6, so 6 = 6 + b and b = 0.
  4. Equation: y = -\tfrac{3}{2}x (the line goes through the origin).
Coordinate plane with the points (-4, 6) and (2, -3) and the line y = -(3/2)x through them and through the origin. A green slope triangle goes right 6 and down 9 from (-4, 6) to (2, -3): slope -9/6 = -3/2.−6−5−4−3−2−11345−5−2−123458xyrun 6rise −9(−4, 6)(2, −3)y = −3/2 x

Answer: y = -\tfrac{3}{2}x

Check: (2, -3): -\tfrac{3}{2}(2) = -3 ✓

Worked example

Example 3 (word problem): taxi fares

Problem: A taxi company charges a base fare plus a fixed amount per mile. A 4-mile ride costs $13 and a 10-mile ride costs $25. Write an equation for the cost C of a d-mile ride, and find the cost of a 7-mile ride.

  1. Points (d, C): (4, 13) and (10, 25).
  2. Slope (rate): m = \dfrac{25 - 13}{10 - 4} = \dfrac{12}{6} = 2 dollars per mile.
  3. Find b: 13 = 2(4) + b = 8 + b, so b = 5. The base fare is $5.
  4. Equation: C = 2d + 5.
  5. 7 miles: C = 2(7) + 5 = 19.
Graph of taxi fares C = 2d + 5, miles from 0 to 12 across and dollars from 0 to 30 up. The line starts at the 5 dollar base fare (0, 5) and passes through (4, 13) and (10, 25). A green slope triangle shows 6 more miles add 12 dollars: 2 dollars per mile. The predicted point (7, 19) is marked in red.02468101201015202530Miles, dCost, C (dollars)6 miles+$12base fare $5(4, 13)(10, 25)(7, 19)C = 2d + 5

Answer: C = 2d + 5; a 7-mile ride costs $19.

Check: (10, 25): 2(10) + 5 = 25 ✓

Worked example

Example 4 (word problem, decreasing): draining a pool

Problem: A pool is drained at a steady rate. After 2 hours it holds 9,600 gallons; after 6 hours it holds 6,000 gallons. Write an equation for the volume V after t hours. How long does it take to empty the pool completely?

  1. Points (t, V): (2, 9600) and (6, 6000).
  2. Slope: m = \dfrac{6000 - 9600}{6 - 2} = \dfrac{-3600}{4} = -900 gallons per hour.
  3. Find b: 9600 = -900(2) + b = -1800 + b, so b = 11{,}400 gallons at the start.
  4. Equation: V = -900t + 11{,}400.
  5. Empty: 0 = -900t + 11{,}400 \Rightarrow t = \dfrac{11{,}400}{900} = 12\tfrac{2}{3} hours.
Graph of the pool volume V = -900t + 11,400, hours from 0 to 14 across and gallons from 0 to 12,000 up. The line starts at (0, 11,400), passes through (2, 9,600) and (6, 6,000), and reaches 0 at t = 12 2/3 hours. A green slope triangle shows 4 hours remove 3,600 gallons: -900 gallons per hour.024681012140200040006000800010,00012,000Hours, tVolume, V (gallons)4 hours−3,600 gal(0, 11,400)(2, 9,600)(6, 6,000)empty at 12⅔ hV = −900t + 11,400

Answer: V = -900t + 11{,}400; empty after about 12 hours 40 minutes (\tfrac{2}{3} of 60 min = 40 min).

Check: (6, 6000): -900(6) + 11{,}400 = -5{,}400 + 11{,}400 = 6{,}000 ✓

Worked example

Example 5 (GED-hard, work backwards): three points on one line

Problem: The points (-2, 7), (4, -5) and (k, -11) all lie on the same line. Find k.

  1. Slope from the two complete points: m = \dfrac{-5 - 7}{4 - (-2)} = \dfrac{-12}{6} = -2.
  2. Find b: 7 = -2(-2) + b = 4 + b, so b = 3. Line: y = -2x + 3.
  3. Put in y = -11: -11 = -2k + 3.
  4. Subtract 3: -14 = -2k. Divide by -2: k = 7.
Coordinate plane with the line y = -2x + 3 through (-2, 7), (4, -5) and (7, -11). One green slope triangle goes right 6 and down 12 from (-2, 7) to (4, -5); a second goes right 3 and down 6 from (4, -5) to (7, -11). Both give slope -2, so the three points are on one line and k = 7.−4−268−10−6−4−22680xyright 6down 12right 3down 6(−2, 7)(4, −5)(k, −11)= (7, −11)y = −2x + 3

Answer: k = 7

Check: Slope from (4, -5) to (7, -11): \dfrac{-11 - (-5)}{7 - 4} = \dfrac{-6}{3} = -2 ✓ Same slope, so all three points are on one line.

Calculator tip

Calculator tip: TI-30XS MultiView

  • Slope in one entry: type the whole fraction with parentheses: ( (−) 7 − 5 ) ÷ ( 4 − (−) 2 ) enter → −2. The parentheses are essential — without them the calculator divides only the last number.
  • Use the gray (−) key for negative numbers and the − key for subtraction.
  • If the slope comes out as a fraction such as -\tfrac{3}{2} and the answer choices show decimals (or the other way round), press toggle to switch between fraction and decimal.
  • Finding b: compute y_1 - m \cdot x_1, e.g. 9600 − ( (−) 900 ) ( 2 ) enter → 11400.
  • Large numbers in word problems (like 9,600 gallons) are exactly where the calculator saves time and errors.

When NOT to use it: for small whole-number points like (1, 3) and (3, 11), mental arithmetic is faster. Counting rise and run on a graph needs no calculator at all.

Common mistake

Common mistakes

  • Run over rise. Wrong: \dfrac{x_2 - x_1}{y_2 - y_1}. Through (0, 1) and (2, 7) that gives \tfrac{1}{3}. Right: \dfrac{7 - 1}{2 - 0} = 3 — y always goes on top.
  • Mixed subtraction order. Wrong: \dfrac{y_2 - y_1}{x_1 - x_2} flips the sign of the slope. Start with the same point on top and bottom.
  • Subtracting a negative. 4 - (-2) = 6, not 2.
  • Using a point's y-value as b. Through (-2, 5) and (4, -7), b is 1, not 5. Only a point with x = 0 shows b directly.
  • Word problems: forgetting to divide by the change in x. A car worth $21,400 after 2 years and $15,250 after 5 years loses \tfrac{6{,}150}{3} = 2{,}050 dollars per year — not $6,150 per year.
  • Assuming the line goes through the origin. "40 miles cost $59.80" does not mean the rate is 59.80 \div 40 unless there is no base fee. Use two points to find the true rate.
Test strategy

GED test strategy

  • Find the slope, then eliminate. Compute m and cross out every choice with a different slope — including the ones with the right number but the wrong sign.
  • Plug both points into the survivors. The correct equation must work for both points. This also catches answers that work for only one.
  • Use the graph's direction. Line going down to the right? The slope must be negative. Steeper than a 45° line (same scale on both axes)? The slope's size is bigger than 1.
  • In word problems, label the points with units — (\text{miles}, \text{dollars}) — so input and output never get swapped.
  • Estimate to catch silly answers. A starting value should fit the story (a pool can't start with fewer gallons than it has later if it's draining).
  • Time: about 1½–2 minutes each. Write the slope calculation down; it is the step most errors come from.

Check yourself

Line from two points

A line passes through the points (0, 1) and (2, 7).

Which equation represents the line?

Answer choices
Hint

Find the slope with \dfrac{y_2 - y_1}{x_2 - x_1}. One of the points is on the y-axis — what does that tell you?

Check yourself

Line from two pointsFill in

What is the slope of the line that passes through (1, 4) and (5, 12)?

m =

Type your answer in the box. Fractions like 3/4 are fine.

Hint

Slope = \dfrac{\text{change in } y}{\text{change in } x}. Subtract in the same order on top and bottom.

Summary

  • Two-step plan: slope first, m = \dfrac{y_2 - y_1}{x_2 - x_1}, then use one point to find b (or write point-slope form).
  • Keep the subtraction order the same on top and bottom; y goes on top; subtracting a negative means adding.
  • Same y-values → horizontal line y = c (slope 0). Same x-values → vertical line x = c (undefined slope).
  • In word problems, each "input → output" situation is a point; the slope is the rate; b is the starting value.
  • Always check with the other point. All three formulas are on the GED formula sheet.
Practice this skill →