The equation of a straight line can be worked out using coordinates and the gradient, and vice versa.

Part of

The general equation of a straight line is \(y = mx + c\), where \(m\) is the gradient and \((0,c)\) the coordinates of the y-intercept.

Look at the National 4 straight line section before continuing.

We can find the equation of a straight line when given the gradient and a point on the line by using the formula:

\[y - b = m(x - a)\]

where \(m\) is the gradient and \((a,b)\) is on the line.

Find the equation of the line with gradient 3, passing through (4, 1).

Using \(y - b = m(x - a)\) with m = 3, a = 4 and b = 1.

\[y - 1 = 3(x - 4)\]

\[y - 1 = 3x - 12\]

\[y = 3x - 11\]

Now try the example question below.

- Question
Find the equation of the line which passes through the points A(-2, 0) and B(1, 6) and state the gradient and y-intercept.

Since we are given 2 points that already lie on the line, using the formula as before, we need to calculate the gradient first.

\[{m_{AB}} = \frac{{{y_2} - {y_1}}}{{{x_2} - {x_1}}} = \frac{{6 - 0}}{{1 - ( - 2)}} = \frac{6}{3} = \frac{2}{1} = 2\]

Now we can use the formula when m = 2, a = 1 and b = 6 (You can use any of the 2 points given in the question).

\[y - b = m(x - a)\]

\[y - 6 = 2(x - 1)\]

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

\[y = 2x + 4\]

Therefore the gradient equals 2 and y-intercept equals (0, 4).