Slope of a line
Give two points, or the equation ax + by = c: we find the slope, the equation y = mx + b and the angle.
Result
2Slope m
- Equation
- y = 2x
- y-intercept
- 0
- Crosses the x-axis at
- 0
- Angle with the x-axis
- 63.43°
Line graph
y = 2xAB
How it is calculated
- Slope m = (y2 − y1) ÷ (x2 − x1) (rise over run).
- y-intercept = y1 − m × x1.
- From ax + by = c: m = −a ÷ b and the intercept is c ÷ b.
- If x1 = x2 (or b = 0), the line is vertical: it has no slope.
Example
Points (1, 2) and (3, 6): m = (6 − 2) ÷ (3 − 1) = 2, equation y = 2x.
Good to know
- Two identical points do not define a line.
- The angle is in degrees, between −90° and 90°.
When to use it
- Get the equation y = mx + b of the line through two points on a graph.
- Turn a slope into a gradient in % or an angle, for a ramp, a roof or a road.
- For the length of the segment between the two points, use Distance between two points (2D or 3D).
Frequently asked questions
How do I turn a slope into a percentage grade?
Multiply the slope by 100. A slope of 0.1 is a 10% grade: the line rises 10 units for every 100 units across.
What is the slope of a perpendicular line?
It is −1 ÷ m. A line with slope 2 is perpendicular to any line with slope −0.5. Parallel lines share the same slope.
What does a negative slope mean?
The line goes down from left to right. A slope of 0 is a flat, horizontal line.