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=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.
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: (x1,y1) and (x2,y2). Use the formula from above:
m=change in xchange in y
where
change in y=y2−y1 and change in x=x2−x1
Now you can use the formula
m=x2−x1y2−y1
to find the gradient of the straight line.
Note: It's very important to take x1 and y1 from the same point, and to take x2 and 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
Find the gradient of the line that passes through the points (−5,2) and (−1,10).
To begin, establish which is the (x1,y1) point and which is the (x2,y2) point. It doesn't matter which is which, so assign (−5,2) as (x1,y1) and assign (−1,10) as (x2,y2). Thus the gradient can be calculated:
m=x2−x1y2−y1=−1−(−5)10−2=48=2
So the gradient of this line is 2.