What is the Slope Formula?

The slope of a straight line describes the line’s angle of steepness from the horizontal whether it rises or falls.

When the line neither rises nor falls, then we claim that it has a slope of zero. This is, in fact, the case of a horizontal line where it extends infinitely to its left or right but without any sign of “rising” or “falling”.

In this lesson, the focus is to go over lots of worked examples to illustrate how to use the formula itself. Remember that two points determine a line. Thus, it is possible to calculate the slope of a straight line, denoted by the symbol, [latex]m[/latex], when we know at least two points where the line passes through.


The Slope Formula

The slope, [latex]m[/latex], of a line passing through two arbitrary points [latex]\left( {{x_1},{y_1}} \right)[/latex] and [latex]\left( {{x_2},{y_2}} \right)[/latex] is calculated as follows.

illustrates how the slope formula is used how to find the slope of the line passing through a given two points or ordered pairs which are (x1,y1) and (x2,y2)

Few observations:

  • The coordinates of the first point are assigned with subscript [latex]1[/latex].
The subscript of 1 indicates that the x and y are the components of the first ordered pair or point.

While the coordinates of the second point are assigned with subscript [latex]2[/latex].

The subscript of 2 indicates that the x and y are the components of the second ordered pair or point.
  • The numerical value for slope is expressed as a ratio or fraction. The numerator contains the difference of [latex]y[/latex]-values, while the denominator contains the difference of [latex]x[/latex]-values.
slope represented by "m" is equal to the quantity y2 minus y1, then divide it by the quantity x2 minus x1
  • The slope formula is conceptually defined as the rise over run. The “rise” pertains to the movement of the point along the [latex]y[/latex]-axis, and the “run” pertains to the movement along the [latex]x[/latex]-axis.
the formula of the slope is equal to the ratio of the difference in y's and the difference in x's. sometimes it is considered to be the rise over run.

Examples of How to Find the Slope of a Line using the Slope Formula

Example 1: Determine the slope of the line passing through the points [latex]\left( {3,5} \right)[/latex] and [latex]\left( {7,13} \right)[/latex].

Start by assigning which ones will be our first and second points. If we decide to make [latex]\left( {3,5} \right)[/latex] as the first point, then [latex]\left( {7,13} \right)[/latex] should automatically be the second.  The first point uses subscript [latex]1[/latex], and the second point uses subscript [latex]2[/latex]. The diagram below should help us visualize the first step.

the first point (x1,y1) is the ordered pair (3,5) while the second point (x2,y2) is the ordered pair (7,13)

Next, it is now easy to extract the values that we will substitute in the slope formula.

(3,5) and (7,13)

We are now ready to substitute the known values into the formula.

using the formula to find the slope, we have m = (y2-y1)/(x2-x1) = (13-5)/(7-3) = 8/4 = 2, therefore slope is equal to 2.

At [latex]m=2[/latex], we have a positive slope and therefore the straight line is rising or increasing from left to right. In other words, having a positive slope is like climbing up a hill. See the graph below.

the graph of the line passing through the points (3,5) and (7,13) has a slope of m = 2.

Example 2: Determine the slope of the line passing through the points [latex]\left( {2,10} \right)[/latex] and [latex]\left( {5,1} \right)[/latex].

Identify the first and second points.

if we consider the first point to be (2,10) then x1 = 2 and y1 =10. in addition, if we want the second point to be (5,1) then x2=5 and y2=1.

Plug these values in the slope formula. Make sure that you subtract the numbers correctly. This is usually where students commit errors because they tend to be careless when doing basic arithmetic operations.

m=(y2-y1)/(x2-x1) = (1-10)/(5-2) = -9/3 = -3 therefore the slope is negative 3

Here is the graph of the line passing through points [latex]\left( {2,10} \right)[/latex] and [latex]\left( {5,1} \right)[/latex] with its corresponding negative slope of [latex]m = – 3[/latex]. This means that the straight line is falling/decreasing from left to right. You may think of it as somebody going down the hill.

the graph of the line passing through the points (2,10) and (5,1) has a negative slope of m=-3

Example 3: Determine the slope of the line passing through the points [latex]\left( { – \,7,3} \right)[/latex] and [latex]\left( {15, – \,5} \right)[/latex].

In this example, I’d like to show you that the numerical value of the slope is ALWAYS the same, regardless of which point you pick to be the “first” or “second”. As long as you maintain the correct order by subtracting the corresponding [latex]y[/latex] and [latex]x[/latex] coordinates, the slope should come out unchanged.

Let me illustrate the idea by solving the slope two ways. See the comparison below.

CASE 1 (usual order of points)

the first point is (-7,3) while the second point is (15,-5)
  • Label each point with appropriate [latex]x[/latex] and [latex]y[/latex] coordinates.
for the first order pair, we have xsub1=-7 and ysub1=3, while the second ordered pair is xsub2=15 and ysub2=-5
  • Evaluate the values into the slope formula
the slope of line passing through the points (-7,3) and (15,-5) is -4/11.

CASE 2 (reverse order of points)

reversing the roles of the two points do not change the value of the slope
  • Label each point with appropriate [latex]x[/latex] and [latex]y[/latex] coordinates.
(-7,3) and (15,-5)
  • Evaluate the values into the slope formula
m=(ysub2-ysub1)/(xsub2-xsub1) = (3+5)/(-7-15)=8/-22=-4/11

