Somewhere on a mountain road there is a yellow sign showing a truck on a wedge and the number 12%. It means that for every 100 metres you travel horizontally, the road drops 12 metres. Over a kilometre of map distance that is a descent of metres, and the number on the sign is nothing more than the slope of a line written as a percentage: .
That is the whole idea. The slope of a straight line is rise over run, the vertical change divided by the horizontal change between any two of its points. If the points are and , the slope formula is
A slope of means you go up units for every unit you move right. A slope of means up three for every one across. A slope of means down two for every one across. The rest of this article is about how to find slope in practice, how it sits inside the equation of a line, and why such a simple ratio turns out to be one of the most heavily used numbers in mathematics.
What is the slope of a line?
Pick any two points on a straight line. Move from the left one to the right one. The horizontal distance you covered is the run, , and the vertical distance is the rise, . The Greek capital delta is just shorthand for “change in”. The slope is
What makes this a property of the line, rather than of the two points you picked, is similar triangles. Any two rise-and-run triangles drawn against the same straight line have the same angles, so their sides are in the same proportion: choose points twice as far apart and both rise and run double, leaving the ratio untouched.
The sign of tells you the direction at a glance:
- Positive slope (): the line rises from left to right. More means more .
- Negative slope (): the line falls from left to right. More means less .
- Zero slope (): the line is horizontal. Changing never changes .
- Undefined slope: the line is vertical. The run is zero, and the formula would divide by zero.
The size of the slope, , tells you how steep the line is. A line with is steeper than one with , and a line with is just as steep as , only falling instead of rising.
How do you find the slope from two points?
Take the points and . Label them and , then substitute:
Geometrically, you walk 4 units to the right and climb 2 units, as in Figure 1. The line through these two points crosses the -axis at , a number we will meet again in the next section.
Figure 1 — The line through (1, 2) and (5, 4). The dashed right triangle has run 4 and rise 2, so the slope is 2/4 = 1/2; the line meets the y-axis at b = 1.5, giving y = 0.5x + 1.5.
Does the order of the points matter? No, provided you use the same order on top and bottom. Swap the labels so that and :
Both differences change sign, and the two minus signs cancel. Algebraically, , which is the same fraction. What you must not do is mix orders, taking on top but underneath; that silently flips the sign of your answer.
A negative slope. Find the slope through and :
The line drops 10 units over a run of 5, so it falls 2 units for every unit to the right. The most common error here is the double negative in the denominator: , not . Writing the parentheses explicitly before simplifying avoids it.
A fractional result. Through and :
Leave slopes as fractions where you can. reads directly as “down 3, across 2”, which is exactly how you would plot it, while hides that instruction.
What is slope-intercept form y = mx + b?
Every non-vertical straight line can be written as
where is the slope and is the y-intercept, the height at which the line crosses the -axis. You can see why earns that name by setting : then , so the point is on the line.
For the line in Figure 1 we know . To find , substitute either point. Using :
So the line is . Check with the other point: . Correct.
The negative-slope example works the same way. With through : , so and the line is . Check : .
Reading and graphing. The appeal of is that both numbers can be read off directly. In the slope is and the intercept is , because the equation is ; watch that sign. To draw , start at the intercept . The slope says: up 2, right 3. That lands on , and repeating gives ; the third point checks the first two. For a negative slope such as , go down 3 and right 2: the numerator is always the vertical move and the denominator the horizontal one.
How do you find the equation of a line?
Slope-intercept form is convenient for reading a line, but it is not always the fastest way to build one. If you know a slope and one point , the definition of slope hands you the equation directly. Any other point on the line must satisfy
and multiplying both sides by gives point-slope form:
Example: a point and a slope. The line through with slope is . Expanding, , so .
Example: two points. This is the question students search for most often, and it is two steps. Find the equation of the line through and .
Step 1, the slope. We already computed .
Step 2, point-slope. Use :
Expanding gives , so
Check with the other point: . Correct. Starting from instead simplifies to the same line.
Standard form. A third common way to write a line is
with , , usually integers and . To convert , multiply through by 2 to clear fractions, , and move the term across:
Both original points check: and .
Standard form can describe vertical lines, which slope-intercept form cannot (take ).
Converting the other way. Take . Solve for : , so , with slope and -intercept . In general, solving for when gives
so the slope of a line in standard form is ; here , as found.
What is the slope of a horizontal or vertical line?
Horizontal lines. Take the line through and . The slope is
Every point on the line has , so its equation is simply . That is slope-intercept form with and . In general, the horizontal line through height is .
Vertical lines. Take the line through and . The formula gives
and division by zero is not defined. This is not a technicality to be worked around. Asking “what number satisfies ?” has no answer, because every number times zero is zero. So a vertical line has no slope; the usual phrase is that its slope is undefined.
Every point on this line has , so its equation is , and in general a vertical line is . It cannot be written as at all, since the single input corresponds to every possible . Keep the distinction straight: zero slope is a perfectly good number (a flat road), while undefined slope means the ratio does not exist (a wall).
How are the slopes of parallel and perpendicular lines related?
Parallel lines have the same steepness and never meet, so two non-vertical lines are parallel exactly when
and their intercepts differ. The lines and are parallel. All vertical lines are parallel to one another too, even though none of them has a slope.
Perpendicular lines meet at a right angle, and for two non-vertical lines the condition is
Each slope is the negative reciprocal of the other. Slope pairs with ; slope pairs with . The exception is the horizontal-vertical pair, which is perpendicular even though the vertical line has no slope to multiply.
Why the product is minus one. A line of slope points in the direction of the vector : one step right, steps up. Now rotate the plane a quarter-turn counterclockwise about the origin. That rotation sends each point to : east goes to north , and north goes to west . Every direction turns through exactly 90 degrees.
Apply the rotation to the direction vector :
The rotated vector is perpendicular to the original by construction. Its slope is rise over run, , provided . Multiply the two slopes and you get .
For the converse, suppose . The direction vectors and have dot product , and a zero dot product means a right angle. So the rule works in both directions. The dot product and the rotation map are both linear-algebra ideas; the article on vector spaces sets out the general framework.
Worked example. Find the lines through that are parallel and perpendicular to .
Parallel: same slope, . Point-slope gives , so .
Perpendicular: slope . Then , so .
Both pass through : and . And , as required.
How is slope related to angle and percent grade?
Draw a line making an angle with the positive -axis. In the rise-run triangle the rise is the side opposite and the run is the side adjacent to it, so by the definition of the tangent ratio
This is the bridge between algebra and trigonometry; the sine, cosine and tangent article develops the ratios and their inverses. Some benchmarks: , so a slope of 1 is a 45-degree line; ; , the angle of the line in Figure 1. As approaches , grows without bound, which is another way of seeing why a vertical line has no finite slope.
Percent grade. Engineers and road signs express slope as a percentage:
So the 12% sign from the opening means , and the angle of the road is
A 100% grade is not vertical; it is , a 45-degree slope. And going from a 10% grade to a 12% grade is a rise of 2 percentage points but a 20% increase in steepness, a distinction covered in percentage points vs percent.
The steepest street. Guinness World Records lists Baldwin Street in Dunedin, New Zealand, as the world’s steepest street, at a gradient of about 34.8%. The record briefly passed to Ffordd Pen Llech in Harlech, Wales, in July 2019, on a measured gradient of 37.45%. In April 2020 Guinness reinstated Baldwin Street after an appeal, having settled on measuring along the centreline of the road, by which Ffordd Pen Llech came out at 28.6%. In degrees, 34.8% is , still nowhere near 45 degrees.
Wheelchair ramps. The 2010 ADA Standards for Accessible Design (section 405.2) require that a ramp’s running slope be no steeper than 1:12, meaning at least 12 units of horizontal run for every unit of rise. As a slope that is
The standard also caps the rise of a single ramp run at 30 inches (section 405.6), and at 1:12 that rise needs inches of run, which is 30 feet, before a level landing.
What does slope mean as a rate of change?
When the axes carry units, the slope carries units too: units of per unit of . That turns the slope into a rate of change, which is where most of its practical importance comes from.
Speed from a distance-time graph. A car is 20 km from home at time and 260 km from home at hours, travelling at a steady speed. Plot distance against time and the slope of the line is
The slope is the speed. The -intercept, 20 km, is the starting distance, and the full equation is .
Cost per item. A print shop quotes 90 euros for 20 posters and 190 euros for 60 posters, and its pricing is linear. The slope is
That is the marginal cost: each extra poster adds 2.5 euros. The intercept follows from , giving . So the cost model is .
The intercept has a real meaning: it is the fixed cost, the 40 euros of setup you pay even for zero posters. A quote for 100 posters is euros. The average cost per poster, euros, is higher than the slope because the fixed cost is spread over the order; slope and average agree only when . Optimisation problems built entirely from linear relationships like this are the subject of linear programming.
What about curves and scattered data?
Curves: secants and tangents. On a curve, the slope between two points is no longer constant, but you can still draw the straight line through them, called a secant, and compute its slope. That number is the average rate of change over the interval. For between and :
Now slide the second point toward the first. The secant pivots and settles into the tangent line, and its slope settles to the slope of the curve at that single point, which for at is 2. Making that limiting process precise is the definition of the derivative, and it is treated properly in what is a derivative?. The thing to take from this article is that a derivative is a slope; calculus is the art of computing slopes of lines you cannot directly draw.
Data: the line of best fit. Real measurements rarely fall on one line. Given points , and , no single line passes through all three, but one line comes closest in the sense of minimising the sum of squared vertical errors. Its slope is
where and are the means. Here , , the numerator is and the denominator is , so and the line passes through , giving . The best-fit line is . The derivation and the interpretation of that slope as an estimated effect are in how linear regression works.
How do the distance and midpoint formulas fit in?
Slope tells you the direction between two points. Two companion formulas tell you how far apart they are and where the halfway point is, and both use the same differences and .
Distance. The run and rise are the legs of a right triangle whose hypotenuse joins the two points, so by the Pythagorean theorem
For and , the triangle in Figure 1, the legs are 4 and 2:
Midpoint. The point halfway between is the average of the coordinates:
For the same two points, . It lies on the line, as it must: .
Where did slope and the letter m come from?
Slope as a number needs coordinates, and coordinates date from the 1630s. René Descartes published La Géométrie in 1637 as an appendix to his Discourse on Method, showing how geometric curves could be described by algebraic equations. Pierre de Fermat developed similar methods independently in his Ad locos planos et solidos isagoge (Introduction to Plane and Solid Loci), which circulated in manuscript around 1636 to 1637 but was not printed until 1679, after his death. Fermat showed that an equation of the first degree in two unknowns describes a straight line, which is the seed of everything in this article. Neither man used the clean picture of two perpendicular number lines with negative values that students now draw; that convention settled over the following century and a half.
The letter has a more uncertain story. You will often read that it comes from the French monter, “to climb”. There is no evidence for this. Jeff Miller’s Earliest Uses of Symbols of Geometry, hosted by the MacTutor archive at St Andrews, states that it is not known why was chosen and that the choice may have been arbitrary; it traces the monter remark to a high-school textbook that itself called the link unsupported, and notes that Descartes did not use . The earliest use of that Miller records is in Vincenzo Riccati’s 1757 Opuscula, which writes a first-degree equation as . Matthew O’Brien used in 1842 and 1844, George Salmon used in his widely read Treatise on Conic Sections from 1848, and the notation spread through British and then American textbooks. It never became universal: Swedish and Russian textbooks commonly use for slope, and Dutch textbooks often write .
Point-slope form has a recorded early sighting too: Carl Boyer’s History of Analytic Geometry points to Gaspard Monge’s memoir on cuts and fills (déblais et remblais), printed in the Paris Academy’s volume for 1781, as perhaps the first place the modern point-slope equation of a line appears explicitly.
The ratio is old, the notation is a historical accident, and the idea underneath is the one on the yellow road sign: how much up for how much across. Learn to compute it from two points, read it from , and recognise it as a rate with units, and you have the tool that analytic geometry, calculus and statistics all build on.
Related topics: What Is a Derivative? The Difference Quotient Explained, How Does Linear Regression Work? Least Squares From Scratch, Sine, Cosine and Tangent, The Pythagorean Theorem Explained, Linear Programming, Vector Spaces, Percentage Points vs Percentage Change
Frequently asked
What is the slope formula?
For two points (x1, y1) and (x2, y2) on a line, the slope is m = (y2 - y1) / (x2 - x1). The top is the rise, the vertical change, and the bottom is the run, the horizontal change. For the points (1, 2) and (5, 4) the slope is 2 divided by 4, which is 1/2.
How do you find the slope from two points?
Subtract the y-coordinates, subtract the x-coordinates in the same order, and divide the first difference by the second. The order of the points does not matter as long as you use the same order on top and bottom, because swapping both points flips the sign of numerator and denominator together and the fraction is unchanged.
What does y = mx + b mean?
It is the slope-intercept form of a straight line. The number m is the slope, the change in y for every increase of 1 in x, and b is the y-intercept, the value of y where the line crosses the y-axis at x = 0. In y = 0.5x + 1.5 the line rises half a unit per unit to the right and crosses the y-axis at 1.5.
What is the slope of a horizontal and a vertical line?
A horizontal line has slope 0, because the rise between any two of its points is zero; its equation is y = c. A vertical line has undefined slope, because the run between any two of its points is zero and the slope formula would require dividing by zero; its equation is x = c and it cannot be written in the form y = mx + b.
How do you find the equation of a line from two points?
First compute the slope m from the two points. Then substitute m and either point into the point-slope form y - y1 = m(x - x1) and simplify. For (-1, 4) and (3, -2) the slope is -6/4 = -3/2, and the line is y = -1.5x + 2.5, or 3x + 2y = 5 in standard form.
How are the slopes of perpendicular lines related?
Two non-vertical lines are perpendicular exactly when the product of their slopes is -1, so each slope is the negative reciprocal of the other. A line of slope 2 is perpendicular to every line of slope -1/2. The rule follows from rotating a direction vector (1, m) by 90 degrees, which gives (-m, 1) and hence slope -1/m.