Equation of a line through two points

Find the gradient, then use y − y₁ = m(x − x₁).

Key formulas

m = (y₂−y₁)/(x₂−x₁)
y − y₁ = m(x − x₁)

Steps

Compute m. Pick either point as (x₁,y₁). Expand only if the question wants general form ax+by+c=0.

Example

Through (1,2) and (3,8): m=3. Equation y−2=3(x−1) → y=3x−1.

Vertical line

If x₂=x₁, gradient is undefined. The equation is simply x = that constant.

Worked example

Worked example

Problem. Find the equation of the line through (1, 2) and (3, 8).

Solution. m = (8−2)/(3−1) = 3. Using (1,2): y − 2 = 3(x − 1) → y = 3x − 1.

Verify

Both given points must satisfy the finished equation.

Review quiz

Line through (0,4) and (2,0) is:

Practice questions

  1. Line through (0,4) and (2,0). Find its equation.
  2. Points (5,1) and (5,−3). Write the equation.

Study notes

Point-slope vs two-point form?

They are equivalent; two-point form hides m in a fraction.

More in Coordinates & Vectors