That’s right! We have shown that the final answers for slope came out to be the same although we switched the order of points.

Just a quick reminder, be very careful when you are subtracting negative numbers. Remember that subtraction by a negative number is the same as adding the negative value of that number. We can think of it as [latex]x – a = x + \left( { – a} \right)[/latex].

You may have heard before that “two negative signs” becomes positive. That is the reason why when I was subtracting by a negative number, I intentionally placed that negative number inside a parenthesis to prompt me to be a little bit careful in dealing with signs.


Example 4: Find the slope of the line that goes through the points [latex]\left( { – \,11, – \,5} \right)[/latex] and [latex]\left( {1, – \,12} \right)[/latex].

Solve this again side by side in two ways, to nail down the concept that reversing the order of points doesn’t affect the final outcome of the slope.

CASE 1 (usual order of points)

let (-11,-5) be the first ordered pair and (1,-12) be the second ordered pair
  • Label each point with appropriate [latex]x[/latex] and [latex]y[/latex] coordinates.
since the first point is (-11,-5) that means xsub1 =-11 and ysub1=-5. in the same manner, the second point (1,-12) implies that xsub2=1 and ysub2=-12.
  • Evaluate the values into the slope formula
m=(y sub 2 minus y sub 1) divided by (x sub 2 minus x sub 1) = [(-12-(-5)]/[1-(-5)] = (-12+5)/(1+11) = -7/12

CASE 2 (reverse order of points)

reversing the order points in the calculation of finding the slope does not change the slope value
  • Label each point with appropriate [latex]x[/latex] and [latex]y[/latex] coordinates.
the first ordered pair is (-11,-5) while the second ordered pair is (1,-12)
  • Evaluate the values into the slope formula
slope is negative 7 over 12

This is wonderful! We arrived at the same final answer using two different routes of calculation.


Example 5: Find the slope of the line that goes through the points [latex]\left( {5,17} \right)[/latex] and [latex]\left( {0, – \,3} \right)[/latex].

If you want to solve this step by step, you may do it this way.

  • Step 1: Label the points
first ordered pair is (5,17) while the second ordered pair is (0,-3)
  • Step 2: Extract values
x2 = 0 and y2 = -3
  • Step 3: Write the slope formula
the slope of the line is equal to the quotient of delta y and delta x
  • Step 4: Substitute values from Step 2, then simplify.
m = -20/-5 = 4

Notes:

  • For the numerator: adding two negative numbers yields a negative answer. Since,
-3-17=(-3)+(-17)=-20
  • Also, dividing two negative numbers results to a positive answer. That’s why our final answer for slope is [latex]m = + \,4[/latex].

Example 6: Find the slope of the line that goes through the points [latex]\left( { – \,1, – \,2} \right)[/latex] and [latex]\left( { – \,3, – \,4} \right)[/latex].

This looks like a fun problem because all the entries of the two points are negative numbers. I bet you that your teacher may throw something like this in order to test if you are careful dealing with the subtraction of negative numbers.

Let the first point be [latex]\left( { – \,3, – \,4} \right)[/latex] and [latex]\left( { – \,1, – \,2} \right)[/latex] be the second. Labeling their corresponding coordinate values, and substituting we should get

  • First point
xsub1 = -3 while ysub1=-4
  • Second point
xsub2=-1 while ysub2 = -2
  • Evaluate values into the slope formula
the slope is calculated as m = (y sub 2 minus y sub 1)/ (x sub 2 minus x subs 1) = 2/2 = 1, therefore m = 1

Example 7: Solve the slope of the line passing through the points [latex]\left( {6, – \,8} \right)[/latex] and [latex]\left( {14, – \,8} \right)[/latex].

This problem is an example of a horizontal line. It happens when the computed value of the slope equals zero!

Suppose 

xsub1 = 6 and ysub1 = -8

 and 

xsub2=14 and ysub2=-8

The computation of the slope of the line is shown below.

m=[-8-(-8)]/(14-6) = (-8+8)/(14-6) = 0/8 = 0, thus the slope is equal to zero, or m=0

Indeed, the line is horizontal as shown in the graph. The line behaves this way because no matter how the [latex]x[/latex]-coordinates vary, the [latex]y[/latex]-values are constant or not changing. The effect is that as long as the [latex]y[/latex] doesn’t change, the plotted points will all remain in that same horizontal line where [latex]y = – 8[/latex].

the graph of the line passing through the points (6,-8) and (14,-8) has slope of zero or m=0

Example 8: Solve the slope of the line passing through the points [latex]\left( {10,0} \right)[/latex] and [latex]\left( {10,9} \right)[/latex].

This last example illustrates when the line passing through two given points is a vertical line.

All vertical lines have no slope because the numerical value of their slopes results in the division by zero, commonly known as undefined.

Let [latex]\left( {{x_1},{y_1}} \right) = \left( {10,0} \right)[/latex] and [latex]\left( {{x_2},{y_2}} \right) = \left( {10,9} \right)[/latex].

The slope of the straight line is calculated as follows.

m=(9-0)/(10-10) = 9/0 which is undefined since division by zero is not allowed

Any nonzero number divided by zero has no answer. That’s why we just call it undefined. Here’s the graph to show the vertical line.

the graph of the vertical line passing through the points (10,9) and (10,0) has an undefined slope

You may also be interested in these related math lessons or tutorials:

Types of Slopes of a Line

Slope-Intercept Form of a Line

Point-Slope Form of a Line