# Basics of straight lines

There are several basic facts and equations connected with straight lines that you need to know by heart.

## Distance formula

The distance between two points, $$({x_1},{y_1})$$ and $$({x_2},{y_2})$$ is given by the formula:

$\sqrt {{{({x_2} - {x_1})}^2} + {{({y_2} - {y_1})}^2}}$

So the distance between $$(2,3)$$ and $$(1,5)$$ is:

$\sqrt {{{(1 - 2)}^2} + {{(5 - 3)}^2}}$

$= \sqrt {{{( - 1)}^2} + {{(2)}^2}}$

$= \sqrt 5$

The gradient m between two points $$({x_1},{y_1})$$ and $$({x_2},{y_2})$$ is given by the formula:

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

This only applies where $${x_2} \ne {x_1}$$. If $${x_2} = {x_1}$$ then the gradient is undefined.

The gradient between $$(2,3)$$ and $$(1,5)$$ is:

$m = \frac{{5 - 3}}{{1 - 2}} = - 2$

• If a line with gradient $$m$$ makes an angle $$\theta$$ with the positive direction of the $$x$$-axis then $$m = \tan\theta$$

## Example 1

We can calculate the gradient of the line above by selecting two coordinate points that the straight line passes through.

(1,2) and (2,5)

$m = \frac{{{y_2} - {y_1}}}{{{x_2} - {x_1}}} = \frac{5-2}{2-1}=\frac{3}{1}=3$

Now that we know the gradient, we can calculate the angle that the straight line makes with the positive direction of the $$x$$axis.

$m=\tan\theta$

$3=\tan\theta$

$\theta =\tan^{-1}(3)$

$\theta =71.6^\circ$

Similarly, we can calculate the gradient of the straight line if we know the angle the line makes with the positive direction of the $$x$$ axis.

## Example 2

This time you will notice, the line has a negative gradient, so you will need to use your knowledge of quartiles to calculate this gradient.

$m=\tan\theta$

$m = \tan 120^\circ$

$m=-\tan60^\circ$

$m = - \sqrt 3$