Finding the gradient
In a nutshell
The gradient of a line is a measure of its steepness. It is given by a 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=change in ychange in xm=\frac{\text{change in }y}{\text{change in }x}m=change in xchange in y
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.
Calculating the gradient
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 everything you need to know about the line, in particular, its gradient! This is where the formula from above comes in:
m=change in ychange in xm=\frac{\text{change in }y}{\text{change in }x}m=change in xchange in y
Suppose you have two points that sit on your straight line: (x1,y1)(x_{_1},y_{_1})(x1,y1) and (x2,y2)(x_{_2},y_{_2})(x2,y2). Then
change in y=y2−y1\text{change in }y=y_{_2}-y_{_1}change in y=y2−y1
and
change in x=x2−x1\text{change in }x=x_{_2}-x_{_1}change in x=x2−x1
So now you can use the formula:
m=y2−y1x2−x1m=\frac{y_{_2}-y_{_1}}{x_{_2}-x_{_1}}m=x2−x1y2−y1
to find the gradient of the straight line.
Note: It's very important that you take x1x_{_1}x1 and y1y_{_1}y1 from the same point, and take x2x_{_2}x2 and y2y_{_2}y2 from the other point. If you mix this up, you will calculate the gradient to be the negative of what it should be!
Example
You have a line and find that the two points (3,6)(3,6)(3,6) and (5,10)(5,10)(5,10) sit on it. Use this to calculate the gradient of the line.
First of all, assign the x1,y1,x2 and y2. Suppose you decide that (3,6) is point 1 and (5,10) is point 2. Hence:
x1=3y1=6x2=5y2=10\begin{aligned}x_{1}&=3\\y_1 &= 6\\x_2 &= 5\\y_2 &= 10 \end{aligned}x1y1x2y2=3=6=5=10
Using the formula for the gradient, you can calculate that:
m=y2−y1x2−x1=10−65−3=42=2m=\frac{y_{_2}-y_{_1}}{x_{_2}-x_{_1}}=\frac{10-6}{5-3}=\frac42=2m=x2−x1y2−y1=5−310−6=24=2
So the gradient of the line is 2‾\underline{2}2.