Read in: English · Français · Español · العربية · 中文
If you have ever typed “how to find the slope of a line” into Google the night before a test, this guide is for you. Below are the key formulas, five worked examples, common mistakes and a practice set with answers.
What is the slope of a line?
Slope measures how steep a line is and whether it goes up or down (LearnAlberta; Wolfram MathWorld). It is the ratio of the rise (vertical change) to the run (horizontal change) (OpenStax Elementary Algebra 2e; Lumen Learning).
For two points (x1, y1) and (x2, y2), the slope formula is (OpenStax; LibreTexts):
m = rise / run = (y2 − y1) / (x2 − x1)
In everyday words: slope tells you how much y changes for each change in x. A slope of 2 means “up 2 for every 1 to the right.”
The four kinds of slope
| Slope | What the line does (left to right) | Example |
|---|---|---|
| Positive | Rises | y = 2x + 1 |
| Negative | Falls | y = −3x + 4 |
| Zero | Horizontal | y = 5 |
| Undefined | Vertical | x = 3 |
These four cases are described the same way by OpenStax and West Texas A&M’s Virtual Math Lab: a horizontal line has slope 0 and a vertical line has an undefined slope, because its run is 0 and we cannot divide by zero.
Linear functions and y = mx + b
A line with slope m and y-intercept (0, b) can be written in slope-intercept form: y = mx + b (OpenStax Intermediate Algebra 2e; Wolfram MathWorld). When an equation is solved for y, the number in front of x is the slope (OpenStax; Lumen Learning).
Two different non-vertical lines with the same slope and different y-intercepts are parallel (OpenStax; Lumen Learning). For example, y = 2x + 5 and y = 2x − 1 never meet.
Want a refresher on functions first? See our free lesson on functions, domain and range, and our lesson on solving linear equations.
How to find the slope of a line: worked examples
Example 1: Two points with positive slope
Find the slope through (1, 2) and (4, 8).
Step 1: rise = y2 − y1 = 8 − 2 = 6.
Step 2: run = x2 − x1 = 4 − 1 = 3.
Step 3: m = 6 / 3 = 2.
Example 2: Negative numbers
Find the slope through (−2, 5) and (3, −5).
Step 1: rise = −5 − 5 = −10.
Step 2: run = 3 − (−2) = 3 + 2 = 5.
Step 3: m = −10 / 5 = −2. The line falls from left to right.
Example 3: Reading y = mx + b
For y = 3x − 4: the slope is m = 3 and the y-intercept is b = −4, so the line crosses the y-axis at (0, −4).
Check with a table: x = 0 gives y = −4; x = 1 gives y = −1; x = 2 gives y = 2. Each time x goes up by 1, y goes up by 3. ✔
Example 4: Writing the equation of a line
Find the equation of the line through (0, 1) and (2, 7).
Step 1: m = (7 − 1) / (2 − 0) = 6 / 2 = 3.
Step 2: the point (0, 1) is on the y-axis, so b = 1.
Step 3: y = 3x + 1.
Check: x = 2 gives y = 3(2) + 1 = 7. ✔
Example 5: A real-life linear function
Imagine a phone plan that costs a fixed $20 per month plus $5 for each gigabyte (GB) of data. The cost is C = 5g + 20, where g is the number of GB.
Slope = 5 (dollars per GB); y-intercept = 20 (the cost with no data).
For 3 GB: C = 5(3) + 20 = 15 + 20 = $35.
Common mistakes to avoid
- Mixing the order of the points. If you start with y2 on top, start with x2 on the bottom too.
- Putting run over rise. Slope is change in y over change in x.
- Sign errors with negatives. 3 − (−2) is 5, not 1.
- Confusing zero and undefined. Horizontal line → slope 0; vertical line → undefined slope.
- Reading m from an unsolved equation. In 2y = 6x + 4, the slope is not 6: divide by 2 first to get y = 3x + 2, so m = 3.
Practice set (with answers)
- Find the slope through (2, 3) and (6, 11).
- Find the slope through (−1, 4) and (5, 1).
- What are the slope and y-intercept of y = −4x + 7?
- Write the equation of the line through (0, −2) and (3, 4).
- What is the slope of the line through (5, 2) and (5, 9)?
Answers: 1) m = 8 / 4 = 2. 2) m = −3 / 6 = −1/2 (or −0.5). 3) slope −4, y-intercept 7. 4) m = 6 / 3 = 2 and b = −2, so y = 2x − 2. 5) The run is 5 − 5 = 0, so the slope is undefined (a vertical line).
For more practice, try our free Grade 9 maths practice or play the Grade 9 Maths Kahoot games. Curious where algebra came from? Read Al-Khwarizmi: The Baghdad Scholar Who Gave Us the Word “Algebra”, or see your full maths learning path with Dualingua. Discover all our courses and free tools on Dualingua.
Stuck on slope or graphs? Our excellent teachers can help — book your free 20-minute assessment.
FAQ
Does it matter which point I call the first point?
No. You get the same slope, as long as you use the same order on top and bottom.
What does b mean in y = mx + b?
b is the y-intercept: the value of y when x = 0, where the line crosses the y-axis.
Why is the slope of a vertical line undefined?
All points on a vertical line have the same x, so the run is 0. Division by zero is not defined, so the slope is undefined.
Get help with maths
- Book your free assessment (free 20-minute assessment)
- Email: info@dualingua.com
- WhatsApp: +1 613 894 3799
Sources
- OpenStax, “4.4 Understand Slope of a Line – Elementary Algebra 2e”: https://openstax.org/books/elementary-algebra-2e/pages/4-4-understand-slope-of-a-line
- OpenStax, “3.2 Slope of a Line – Intermediate Algebra 2e”: https://openstax.org/books/intermediate-algebra-2e/pages/3-2-slope-of-a-line
- Wolfram MathWorld, “Slope”: https://mathworld.wolfram.com/Slope.html
- LearnAlberta, “Slope”: https://www.learnalberta.ca/content/memg/Division04/Slope/index.html
- Mathematics LibreTexts, “Slope”: https://math.libretexts.org/Courses/Lake_Tahoe_Community_College/Supplemental_Lecture_Notes/Beginning_Algebra/Functions_and_Graphs/Slope
- Lumen Learning, “Slope of a Line | Beginning Algebra”: https://courses.lumenlearning.com/suny-beginalgebra/chapter/read-or-watch-find-slope-from-a-graph
- West Texas A&M University Virtual Math Lab, “Tutorial 25: Slope of a Line”: https://wtamu.edu/academic/anns/mps/math/mathlab/col_algebra/col_alg_tut25_slope.htm
Last checked: November 22, 2026
