Equation of a Straight Line

On this page

How to find the equation of a straight line from a graph, a gradient and a point, or two points, and use it to find where two lines cross or a missing coordinate.

Key facts

In y=mx+c, m is the gradient and the line crosses the y-axis at (0,c)

Gradient = change in y ÷ change in x =-2\div4=-\frac12. A line going down from left to right has a negative gradient.

A point is on a line when its coordinates fit the equation: 5=3\times2-1

Where two lines cross, the point fits both equations

  • Rearrange to y=\dots before reading m and c: 2x+y=7 is y=-2x+7, so its gradient is −2.
  • A horizontal line is y=b. A vertical line is x=a.

Worked example 1: Reading the gradient and intercept from a graph

The line L is shown on the grid.

Find an equation for L.

  1. L crosses the y-axis at (0,-1), so c=-1
  2. Use two points where L crosses grid lines exactly: from (0,-1) to (4,2) is 4 across and 3 up. Gradient =\frac34
  3. y=\frac34x-1
  4. c is where L crosses the y-axis, not the x-axis. Write the answer as y=\dots, not L=\dots

Now try this

The line L is shown on the grid.

Find an equation for L.

Type powers with ^ and fractions with /, for example x^2 or (x+1)/3

  1. L crosses the y-axis at (0,2), so c=2
  2. From (0,2) to (3,0) is 3 across and 2 down. Gradient =-\frac23
  3. y=-\frac23x+2

More like this: practice questions

Worked example 2: A line through a point with a given gradient

The line L has gradient \frac23 and passes through the point (-3,4)

Find an equation for L.

  1. Write y=\frac23x+c
  2. Substitute x=-3 and y=4: 4=\frac23\times(-3)+cso 4=-2+cso c=6
  3. y=\frac23x+6
  4. c is not 4: the point is not on the y-axis, so substitute both coordinates. This is also the last step of every perpendicular line and tangent question.

Now try this

The line L has gradient −4 and passes through the point (3,-5)

Find an equation for L.

Type powers with ^ and fractions with /, for example x^2 or (x+1)/3

  1. Write y=-4x+c and substitute x=3, y=-5: -5=-4\times3+c
  2. -5=-12+cso c=7
  3. y=-4x+7

More like this: practice questions

Worked example 3: A line through two points

The line L passes through the points (-4,1) and (2,4)

Find an equation for L.

  1. Gradient =\dfrac{4-1}{2-(-4)}=\frac36=\frac12
  2. Substitute (2,4) into y=\frac12x+c: 4=1+cso c=3
  3. y=\frac12x+3
  4. Check with the other point: \frac12\times(-4)+3=1. Take the coordinates in the same order on the top and the bottom of the gradient.

Now try this

The line L passes through the points (-1,6) and (3,-2)

Find an equation for L.

Type powers with ^ and fractions with /, for example x^2 or (x+1)/3

  1. Gradient =\dfrac{-2-6}{3-(-1)}=\frac{-8}{4}=-2
  2. Substitute (3,-2) into y=-2x+c: -2=-6+cso c=4
  3. y=-2x+4

More like this: practice questions

Worked example 4: Where two lines cross

The line L_1 passes through the points (-1,-5) and (3,7)

The line L_2 has equation 2x+y=8

L_1 and L_2 intersect at the point P.

Find the coordinates of P.

  1. Gradient of L_1: \dfrac{7-(-5)}{3-(-1)}=\frac{12}4=3. Substitute (3,7) into y=3x+c: 7=9+cso c=-2 and L_1 is y=3x-2
  2. Rearrange L_2: y=8-2x
  3. At P both equations are true, so 3x-2=8-2x. Then 5x=10 and x=2
  4. y=3\times2-2=4, so P is (2,4)
  5. Check in L_2: 2\times2+4=8. Give both coordinates: P is a point.

Now try this

The line L_1 passes through the points (-1,7) and (3,-1)

The line L_2 has equation 4x-2y=6

L_1 and L_2 intersect at the point P.

Find the coordinates of P.

  1. Gradient of L_1: \dfrac{-1-7}{3-(-1)}=-2. Substitute (-1,7): 7=2+c, so L_1 is y=-2x+5
  2. Rearrange L_2: 2y=4x-6so y=2x-3
  3. -2x+5=2x-3so 4x=8so x=2
  4. y=2\times2-3=1, so P is (2,1)

More like this: practice questions

Worked example 5: A missing coordinate of a point on a line

The line L passes through the points (2,5) and (6,-3)

The point (k,13) lies on L.

Find the value of k.

  1. Gradient =\dfrac{-3-5}{6-2}=\frac{-8}4=-2. Substitute (2,5): 5=-4+c, so L is y=-2x+9
  2. (k,13) fits the equation: 13=-2k+9so -2k=4so k=-2
  3. If a point is given by a ratio, find it first: the point that divides AB in the ratio 1:3 is \frac14 of the way from A to B. Do not assume two lines are perpendicular unless the question says so.

Now try this

The line L passes through the points (-1,-4) and (3,8)

The point (p,20) lies on L.

Find the value of p.

  1. Gradient =\dfrac{8-(-4)}{3-(-1)}=\frac{12}4=3. Substitute (3,8): 8=9+c, so L is y=3x-1
  2. 20=3p-1so 3p=21so p=7

More like this: practice questions

Interactive diagram

Practice questions