# Finding the gradient of a straight line

## In a nutshell

The gradient of a line is a measure of its steepness. At a point, it is given by a constant number and can be calculated in a few different ways, in particular, by using the coordinates of two points on the line.

### Definition

The technical definition of a line's "gradient" is the rate of change of the $y$-coordinate with respect to the $x$-coordinate. In simpler terms, it is how quickly the line goes up (or down) as it moves in the rightward direction. You can denote the gradient with $m$ and it is calculated with the following formula:

$m=\frac{\text{change in }y}{\text{change in }x}$

where the changes in $y$ and $x$ are the differences between two points' coordinates. You can think of this as everytime you go to right by $1$, your line has also gone $m$ vertically.

## Equations of straight line graphs

The general equation of a straight line is

$y=mx+c$

where $m$ is the gradient of the line and $c$ is the $y$-intercept. If $m$ is not zero, then the line is diagonal. If $m$ *is* zero, then the line is horizontal:

$y=c$

A vertical line does not have this equation. Instead it has equation

$x=d$

where $d$ is the $x$-intercept. You do not refer to the gradient of a vertical line since it has no value.

## Calculating the gradient of a line

Given that a straight line can be described with only two points (any two points on the line), you can use the coordinates of those points to tell you its gradient.

Suppose you have two points that sit on your straight line: $(x_{_1},y_{_1})$ and $(x_{_2},y_{_2})$. Use the formula from above:

$m=\frac{\text{change in }y}{\text{change in }x}$

where

$\text{change in }y=y_{_2}-y_{_1}$ and $\text{change in }x=x_{_2}-x_{_1}$

Now you can use the formula

$m=\frac{y_{_2}-y_{_1}}{x_{_2}-x_{_1}}$

to find the gradient of the straight line.

**Note:** *It's very important to take *$x_{_1}$* and *$y_{_1}$* from the same point, and to take $x_{_2}$ and $y_{_2}$ from the other point.** If you mix this up, you will calculate the gradient to be the negative of what it should be.*

##### Example

*Find the gradient of the line that passes through the points $(-5,2)$ and $(-1,10)$. *

*To begin, establish which is the $(x_{_1},y_{_1})$ point and which is the $(x_{_2},y_{_2})$ point. It doesn't matter which is which, so assign $(-5,2)$ as $(x_{_1},y_{_1})$ and assign $(-1,10)$ as $(x_{_2},y_{_2})$. Thus the gradient can be calculated:*

*$m=\frac{y_{_2}-y_{_1}}{x_{_2}-x_{_1}}=\frac{10-2}{-1-(-5)}=\frac84=2$*

*So the gradient of this line is* $\underline2$.