# Home > Algebra > Coordinate Geometry > Finding the Slope of a Line

# Finding the Slope of a Line

We saw that the slope of a line is given by the formula –

m =  slope or gradient  =  Now finding the slope of a line involves the following three steps:

Step 1: Find the change in value of x when moving from left to right i.e. from the first point to the second point along the x-axis.

Step 2: Next find the change in value of y by moving from the bottom point to the top point along the y-axis.

Remember – if you move from right to left, the change in value of x is negative. Similarly, when you move from top to bottom, the change in value of y is negative. Otherwise they are both positive.

Step 3: Now finding the slope of a line is simply a matter of applying the above slope/gradient formula.

## Examples of finding the slope of a line

Example 1: In the diagram, the x-intercept is A (-2, 0), and moving from A to the point where the dotted line from y-axis point meets the x-axis i.e. from left to right, the change in value of x is 3.

Next, we move from point 1 on the x-axis up to point B (1, 3) i.e. from bottom to top, and calculate the change in value of y, which is 3 in this case.

m =  slope or gradient  =  = =  1

We can also calculate the slope of the line using the gradient formula, viz.

m  = Here y1 = 0, y2 = 3,  x1 = -2 and x2 = 1

So m = = =  1

Example 2: Here rise = 2 (as we move upwards), and run = -2 (moving two units to the left). Remember, since we’re moving from right to left, the change in value of x (or run) will be negative.

So slope or gradient m  =  = =  -1

We can calculate the slope using the formula m =  Here y1 = 1, y2 = 3,  x1 = 3 and x2 = 1

So m  = = =  -1

Example 3: We need to find the gradient of the line passing through points A (-1, 4) and B (2, -2)

Change in x = +3 (moving left to right i.e. from A to B) Change in y = -6 (moving downwards from A to B)

m =  slope or gradient  = = =  -2

A:  x1 = 3 and y1 = 1

B:  x2 = 1 and y2 = 3

m = gradient or slope = = = =  -2

Example 4: We need to find the gradient of the line passing through points A (2, 4) and B (-3, -3)

Change in x = -5 (moving right to left i.e. from A to B) Change in y = -7 (moving downwards from A to B)

m = gradient or slope of line AB = = = A:  x1 = 2 and y1 = 4

B:  x2 = -3 and y2 = -3

m  =  gradient or slope  = = = = Remember:

• All horizontal lines having equations of form y = b have a slope of 0.
• All vertical lines having equations of form x = a have a slope undefined (or infinity)