If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Slope formula

Learn how to write the slope formula from scratch and how to apply it to find the slope of a line from two points.
It's kind of annoying to have to draw a graph every time we want to find the slope of a line, isn't it?
We can avoid this by writing a general formula for slope. Before we start, let's remember how slope is defined:
$\text{Slope}=\frac{\text{Change in y}}{\text{Change in x}}$
Let's draw a line through two general points $\left({x}_{1},{y}_{1}\right)$ and $\left({x}_{2},{y}_{2}\right)$.
An expression for $\text{change in x}$ is ${x}_{2}-{x}_{1}$:
Similarly, an expression for $\text{change in y}$ is ${y}_{2}-{y}_{1}$:
Now we can write a general formula for slope:
$\text{Slope}=\frac{\text{Change in y}}{\text{Change in x}}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}$
That's it! We did it!

Using the slope formula

Let's use the slope formula to find the slope of the line that goes through the points $\left(2,1\right)$ and $\left(4,7\right)$.
Step 1: Identify the values of ${x}_{1}$, ${x}_{2}$, ${y}_{1}$, and ${y}_{2}$.
${x}_{1}=2$
${y}_{1}=1$
${x}_{2}=4$
Step 2: Plug in these values to the slope formula to find the slope.
$\text{Slope}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}=\frac{7-1}{4-2}=\frac{6}{2}=3$
Step 3: Gut check. Make sure this slope makes sense by thinking about the points on the coordinate plane.
Yup! This slope seems to make sense since the slope is positive, and the line is increasing.

Using the slope formula walkthrough

Let's use the slope formula to find the slope of the line that goes through the points $\left(6,-3\right)$ and $\left(1,7\right)$.
Step 1: Identify the values of ${x}_{1}$, ${x}_{2}$, ${y}_{1}$, and ${y}_{2}$.
${x}_{1}=$
${y}_{1}=$
${x}_{2}=$
${y}_{2}=$

Step 2: Plug in these values to the slope formula to find the slope.
$\text{Slope}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}=$

Step 3: Gut check. Make sure this slope makes sense by thinking about the points on the coordinate plane.
Does this slope make sense?

Let's practice!

1) Use the slope formula to find the slope of the line that goes through the points $\left(2,5\right)$ and $\left(6,8\right)$.

2) Use the slope formula to find the slope of the line that goes through the points $\left(2,-3\right)$ and $\left(-4,3\right)$.

3) Use the slope formula to find the slope of the line that goes through the points $\left(-5,-7\right)$ and $\left(-2,-1\right)$.

What happens in the slope formula when ${x}_{2}={x}_{1}$?
As a reminder, here is the slope formula:
$\text{Slope}=\frac{{y}_{2}-{y}_{1}}{{x}_{2}-{x}_{1}}$
Feel free to discuss in the comments below!

Want to join the conversation?

• Why is the slope formula y/x? Why not y-x or y+x?

Jack.
• Slope is something that is also referred to as the rate of change. For example, if you had a savings account that you deposited no money into initially but you deposit 20\$ weekly, your rate of change, or slope for this problem would be 20. This is because your x-value in this situation would be the number of weeks passed since you have created your bank account, and the y-value is how much money you have deposited into your account, fully. Since you are looking at the rate of change between the weeks, you divide the change in y per week, 20, by 1 for the number of weeks. I hope this somewhat answers your question.
I think that when x_2 = x_1 then the slope will become undefined because x_2 - x_1 equals zero. Therefore when you divide y_2 - y_1 it won't be possible.

Example

(5,10) (5,15)

x_1 = 5
x_2 = 5
y_1 =10
y_2 =15

5 - 5= 0

15-10=5

5/0= Undefined
• Yes, you are correct. The slope of any line through two different points with the same x-coordinate (that is, a vertical line) is always undefined, for the reason you stated.
• why do i have a feeling that im going to die after i make it through slopes
• Because we all will die
• I think that when X2 = X1, the slope is undefined
• Yes! That is correct.
• bro im honestly so gone
• Slope is basically the change in the y direction divided by the change in the x direction. If you don't know graphs, you might want to learn that first.
• If I Get The Right Answer Then Why Do I Have To Simplify?
• Simplifying just makes it easier to read/understand. It makes it more "simple." Although both are equal, it is just easier to work with if it's simplified afterwards.
• Why do we always take change in y over change in x Why not vice versa ?
• slope is rise over run, and rise is y, while x is run.
When x1 = x2, it means that x1-x2=0. So therefore the formula will simplify to y/0. And as x/0 is undefined, the slope should also be undefined.
• in the formula mx+b=y, I understand that "m" is the slope and "b" is the y-intercept, but what is x and y?
• when you graph the line, mx+b=y and fill in the slope and y-intercept, the x and y represent points that are on the line that you graphed. For example, if the equation was 5x+10=y, you could create pairs of (x,y) coordinates by plugging in numbers for x and y. In this case, if x was 5, y would be 35 or vice versa. Based on this, you could say that (5,35) is a point on the line, 5x+10=y.
• How do you know which x and y values to plug in? Could you just do random numbers?
• If you mean how to find x and y, the problem statement should have provided you with 2 or more points. Since a straight line can be uniquely defined with 2 points, using those 2 points you can find the slope.

However, if you are asking which point is y₁ and which is y₂, it doesn't matter. Just note that if you have used P₁ for y₁, then you will need to use P₁ for x₁.

Let's prove that no matter which order you put in, the result is the same, i.e.

(y₁ - y₂) / (x₁ - x₂) = (y₂ - y₁) / (x₂ - x₁)

L.H.S. = (y₁ - y₂) / (x₁ - x₂)
= (-1) * (y₂ - y₁) / [(-1) * (x₂ - x₁)]
= [(-1) / (-1)] * (y₂ - y₁) / (x₂ - x₁)
= (y₂ - y₁) / (x₂ - x₁)
= R.H.S.