The equation of a straight line is \[y = mx + c\] $m$ is the gradient and $c$ is the height at which the line crosses the $y$-axis, also known as the $y$-intercept.

The gradient $m$ is the slope of the line - the amount by which the $y$-coordinate increases in proportion to the $x$-coordinate. If you have two points $(x_1,y_1)$ and $(x_2,y_2)$ on the line, the gradient is \[m = \dfrac{y_2 - y_1}{x_2 - x_1}\]

|center

If you know one point $(x_1,y_1)$ on the line as well as its gradient $m$, the equation of the line is \[(y - y_1) = m(x - x_1)\]

If we are just given two points $(x_1, y_1)$ and $(x_2, y_2)$, we must first work out the gradient using the gradient formula above, and then choose either point to substitute into the straight line equation with this gradient.

Worked Examples

Example 1

Find the equation of the line with gradient $-2$ that passes through the point $(3,-4)$.

Solution

Put $m=-2$, $x_1=3$ and $y_1=-4$ straight into the formula $y-y_1=m(x-x_1)$.

\[y-y_1=m(x-x_1)\]\[y+4=-2(x-3)\]

Expand the brackets and simplify.

\[y+4=-2x+6\]\[y=-2x+2\]

|center

Example 2

Find the equation of the straight line through the points $(-5,7)$ and $(1,3)$.

Solution

First, find the gradient by substituting the coordinates $x_1 = -5$, $y_1 = 7$, $x_2=1$ and $y_2=3$ into the formula for the gradient: