The slope formula is m = (y₂ − y₁)/(x₂ − x₁), where (x₁, y₁) and (x₂, y₂) are two different points on a line and x₂ ≠ x₁. Slope measures how much y changes for each unit change in x. It is also called the gradient.
In words, slope = rise ÷ run. A positive slope rises from left to right, a negative slope falls, and a horizontal line has slope 0. A vertical line has an undefined slope because its run is 0.
Slope formulas at a glance
| Use | Formula | Condition |
|---|---|---|
| Two known points | m = (y₂ − y₁)/(x₂ − x₁) | The x-coordinates must differ. |
| A graph | m = rise/run = Δy/Δx | Use signed coordinate changes, not just lengths. |
| Slope-intercept equation | y = mx + b | m is the slope; b is the y-intercept. |
| Equation through a point | y − y₁ = m(x − x₁) | Use a known point and a defined slope. |
The symbol Δ means “change in”. Subscripts 1 and 2 label the points. They are not powers. Keep the subtraction order the same in the numerator and denominator.
What does slope mean?
A slope of 2 means y increases by 2 when x increases by 1. A slope of −1/2 means y decreases by 1 when x increases by 2. For a straight line, the ratio stays constant, whichever two distinct points you choose.
Slope tells you the direction and rate of change. It does not give the segment’s length or the point halfway along it. Those use the distance formula and midpoint formula.
How to find slope from two points
- Label the points (x₁, y₁) and (x₂, y₂).
- Subtract the y-coordinates: rise = y₂ − y₁.
- Subtract the x-coordinates in the same point order: run = x₂ − x₁.
- Divide rise by run and simplify. If the run is 0, stop: the slope is undefined.
You may reverse both subtraction orders and get the same result. Reversing only one changes the sign and gives the wrong slope.
Slope on a coordinate graph
For A(1, 1) and B(7, 4), m = (4 − 1)/(7 − 1) = 3/6 = 1/2. Moving right 6 units takes you up 3 units. Equivalently, a move right 2 units takes you up 1 unit.
Read coordinate values from the axis labels. A square on a graph might represent more than 1 unit, and the two axes may use different scales. Counting squares alone can therefore give the wrong ratio.
Positive, negative, zero and undefined slope
| Type | Coordinate change | Appearance from left to right |
|---|---|---|
| Positive: m > 0 | y increases as x increases | The line rises. |
| Negative: m < 0 | y decreases as x increases | The line falls. |
| Zero: m = 0 | y stays constant while x changes | The line is horizontal: y = a constant. |
| Undefined | x stays constant while y changes | The line is vertical: x = a constant. |
When you compare steepness in the same coordinate system, use the absolute value of the slope. A slope of −4 is steeper than 1/2, even though −4 is the smaller signed number. The negative sign describes direction.
Worked slope examples
1. Negative coordinates and a negative slope
Find the slope through A(−3, 5) and B(1, −3).
- Rise = −3 − 5 = −8.
- Run = 1 − (−3) = 4.
- m = −8/4 = −2.
The line falls 2 units for every 1 unit to the right. Parentheses around negative coordinates make the subtraction easier to follow.
2. Decimal coordinates
For A(0.5, 1.2) and B(2.5, 2.2), m = (2.2 − 1.2)/(2.5 − 0.5) = 1/2 = 0.5. The same formula works with integers, decimals and fractions.
3. Horizontal and vertical lines
For A(−2, 4) and B(5, 4), m = (4 − 4)/(5 − (−2)) = 0/7 = 0. The equation is y = 4.
For A(3, −2) and B(3, 6), the formula gives (6 − (−2))/(3 − 3) = 8/0. Division by zero is undefined, so the slope is undefined. The equation is x = 3.
4. Find slope from an equation
Rewrite 4x + 2y = 10 so that y is on its own: 2y = −4x + 10, then y = −2x + 5. Comparing this with y = mx + b gives m = −2 and b = 5.
Do not read the coefficient of x as the slope until the equation is in slope-intercept form. In 4x + 2y = 10, the slope is not 4.
5. Find a missing coordinate
A line through A(−1, 2) and B(3, k) has slope −3/2. Substitute the known values:
- −3/2 = (k − 2)/(3 − (−1)) = (k − 2)/4.
- Multiply by 4: −6 = k − 2.
- Add 2: k = −4.
Checking A(−1, 2) and B(3, −4) gives (−4 − 2)/(3 + 1) = −6/4 = −3/2, as required.
Write an equation using slope
Use y − y₁ = m(x − x₁) when you know a point and a defined slope. For the graph above, m = 1/2 and A(1, 1), so y − 1 = (1/2)(x − 1). Simplifying gives y = (1/2)x + 1/2.
A vertical line cannot be written as y = mx + b with a finite m. If it passes through (a, b), write its equation as x = a.
Parallel and perpendicular slopes
Distinct non-vertical lines are parallel when they have equal slopes. For example, y = 2x + 1 and y = 2x − 5 both have slope 2. Equal slopes and equal y-intercepts describe the same line. Distinct vertical lines are parallel too.
For two non-vertical perpendicular lines, the slopes satisfy m₁m₂ = −1. For example, slopes 2/3 and −3/2 are negative reciprocals. A horizontal and a vertical line are also perpendicular; handle that pair separately because the vertical slope is undefined.
Common slope mistakes
- Using run ÷ rise. The y-change belongs on top.
- Mixing subtraction orders. Use point 2 minus point 1 in both parts, or reverse both.
- Ignoring a negative sign. Subtracting a negative value becomes addition.
- Calling a vertical slope zero. Zero rise gives a horizontal line; zero run gives an undefined slope.
- Using the same point twice. This produces 0/0 and cannot determine a unique line or slope.
Practice questions
- Find the slope through (2, 3) and (8, 12).
- Find the slope through (−4, 5) and (2, −7).
- Find the slope through (−1, 6) and (5, 6).
- Find the slope through (4, −3) and (4, 8).
- The slope through (1, 2) and (5, k) is 3/4. Find k.
Answers
- m = (12 − 3)/(8 − 2) = 9/6 = 3/2.
- m = (−7 − 5)/(2 − (−4)) = −12/6 = −2.
- m = (6 − 6)/(5 − (−1)) = 0/6 = 0.
- The run is 4 − 4 = 0, so the slope is undefined.
- 3/4 = (k − 2)/4, so k − 2 = 3 and k = 5.
Frequently asked questions
What is the slope formula?
For two points with different x-coordinates, m = (y₂ − y₁)/(x₂ − x₁). It divides the change in y by the change in x, often described as rise over run.
Can slope be negative or a fraction?
Yes. A negative slope means y falls as x increases. A fraction describes a ratio: a slope of −2/3 means a fall of 2 units for a move of 3 units to the right.
What is the difference between zero and undefined slope?
Zero slope belongs to a horizontal line, where the y-change is 0 and the x-change is non-zero. Undefined slope belongs to a vertical line, where the x-change is 0. Division by zero has no defined value.
Does it matter which point I use first?
No, provided you keep the same order in both subtractions. Reversing both orders makes the numerator and denominator change sign, leaving the ratio unchanged.
Can one point determine a slope?
No. Many lines with different slopes pass through one point. You need another distinct point or extra information, such as a line equation or a stated gradient. Repeating the same point does not supply a second point.
Explore more coordinate geometry
Find a segment’s length with the distance formula or its halfway point with the midpoint formula. Browse the Coordinates guides or return to All Geometry Formulas.
References: OpenStax, Intermediate Algebra 2e, Section 3.2; College Algebra 2e, Section 4.1; Algebra and Trigonometry 2e, Section 2.2.
