The slope formula is m = (y₂ − y₁) / (x₂ − x₁), used to calculate the slope of a line from any two points on it. Slope measures how steep a line is and which direction it leans. The formula returns a single value - positive, negative, zero, or undefined — that describes the line's incline.
The Slope Formula
m = (y₂ − y₁) / (x₂ − x₁)
m = Δy / Δx
m = rise / run
The Greek letter Δ (delta) means "change in." So Δy is the change in y-values, and Δx is the change in x-values.
Variable Key
Variable | Meaning |
|---|---|
m | Slope of the line |
(x₁, y₁) | Coordinates of the first point on the line |
(x₂, y₂) | Coordinates of the second point on the line |
Δy | Change in y-values: y₂ − y₁ (the "rise") |
Δx | Change in x-values: x₂ − x₁ (the "run") |
θ (theta) | Angle the line makes with the positive x-axis |
Slope Formula Derivation
The slope formula comes directly from the definition of slope: the ratio of vertical change to horizontal change between two points on a line.
Pick two points on a line: P₁ = (x₁, y₁) and P₂ = (x₂, y₂).
The vertical distance between them is the difference in y-values: y₂ − y₁. This is the rise.
The horizontal distance between them is the difference in x-values: x₂ − x₁. This is the run.
Slope is rise over run:
m = (y₂ − y₁) / (x₂ − x₁)
Because a straight line has constant slope, this ratio is the same for any two distinct points on the line.
When to Use the Slope Formula
Use the slope formula when you have two distinct points on a straight line. Common situations include coordinates given on a graph, two endpoints of a line segment, calculating road grade from elevation and horizontal distance, or finding the rate of change between two values in a data table.
The formula works for any straight line except a vertical one. A vertical line returns "undefined" because the denominator becomes zero.
The output of the formula tells you the direction of the line:
Positive value: the line rises from left to right.
Negative value: the line falls from left to right.
Zero: the line is horizontal.
Undefined: the line is vertical.
📜 Did You Know?
The idea of slope predates the coordinate plane by centuries. Roman engineers measured aqueduct gradient using the same rise-over-run logic — typically a slope of 1 in 4,800 (about 0.02%) to keep water flowing at the right speed without eroding the channel. The formula came later, but the concept was a survival tool for civil engineering long before it was algebra.
How to Find the Slope of a Line - Worked Examples
Example 1: Both Coordinates Positive
Find the slope of the line through (1, 2) and (4, 8).
Identify the values: x₁ = 1, y₁ = 2, x₂ = 4, y₂ = 8.
Substitute into the formula:
m = (8 − 2) / (4 − 1) = 6 / 3 = 2
Answer: m = 2
Example 2: Negative Coordinates
Find the slope of the line through (−2, 5) and (3, −5).
Identify the values: x₁ = −2, y₁ = 5, x₂ = 3, y₂ = −5.
Substitute into the formula:
m = (−5 − 5) / (3 − (−2)) = −10 / 5 = −2
Subtracting a negative becomes addition: 3 − (−2) = 3 + 2 = 5.
Answer: m = −2
Example 3: Slope From Decimal Coordinates
Find the slope of the line through (1.5, 2) and (3.5, 6).
Identify the values: x₁ = 1.5, y₁ = 2, x₂ = 3.5, y₂ = 6.
Substitute into the formula:
m = (6 − 2) / (3.5 − 1.5) = 4 / 2 = 2
The formula handles decimals the same way it handles integers.
Answer: m = 2
Four Ways to Find the Slope of a Line
The slope of a line can be found from coordinates, a graph, an equation, or an angle. All four methods give the same answer for the same line.
Method 1: From Two Points (Slope Formula)
This is the default method, shown in Examples 1–3 above. Apply the formula m = (y₂ − y₁) / (x₂ − x₁) to any two points on the line.
Use this method when coordinates are given.
Method 2: From a Graph (Rise Over Run)
Pick two clear points on the line where it crosses grid intersections. Count the vertical squares between them (rise) and the horizontal squares (run). Divide rise by run.
For example, if a line rises 4 squares and runs 2 squares between two clear points, the slope is 4 / 2 = 2.
Use this method when the line is drawn on a grid but the coordinates aren't labeled.
Method 3: From the Equation of a Line
The slope can be read directly from a line equation, depending on the form.
Slope-intercept form (y = mx + b): the slope is the coefficient of x.
Example: y = 3x − 7 → slope = 3.
Standard form (Ax + By + C = 0): slope = −A / B.
Example: 2x + 4y − 8 = 0 → slope = −2 / 4 = −1/2.
Use this method when the line is given as an equation, not as points.
Method 4: From the Angle of Inclination
If a line makes angle θ with the positive x-axis, slope = tan θ.
A line at 45°: slope = tan 45° = 1.
A horizontal line at 0°: slope = tan 0° = 0.
A vertical line at 90°: slope = tan 90° = undefined.
This method connects geometry and algebra. The slope value directly encodes the angle of the line.
Types of Slope: Positive, Negative, Zero, and Undefined
Every slope falls into one of four categories.
Positive Slope
When m > 0, the line rises from left to right. A larger positive m means a steeper rise. A line with m = 5 is steeper than a line with m = 1.
Negative Slope
When m < 0, the line falls from left to right. A more negative m means a steeper drop. A line with m = −5 is steeper than a line with m = −1.
Zero Slope (Horizontal Line)
When m = 0, the line is flat — parallel to the x-axis. Its equation is y = c, where c is a constant.
Example: y = 4 is a horizontal line passing through (0, 4).
Undefined Slope (Vertical Line)
When two points on a line share the same x-coordinate, the formula gives a denominator of zero. Division by zero is undefined, so the slope is undefined. Its equation is x = c, where c is a constant.
Example: x = 3 is a vertical line passing through (3, 0).
Slope Type | Value | Direction | Equation Form |
|---|---|---|---|
Positive | m > 0 | Rises left to right | y = mx + b, m positive |
Negative | m < 0 | Falls left to right | y = mx + b, m negative |
Zero | m = 0 | Horizontal | y = c |
Undefined | Division by zero | Vertical | x = c |
Why a Vertical Line Has Undefined Slope (Not Zero, Not Infinity)
A vertical line has undefined slope, not zero and not infinity. Here's why.
Take any two points on a vertical line: (3, 1) and (3, 7).
Apply the formula:
m = (7 − 1) / (3 − 3) = 6 / 0
Division by zero is undefined in mathematics. There is no number n where 0 × n = 6. Mathematicians call this case "undefined" — not "zero," because the line clearly isn't flat, and not "infinity," because infinity is not a real number that can be used in further calculations.
Compare this to a horizontal line. Take (1, 4) and (7, 4):
m = (4 − 4) / (7 − 1) = 0 / 6 = 0
Defined and equal to zero.
Vertical and horizontal slopes are opposite cases — perfectly steep versus perfectly flat.
Slope of Parallel and Perpendicular Lines
The slope formula extends to two related conditions: parallelism and perpendicularity.
Parallel lines have equal slopes.
If line 1 has slope m₁ = 3, then any line parallel to it also has slope 3. Parallel lines never meet because they rise and fall at the same rate.
Example: y = 3x + 2 and y = 3x − 5 are parallel. Same slope, different y-intercepts.
Perpendicular lines have slopes whose product is −1.
If line 1 has slope m₁ and line 2 is perpendicular to it, then m₁ × m₂ = −1. This means m₂ is the negative reciprocal of m₁.
Example: if m₁ = 2, then m₂ = −1/2. Check: 2 × (−1/2) = −1.
A horizontal line (slope 0) and a vertical line (undefined slope) are perpendicular by direction, but the multiplication rule doesn't apply because of the undefined slope.
Common Mistakes With the Slope Formula
The slope formula is straightforward to apply, but four mistakes account for most errors.
Reversing the order of subtraction inconsistently. Take points (2, 3) and (5, 9). The correct slope is m = (9 − 3) / (5 − 2) = 6 / 3 = 2. A common error is m = (3 − 9) / (5 − 2) = −6 / 3 = −2 — subtracting in one order in the numerator and the opposite order in the denominator. The fix: pick which point is (x₂, y₂) once, and stay consistent. Either order works as long as the numerator and denominator follow the same one.
Putting Δx on top instead of Δy. The formula is rise over run. The y-values describe vertical change ("rise") and go on top. The x-values describe horizontal change ("run") and go on the bottom. m = (y₂ − y₁) / (x₂ − x₁), not the reverse.
Treating "undefined" as the same as "zero." A vertical line has undefined slope. A horizontal line has a slope of 0. They are opposite cases — a horizontal line is perfectly flat, a vertical line is perfectly steep.
Forgetting to handle negative coordinates. Take points (−2, 4) and (3, −1). Subtracting a negative becomes addition:
m = (−1 − 4) / (3 − (−2)) = −5 / (3 + 2) = −5 / 5 = −1
The fix: rewrite "− (−2)" as "+ 2" before simplifying. Treat each subtraction in isolation.
Real-World Applications of the Slope Formula
The slope formula appears in any field that measures steepness or rate of change.
Civil engineering and roads. Road gradient is slope expressed as a percentage. A 6% road grade means 6 units of rise for every 100 units of run — slope = 0.06. Most highways have grades under 6%; mountain passes can reach 10–12%.
Construction and architecture. Roof pitch is the slope of a roof, expressed as rise over a 12-unit run. A "4 in 12" pitch means 4 units of rise for every 12 units of run — slope ≈ 0.33.
Wheelchair ramps. The Americans with Disabilities Act requires a maximum slope of 1:12 — about 0.083 — for accessibility ramps.
Data and rates of change. In a graph of distance over time, slope = speed. In a graph of cost over quantity, slope = cost per unit. The formula generalizes to any two-variable relationship where one quantity changes with respect to another.
Related Formulas and Line Equations
The slope formula connects to several other formulas used with linear equations.
Formula | What It Does | When to Use It |
|---|---|---|
Slope formula: m = (y₂ − y₁) / (x₂ − x₁) | Finds slope from two points | When you have two coordinates |
Slope-intercept form: y = mx + b | Equation of a line using slope and y-intercept | When writing or graphing a line equation |
Point-slope form: y − y₁ = m(x − x₁) | Equation of a line using slope and one point | When you know one point and the slope |
Standard form: Ax + By + C = 0 | General form of a linear equation | When converting between forms; m = −A / B |
Parallel lines: m₁ = m₂ | Two lines with equal slopes never meet | To check if two lines are parallel |
Perpendicular lines: m₁ × m₂ = −1 | Two slopes whose product is −1 | To check if two lines meet at 90° |
Angle from slope: θ = arctan(m) | Angle a line makes with the positive x-axis | When converting slope to angle |
These formulas all work with the same coordinate plane and the same definition of slope. Together they cover most line-related problems in algebra and coordinate geometry, including those covered in Common Core 8.F.B.4 and NCERT Class 9 Coordinate Geometry.
Was this article helpful?
Your feedback helps us write better content



