topic badge
Middle Years

4.05 Equation of a straight line

Lesson

So far we have looked at methods for sketching graphs using the point-gradient form of the equation. We know that all linear equations can be written in the form $y=mx+c$y=mx+c where $m$m is the gradient and $c$c is the value of the $y$y-intercept.

Knowing this, we can also work out the equation of a straight line if we are given its graph (or a table of values) - we just need to work out the gradient and $y$y-intercept. That is, we want to find $m$m and $c$c

To find $c$c we can just look at where the line crosses the $y$y-axis. The value of $y$y at this point is our $y$y-intercept.

To find the gradient, we want to choose two points on the line that we can easily identify the co-ordinates of, ideally points with integer co-ordinates. Using these two points we can calculate the gradient, by identifying the rise and run of the line, or by using the gradient formula.

 

Exploration

Consider the following graph. How can we work out its equation?

 

Every linear equation can be written in the form $y=mx+c$y=mx+c so if we can find $m$m and $c$c we can find the equation.

We can see that the $x$x and $y$y-intercepts are clearly marked on the graph and to find the equation of a straight-line graph we actually only need to know two points, so let's use the two intercepts.

The $y$y-intercept is at $\left(0,-6\right)$(0,6) which means $c=-6$c=6.

To find the gradient $m$m we want to work out the rise and run of the line. As we move along the line from the $x$x-intercept to the $y$y-intercept , we have moved from $\left(0,-6\right)$(0,6) to $\left(2,0\right)$(2,0). That is, the $x$x-value has increased by $2$2 and the $y$y-value has increased by $6$6. This means we have a run of $2$2 and a rise of $6$6.

This means the gradient $m$m is equal to $\frac{6}{2}=3$62=3.

We could have chosen any two points on this line, but sometimes the coordinates might not be clear if they are not integer values. In this case, the point that is one unit along the $x$x-axis from the point $\left(0,-6\right)$(0,6) has coordinates of $\left(1,-3\right)$(1,3) which confirms the gradient is $3$3 and as expected.

Did you know?

If the line passes through the origin $\left(0,0\right)$(0,0) the $x$x and $y$y-intercept both occur at this point, so you will need to find a second point to calculate the gradient.

This line passes through the origin, we can see it also passes through the point $\left(2,-1\right)$(2,1)

 

The point-gradient formula

Sometimes we don't know the value of the $y$y-intercept, but if we know the gradient and the coordinates of one point, we can still find the equation of the line. If we don't know the gradient, but know the coordinates of two points, we can first find the gradient and then use the point-gradient formula.

 

Exploration

Let's say we know that the gradient of the line is $-2$2. We also know a point on the line, $\left(2,-8\right)$(2,8).

Now, apart from this point there are infinitely many other points on this line, and we will let $\left(x,y\right)$(x,y) represent each of them.

Well, since $\left(x,y\right)$(x,y) and $\left(2,-8\right)$(2,8) are points on the line, then the gradient between them will be $-2$2.

We know that to find the gradient given two points, we use: 

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

Let's apply the gradient formula to $\left(x,y\right)$(x,y) and $\left(2,-8\right)$(2,8):

$m=\frac{y-\left(-8\right)}{x-2}$m=y(8)x2

But we know that the gradient of the line is $-2$2. So:

$\frac{y-\left(-8\right)}{x-2}=-2$y(8)x2=2

Rearranging this slightly, we get:

$y-\left(-8\right)=-2\left(x-2\right)$y(8)=2(x2)

You may be thinking that we should simplify the equation, and of course if you do you should get $y=-2x-4$y=2x4 What we want to do though, is generalise our steps so that we can apply it to any case where we're given a gradient $m$m, and a point on the line $\left(x_1,y_1\right)$(x1,y1).

In the example above, the point on the line was $\left(2,-8\right)$(2,8). Let's generalise and replace it with $\left(x_1,y_1\right)$(x1,y1).

We were also given the gradient $-2$2. Let's generalise and replace it with $m$m.

$y-\left(-8\right)=-2\left(x-2\right)$y(8)=2(x2) becomes $y-y_1=m\left(x-x_1\right)$yy1=m(xx1)

We call this the point gradient formula, because when we know a point and the gradient using this rule we can easily get the equation of that line.

 

The point-gradient formula

Given a point on the line $\left(x_1,y_1\right)$(x1,y1) and the gradient $m$m, the equation of the line is:

$y-y_1=m\left(x-x_1\right)$yy1=m(xx1)

 

Worked example

Find the equation of a line, in point-gradient form, that passes through the point $\left(-4,3\right)$(4,3) and has gradient of $5$5

Think: We know the gradient of the line, and a point that it passes through, so we can use the point-gradient formula to find the equation of the line.

Do: Substitute $m=5$m=5, $x_1=-4$x1=4 and $y_1=3$y1=3 into the equation $y-y_1=m\left(x-x_1\right)$yy1=m(xx1), and rearrange to solve for $y$y.

$y-y_1$yy1 $=$= $m\left(x-x_1\right)$m(xx1)
$y-3$y3 $=$= $5\left(x-\left(-4\right)\right)$5(x(4))
$y-3$y3 $=$= $5\left(x+4\right)$5(x+4)
$y-3$y3 $=$= $5x+20$5x+20
$y$y $=$= $5x+23$5x+23

We can also achieve the same result by substituting the known values straight into the equation $y=mx+c$y=mx+c. We can then rearrange the equation to solve for the unknown $c$c.

In the above case, we know that $m=5$m=5 and the point $\left(-4,3\right)$(4,3) lies on the line. Substituting these values into $y=mx+c$y=mx+c gives us:

$3=5\times\left(-4\right)+c$3=5×(4)+c

Rearranging the equation to solve for $c$c gives us:

$c=23$c=23

We now know the values of $c$c and $m$m and can substitute them into the equation $y=mx+c$y=mx+c, giving us:

$y=5x+23$y=5x+23

Practice questions

Question 1

Consider the following graph.

Loading Graph...

  1. State the value of the $x$x-intercept.

  2. State the value of the $y$y-intercept.

Question 2

The variables $x$x and $y$y are related, and a table of values is given below:

$x$x $1$1 $2$2 $3$3 $4$4 $5$5
$y$y $1$1 $4$4 $7$7 $10$10 $13$13
  1. What is the value of $y$y when $x=0$x=0?

  2. Write the linear equation expressing the relationship between $x$x and $y$y.

  3. What is the value of $y$y when $x=60$x=60?

Question 3

A line passes through Point $A$A $\left(-4,3\right)$(4,3) and has a gradient of $4$4.

  1. Find the value of the $y$y-intercept of the line, denoted by $c$c.

  2. Hence, write the equation of the line in gradient-intercept form.

Question 4

A line passes through the point $A$A$\left(-\frac{4}{5},-4\right)$(45,4) and has a gradient of $2$2. Using the point-gradient formula, express the equation of the line in gradient intercept form.

 

What is Mathspace

About Mathspace