Line Through Two Points
Enter two points and get everything about the straight line through them: the slope (rise over run), the equation in slope-intercept, point-slope and standard form, the distance between the points, the midpoint and the angle, with every step and a graph.
What Is the Slope of a Line?
The slope tells how steep a line is: how much it goes up (the rise, Δy) for every step to the right (the run, Δx). A slope of 3/4 means: 4 to the right, 3 up. A negative slope goes down to the right, a slope of 0 is flat, and a vertical line has no slope at all, because the run is 0 and you cannot divide by 0.
Two points fix exactly one straight line. With the slope m known, the y-intercept b (where the line crosses the y-axis) follows from either point, giving the familiar y = mx + b. The distance between the points comes from Pythagoras: the run and the rise are the two short sides of a right triangle.
Graph
lineStep-by-Step Solution
Worked Techniques
Find the slope first, then put one point into y = mx + b to find b.
The run and the rise are the legs of a right triangle; the distance is its hypotenuse.
Average the x-coordinates and average the y-coordinates.
Sources & Verification
- M. Sullivan, Algebra and Trigonometry, 10th ed., Pearson, 2016 — Sec. 2.1 (distance and midpoint formulas) and Sec. 2.3 (lines: slope, point-slope, slope-intercept and general form).
- J. Stewart, L. Redlin & S. Watson, Precalculus: Mathematics for Calculus, 7th ed., Cengage, 2016 — Sec. 1.10 (lines; parallel and perpendicular lines).
Frequently Asked Questions
How do you find the slope between two points?
Divide the rise by the run: m = (y₂ − y₁) / (x₂ − x₁). For A(1, 2) and B(5, 5) the run is 5 − 1 = 4 and the rise is 5 − 2 = 3, so the slope is 3/4 = 0.75: for every 4 steps to the right the line goes 3 up. It does not matter which point you call A, as long as you subtract in the same order on top and at the bottom.
How do you find the equation of a line through two points?
Find the slope, then the y-intercept b. Example: (2, 3) and (6, 11).
1. Slope: m = (11 − 3) / (6 − 2) = 8 / 4 = 2.
2. Put one point into y = mx + b: 3 = 2 · 2 + b, so b = −1.
3. The equation is y = 2x − 1. Check with the other point: 2 · 6 − 1 = 11.
How do you calculate the distance between two points?
Use the distance formula, which is Pythagoras: d = √((x₂ − x₁)² + (y₂ − y₁)²). For (2, 3) and (6, 11): d = √(4² + 8²) = √80 = 4√5 ≈ 8.944. For (1, 2) and (5, 5) the run 4 and rise 3 give the famous 3-4-5 triangle: the distance is exactly 5.
How do you find the midpoint of two points?
Average the x-coordinates and average the y-coordinates: M = ((x₁ + x₂)/2, (y₁ + y₂)/2). The midpoint of (2, 3) and (6, 11) is (4, 7); of (1, 2) and (5, 5) it is (3, 7/2) = (3, 3.5).
What is the slope of a horizontal or a vertical line?
A horizontal line has slope 0: the rise is 0, and its equation is y = b, for example y = 3 through (−2, 3) and (4, 3). A vertical line has an undefined slope, because the run is 0 and you cannot divide by 0. Its equation is x = a, for example x = 2 through (2, −1) and (2, 5).
How do you turn a slope into an angle or a percentage grade?
The grade is the slope times 100%, and the angle is arctan(slope). A road that climbs 12 m over 200 m has slope 12/200 = 0.06, a grade of 6% and an angle of arctan(0.06) ≈ 3.43°. A slope of 1 is a 100% grade and a 45° angle.
What is the slope of a perpendicular line?
Perpendicular slopes multiply to −1: flip the slope and change its sign. A line with slope 3/4 is perpendicular to every line with slope −4/3. Parallel lines have the same slope.