Equation of a Line Through Two Points Explained with Worked Examples

The line through and has equation .

Write 2x or 2*x to multiply, ^ for powers, and ; between simultaneous equations. You can also type factor, expand, derivative of, integrate … from a to b, limit … as x->0 or 15% of 80.

Try an example

Before you start

This page is easier if you are comfortable with:

What Equation of a line through two points means

Any point on the line must give the same gradient when joined to as the line itself has, which gives the equation above.

Alternatively, find the gradient first and use .

The two-point form works even for vertical lines if you cross-multiply. The gradient comes from the gradient between two points, after which the line is written with a point and gradient m, and the answer can be rearranged into the general form.

This page is part of Coordinate geometry in Geometry and measures. Topics that work alongside it: Gradient between two points, Line through a point with gradient m, Equation of a straight line, Circle: general form, Equation of a circle, Sector area and Distance from a point to a line (2D, coordinates).

What is it used for?

To find the line through two points, find the gradient between them and then use y − y₁ = m(x − x₁).

How to use equation of a line through two points

  1. Substitute the two points into the formula.
  2. Cross-multiply to remove fractions.
  3. Rearrange into or .
  4. Check by substituting both points.

Graph

The line through (1, 3) and (4, 9)(1, 3)(4, 9)-1012345-20246810The line through (1, 3) and (4, 9)xyy = 2x + 1Graph with x from -1 to 5 and y from -2 to 11. Shows the curve y = 2x + 1; point (1, 3) at (1, 3); point (4, 9) at (4, 9).

The gradient is (9 − 3) ÷ (4 − 1) = 2, and the line meets the y-axis at 1.

Worked examples

These examples are worked by hand, step by step, so you can compare your own working.

Example 1: find the equation

Find the equation of the line through and .

Worked example Answer checked
Answer
y=2xy=2x
  1. Find the gradient
  2. Use the point (1, 2)
  3. Rearrange
  4. Check (4, 8)

Example 2: another line

Find the equation of the line through and .

Worked example Answer checked
Answer
y=2x+3y=2x+3
  1. Find the gradient
  2. Use the intercept (0, 3)
  3. Check (2, 7)

Example 3: a negative gradient

Find the equation of the line through and .

Worked example
Answer
y=−2x+3y = -2x + 3
  1. Gradient
  2. Use y − y₁ = m(x − x₁)
  3. Simplify

Special cases

A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.

(1, 2) and (3, 8)

m = (8 − 2)/(3 − 1)

3.

y-intercept

2 − 3×1

−1: y = 3x − 1.

(0, 5) and (2, 1)

m

−2.

Check (3, 8) on y = 3x − 1

3×3 − 1

8.

Word problems

The line through (x₁, y₁) and (x₂, y₂) has gradient m = (y₂ − y₁)/(x₂ − x₁) and equation y − y₁ = m(x − x₁), equivalently (y − y₁)/(y₂ − y₁) = (x − x₁)/(x₂ − x₁).

Gradient

(1, 2), (3, 8).

  1. 6/2
  2. Check: ✓3

Intercept

c = y₁ − m x₁.

  1. 2 − 3
  2. Check: −1 ✓-1

Another line Higher

(0, 5), (2, 1): gradient.

  1. −4/2
  2. Check: ✓-2

Check Higher

y = 3x − 1 at x = 3.

  1. 9 − 1
  2. Check: 8 ✓8

Common mistakes

Gradient inverted

Δx/Δy ✗

Δy/Δx ✓

Rise over run.

Mixing points

y₂ with x₁ ✗

consistent order ✓

Same order.

c = y₂ + m x₂

sign ✗

c = y − m x ✓

Minus.

No check

unverified ✗

substitute the other point ✓

Verify.

Exam tips

  1. m = Δy/Δx.
  2. y − y₁ = m(x − x₁).
  3. Same order of points.
  4. Check both points.
  5. Vertical line: x = constant.

Practice questions

Try each one on paper, then open the answer. Use the solver above to see the full working.

1. Gradient (2, 3), (5, 12) Foundation

3

2. Gradient (−1, 4), (3, −4) Foundation

-2

3. c for m = 2 through (1, 5) Foundation

3

4. c for m = −3 through (2, 1) Higher

7

5. y at x = 4 on y = 2x + 3 Higher

11

6. Gradient (0, 0), (4, 6) Higher

1.5

Practice generator

Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.

Solve: …

Key terms

Gradient
Slope m.
Point–gradient form
y − y₁ = m(x − x₁).
Intercept
c.
Rise
Δy.
Run
Δx.
Vertical line
Undefined gradient.

Frequently asked questions

How do I find the line through two points?

Find m = Δy/Δx then use y − y₁ = m(x − x₁).

How do I find c?

Substitute a point.

How do I check?

Substitute the other point.

What if x₁ = x₂?

The line is vertical.

Which page covers parallel lines?

parallel lines have equal gradients.

Which page covers the general form?

general form.

More in Geometry and measures and the formula sheets.