Coordinate Geometry Calculator | Distance & Slope
Calculate distance, midpoint, slope, line equation, angle, section point, and triangle area from coordinates. Includes an interactive coordinate plane diagram, triangle analysis (centroid, inradius, circumradius), and step-by-step working.
Quick presets:
P₁
P₂
Section ratio m:n (divides P₁P₂ internally)
Press Enter to calculate · Esc to reset
What Is the Coordinate Geometry Calculator | Distance & Slope?
Coordinate geometry (also called analytic geometry) is the study of geometric shapes using a numerical coordinate system, the Cartesian plane introduced by René Descartes in 1637. It bridges algebra and geometry by expressing every geometric property as an equation, making it possible to compute distances, angles, areas, and intersections using arithmetic alone.
This calculator covers two modes. Two Points computes every property of the segment P₁P₂, distance, midpoint, slope, full line equation, angle, perpendicular slope, and the internal section point at any ratio m:n. Triangle (3 Points) computes area via the shoelace formula, perimeter, centroid, inradius, circumradius, and classifies the triangle by both its sides and angles.
Formula
Two-Point Formulas, P₁(x₁, y₁) and P₂(x₂, y₂)
Distance: d = √((x₂−x₁)² + (y₂−y₁)²)
Midpoint: M = ((x₁+x₂)/2, (y₁+y₂)/2)
Slope: m = (y₂−y₁) / (x₂−x₁)
Line equation: y = mx + b, where b = y₁ − mx₁
Angle (x-axis): θ = arctan(m) in degrees
Perp. slope: m⊥ = −1/m
Section (m:n): S = ((mx₂+nx₁)/(m+n), (my₂+ny₁)/(m+n))
Triangle Area (with origin O):
A = |x₁y₂ − x₂y₁| / 2
Triangle Formulas, A(x₁,y₁), B(x₂,y₂), C(x₃,y₃)
Area (Shoelace): A = |( x₂−x₁)(y₃−y₁) − (x₃−x₁)(y₂−y₁)| / 2
Centroid: G = ((x₁+x₂+x₃)/3, (y₁+y₂+y₃)/3)
Inradius: r = Area / s, where s = Perimeter/2
Circumradius: R = (a·b·c) / (4·Area)
| Symbol | Meaning | Formula / Notes |
|---|---|---|
| d | Distance between two points | √((x₂−x₁)²+(y₂−y₁)²) |
| M | Midpoint | ((x₁+x₂)/2, (y₁+y₂)/2) |
| m | Slope of a line | (y₂−y₁)/(x₂−x₁) |
| b | y-intercept | y₁ − m·x₁ |
| θ | Angle with positive x-axis | arctan(m) in degrees |
| m⊥ | Slope of perpendicular line | −1/m (negative reciprocal) |
| S | Section point at ratio m:n | ((mx₂+nx₁)/(m+n), ...) |
| G | Centroid of triangle | (Σx/3, Σy/3) |
| r | Inradius (inscribed circle) | Area / semi-perimeter |
| R | Circumradius (circumscribed circle) | (a·b·c) / (4·Area) |
How to Use
- 1Select mode: "Two Points" for line-segment properties; "Triangle (3 Points)" for full triangle analysis.
- 2Use a preset (optional): Tap any quick preset to load a worked example with typical coordinates.
- 3Enter coordinates: Type x and y values for each point. Decimals and negatives are supported.
- 4Set section ratio: (Two Points mode) Enter m:n to find the point that divides P₁P₂ internally, default 1:1 gives the midpoint.
- 5Calculate: Press the button or hit Enter. The coordinate plane diagram updates automatically.
- 6Read results: Check primary cards (distance, midpoint/area), stat cards for slope and angle, and the line equation box.
- 7Show steps: Toggle "Show step-by-step working" to see every formula applied to your specific values.
Example Calculation
Example 1, Two Points: P₁(2, 3) and P₂(8, 7)
Distance = √((8−2)²+(7−3)²) = √(36+16) = √52 ≈ 7.2111
Midpoint = ((2+8)/2, (3+7)/2) = (5, 5)
Slope = (7−3)/(8−2) = 4/6 = 0.6667
y-intercept = 3 − 0.6667×2 = 1.6667
Line: y = 0.6667x + 1.6667
Angle = arctan(0.6667) ≈ 33.69°
Perpendicular slope = −1/0.6667 = −1.5
Section 2:1 = ((2×8+1×2)/3, (2×7+1×3)/3) = (6, 5.667)
Example 2, Triangle: A(0,0), B(4,0), C(0,3)
AB = 4, BC = 5, CA = 3 (3-4-5 right triangle)
Perimeter = 12
Area = |(4−0)(3−0) − (0−0)(0−0)| / 2 = 12/2 = 6
Centroid G = ((0+4+0)/3, (0+0+3)/3) = (1.333, 1)
Semi-perimeter s = 6
Inradius r = 6/6 = 1
Circumradius R = (4×5×3)/(4×6) = 2.5
Type: Scalene, Right triangle
Example 3, Section Formula: Dividing P₁P₂ in ratio 3:1
P₁ = (1, 2), P₂ = (5, 6), ratio m:n = 3:1
S_x = (3×5 + 1×1) / (3+1) = 16/4 = 4
S_y = (3×6 + 1×2) / (3+1) = 20/4 = 5
Section point S = (4, 5)
Check: S is three-quarters of the way from P₁ to P₂ ✓
Understanding Coordinate Geometry | Distance & Slope
The Origin of Coordinate Geometry
When René Descartes published La Géométrie in 1637, he changed mathematics forever. By assigning each point in the plane a pair of numbers (x, y), every geometric problem became an algebraic one. A circle was no longer just a shape, it was x² + y² = r². A line was y = mx + b. This unification allowed mathematicians to apply the power of algebra to geometry, and vice versa. Today, coordinate geometry underpins everything from GPS systems to computer graphics rendering to machine learning feature spaces.
Understanding the Distance Formula
The distance formula is a direct application of the Pythagorean theorem. Given two points P₁(x₁, y₁) and P₂(x₂, y₂), you can always draw a right triangle with the horizontal leg Δx = x₂ − x₁ and the vertical leg Δy = y₂ − y₁. The straight-line distance d is then the hypotenuse:
d = √(Δx² + Δy²)
This works for any two points regardless of quadrant. For the classic 3-4-5 triangle (P₁ = (0,0), P₂ = (3,4)): d = √(9+16) = √25 = 5. The formula generalises to any number of dimensions simply by adding more squared-difference terms under the radical.
Slope, Intercept, and Line Equations
The slope m = (y₂−y₁)/(x₂−x₁) describes how steeply a line rises or falls. It is the "rise over run" , how many units the line moves vertically for each unit it moves horizontally. From the slope and one known point, the full line equation follows immediately via the point-slope form y − y₁ = m(x − x₁), which rearranges to slope-intercept form y = mx + b.
| Slope value | Line direction | Example | Angle (°) |
|---|---|---|---|
| m = 0 | Horizontal | y = 3 | 0° |
| 0 < m < 1 | Gentle rise | y = 0.5x + 1 | 0°–45° |
| m = 1 | 45° diagonal | y = x | 45° |
| m > 1 | Steep rise | y = 3x − 2 | 45°–90° |
| m < 0 | Falls L→R | y = −2x + 4 | 90°–180° |
| undefined | Vertical | x = 5 | 90° |
The Section Formula, Dividing a Line Segment
The section formula solves a common problem: where exactly is the point that divides segment P₁P₂ in a given ratio m:n? The answer comes directly from weighted averaging:
- ›At m:n = 1:1 → midpoint (equal division)
- ›At m:n = 1:2 → one-third of the way from P₁ to P₂
- ›At m:n = 3:1 → three-quarters of the way from P₁ to P₂
- ›As m → ∞ (or n → 0) → the point approaches P₂
This is used in computer graphics for interpolation (lerp), in engineering for finding centre-of-mass points along a beam, and in GIS for placing markers at fractional positions along routes.
Triangle Analysis from Coordinates
Given the three vertices of a triangle, coordinate geometry makes it possible to compute every triangle property without measuring anything physically. The shoelace formula gives area directly from the vertex coordinates, no base or height needed. The centroid is just the coordinate average of the three vertices. The inradius and circumradius follow from area and side lengths.
| Triangle type (angles) | Criterion (side lengths) | Example |
|---|---|---|
| Acute | a² + b² > c² for all sides c | All angles < 90° |
| Right | a² + b² = c² (one pair) | 3-4-5, 5-12-13 |
| Obtuse | a² + b² < c² for longest side c | One angle > 90° |
Real-World Applications
- ›Navigation: GPS uses distance formulas (in spherical form) to compute routes between coordinates
- ›Computer graphics: slope and intercept drive line rasterisation (Bresenham's algorithm)
- ›Game development: collision detection uses distance checks between object centres
- ›Robotics: path planning uses section formulas to interpolate between waypoints
- ›Architecture and CAD: midpoints, perpendiculars, and area calculations for layout
- ›Data science: Euclidean distance in feature space for k-nearest-neighbour classification
Frequently Asked Questions
What is the difference between distance and displacement in coordinate geometry?
In the coordinate plane, distance is always positive, it measures how far apart two points are using the Pythagorean theorem: d = √(Δx² + Δy²).
- ›Distance is a scalar, it has no direction.
- ›Displacement is a vector, it has both magnitude (the distance) and direction (the angle θ).
- ›Two points can have the same distance from the origin but be in completely different directions.
This calculator computes Euclidean distance (straight-line distance), which is the most common in plane geometry.
How does the section formula differ from the midpoint formula?
The midpoint formula is a special case of the section formula at ratio 1:1:
- ›Midpoint (1:1): M = ((x₁+x₂)/2, (y₁+y₂)/2)
- ›Section point (m:n): S = ((mx₂+nx₁)/(m+n), (my₂+ny₁)/(m+n))
- ›At m=n=1: S = ((x₁+x₂)/2, (y₁+y₂)/2), identical to midpoint ✓
The section formula divides segment P₁P₂ at the ratio m:n from P₁. So m:n = 3:1 places the point three-quarters of the way from P₁ to P₂.
What does slope tell you about a line?
Slope (m) measures the rate of vertical change per unit of horizontal change:
- ›Positive slope: line rises from left to right (going uphill)
- ›Negative slope: line falls from left to right (going downhill)
- ›Zero slope: horizontal line (y = constant)
- ›Undefined slope: vertical line (x = constant), cannot be expressed as y = mx + b
- ›Steep slope (|m| > 1): changes faster vertically than horizontally
- ›Gentle slope (|m| < 1): changes slower vertically than horizontally
Two lines are parallel if their slopes are equal. Two lines are perpendicular if their slopes multiply to −1 (i.e., m₂ = −1/m₁).
How is the shoelace formula used to find triangle area?
The shoelace formula computes the signed area of any polygon from its vertex coordinates:
Area = |(x₂−x₁)(y₃−y₁) − (x₃−x₁)(y₂−y₁)| / 2
- ›Works for any triangle, regardless of orientation or position in the plane.
- ›The absolute value ensures area is always positive.
- ›If the result is 0, the three points are collinear, no triangle is formed.
- ›For a polygon with n vertices, the formula extends: A = |Σ(xᵢyᵢ₊₁ − xᵢ₊₁yᵢ)| / 2
What are the inradius and circumradius of a triangle?
- ›Inradius (r): radius of the largest circle that fits inside the triangle, touching all three sides. r = Area / s where s = (a+b+c)/2 is the semi-perimeter.
- ›Circumradius (R): radius of the circle that passes through all three vertices of the triangle. R = (a·b·c) / (4·Area).
- ›For a right triangle with hypotenuse c: R = c/2 (the circumradius equals half the hypotenuse).
- ›Euler's formula relates them: distance between incentre and circumcentre = √(R(R − 2r)).
How do I classify a triangle by its angles from coordinates?
Use the law of cosines to find each angle from the three side lengths:
cos(A) = (b² + c² − a²) / (2bc)
- ›All angles acute (cos > 0 for all): Acute triangle
- ›One angle = 90° (cos = 0 for that angle, verified when a² = b² + c²): Right triangle
- ›One angle obtuse (cos < 0 for that angle): Obtuse triangle
The calculator uses this automatically, just enter the three vertices and it classifies the triangle for you.
What is the centroid of a triangle and what does it represent?
The centroid G is the point where all three medians of the triangle intersect:
- ›G = ((x₁+x₂+x₃)/3, (y₁+y₂+y₃)/3), simply the average of the three vertices.
- ›The centroid divides each median in the ratio 2:1 from vertex to midpoint of opposite side.
- ›Physically: the centroid is the centre of mass (balancing point) of a uniform triangular lamina.
- ›The centroid always lies inside the triangle, regardless of the triangle type.
Can I use this calculator for 3D coordinate geometry?
This calculator works in the 2D Cartesian plane (x, y). For 3D problems (x, y, z):
- ›3D distance: d = √((x₂−x₁)² + (y₂−y₁)² + (z₂−z₁)²)
- ›3D midpoint: M = ((x₁+x₂)/2, (y₁+y₂)/2, (z₁+z₂)/2)
- ›Slopes do not generalise directly, lines in 3D are described by direction vectors.
- ›For 3D triangle area, use the cross product of two edge vectors: A = |AB × AC| / 2
All the 2D concepts extend naturally to 3D, though the visualisation becomes more complex. Use the Vector Calculator for 3D distance and cross product computations.