Distance & Midpoint
Find the distance between two points (x₁,y₁) and (x₂,y₂).
About this topic
Distance Formula The straight-line distance between two points.
The distance formula is derived from the Pythagorean theorem. It measures the length of the straight line segment that connects two points in a coordinate plane.
Key formulas & rules
- •Formula: d = √((x₂ − x₁)² + (y₂ − y₁)²)
- •Also written: d = √(Δx² + Δy²)
- •Always non-negative: d ≥ 0
- •d = 0 if and only if the points are identical
- •Derived from Pythagoras with legs Δx and Δy
- •Extends to 3D: d = √(Δx² + Δy² + Δz²)
Examples
| Input | Output | Note |
|---|---|---|
| (0,0) → (3,4) | 5 | Pythagorean triple |
| (1,1) → (4,5) | 5 | Same distance, shifted |
| (-2,-3) → (2,1) | 5.657 | √32 |
| (0,0) → (1,1) | 1.414 | √2 |
Real-world uses
Midpoint Formula The point exactly halfway between two others.
The midpoint is found by averaging the x and y coordinates of the two endpoints. It lies exactly at the center of the line segment connecting them.
Key formulas & rules
- •Formula: M = ((x₁ + x₂)/2, (y₁ + y₂)/2)
- •Midpoint divides the segment into two equal halves
- •Distance from M to each endpoint is d/2
- •Works in 2D and 3D (average all coordinates)
- •Midpoint of the diagonal of a rectangle = center
- •Special case: segment bisector
Examples
| Input | Output | Note |
|---|---|---|
| (0,0) & (4,6) | (2, 3) | Simple average |
| (-5,-2) & (4,3) | (-0.5, 0.5) | Negative coord |
| (3,4) & (7,10) | (5, 7) | Both positive |
| (2,-8) & (-6,4) | (-2, -2) | Across axes |
Real-world uses
Slope of the Line The rise-over-run between two points.
The slope measures how steeply the line between two points rises or falls. It's a critical value for understanding the linear relationship between coordinates.
Key formulas & rules
- •Formula: m = (y₂ − y₁) / (x₂ − x₁)
- •Horizontal line: m = 0
- •Vertical line: m is undefined (÷ by 0)
- •Positive m → rises left-to-right
- •Negative m → falls left-to-right
- •Slope = tan(θ) where θ is the angle from the x-axis
Examples
| Input | Output | Note |
|---|---|---|
| (0,0) → (2,4) | m = 2 | Steep up |
| (0,4) → (2,0) | m = -2 | Steep down |
| (1,1) → (5,1) | m = 0 | Horizontal |
| (3,0) → (3,5) | Undefined | Vertical |
Real-world uses
Real-World Uses Where these formulas solve real problems.
Distance, midpoint, and slope appear throughout modern technology — from the games you play to the maps you use. They form the geometric backbone of any system dealing with 2D or 3D coordinates.
Key formulas & rules
- •Distance: satellite ↔ receiver GPS triangulation
- •Midpoint: finding map centers, dividing routes
- •Slope: road grade, ramp angles, roof pitch
- •Distance: collision detection in games
- •Midpoint: symmetry detection in images
- •Slope: trend lines in data science
Examples
| Input | Output | Note |
|---|---|---|
| GPS fix | Distance via triangulation | Satellite system |
| Video game | Collision distance check | Every frame |
| Data science | Slope of regression line | Trend analysis |
| Architecture | Roof pitch | Slope application |
Real-world uses
Modes & formulas
Distance & Midpoint
The distance formula creates a right triangle with legs Δx and Δy, making the distance the hypotenuse. The midpoint is simply the average of the x's and y's.
Slope
If the x-coordinates are the same, the line is vertical, and the slope is undefined (division by zero).