Last verified · v1.0
Calculator · math
Ratios Of Directed Line Segments Calculator
Find point P dividing directed segment AB in ratio m:n. Enter coordinates of A and B plus ratio values to compute the x-coordinate, y-coordinate, or distance AP.
Inputs
Partition Point Coordinate
—
Explain my result
Get a plain-English breakdown of your result with practical next steps.
The formula
How the
result is
computed.
What Is the Ratios of Directed Line Segments Calculator?
The ratios of directed line segments calculator locates point P on a directed segment from A(x₁, y₁) to B(x₂, y₂) that divides AB in a user-specified ratio m:n. The tool applies the section formula (internal division formula), computing the x-coordinate, y-coordinate, or distance AP in one step given four endpoint values and the two ratio components.
The Section Formula
When point P divides directed segment AB internally in ratio AP:PB = m:n, its coordinates satisfy:
P = ( (n·x₁ + m·x₂) ÷ (m + n) , (n·y₁ + m·y₂) ÷ (m + n) )
The segment is directed: A is the origin point and B is the terminal point. Swapping A and B while keeping the same ratio m:n moves P to a different location on the coordinate plane, which is why direction matters.
Variable Definitions
- x₁, y₁ — Coordinates of starting point A.
- x₂, y₂ — Coordinates of ending point B.
- m — First ratio component; represents the AP portion of AB.
- n — Second ratio component; represents the PB portion of AB.
- P — Output point whose x-coordinate, y-coordinate, or distance from A is computed.
Deriving the Formula from Similar Triangles
Drop perpendiculars from A, P, and B to the x-axis, creating foot-points A′, P′, and B′. Because the three perpendiculars are parallel, the intercept theorem guarantees AP:PB = A′P′:P′B′ = m:n. Writing that proportion algebraically:
(P_x − x₁) / (x₂ − P_x) = m / n
Cross-multiplying yields n(P_x − x₁) = m(x₂ − P_x). Expanding and collecting: P_x(m + n) = m·x₂ + n·x₁. Dividing both sides by (m + n) gives the x-component. The y-component follows by the same algebra on the y-axis projection. This derivation aligns with standards documented by the New Mexico PED High School Geometry: Expressing Geometric Properties with Equations and is reinforced through the guided practice exercises on Khan Academy's Dividing Line Segments unit.
Special Case: The Midpoint
Setting m = n = 1 reduces the section formula to the midpoint formula: P = ((x₁ + x₂) / 2, (y₁ + y₂) / 2). Every midpoint problem is a ratio problem with a 1:1 ratio, as confirmed in the Mississippi University for Women coordinate-geometry reference. No separate formula is needed.
Distance from A to P
Given ratio m:n, the distance from A to P is the fraction m/(m+n) of the full segment length:
d(A, P) = (m / (m + n)) × √((x₂ − x₁)² + (y₂ − y₁)²)
For example, if AB spans 20 units and P divides it 3:1, then d(A, P) = (3/4) × 20 = 15 units.
Worked Examples
Example 1 — Integer Coordinates, Ratio 2:1
Given A(1, 2) and B(7, 8) with m:n = 2:1:
- P_x = (1·1 + 2·7) / (2 + 1) = 15 / 3 = 5
- P_y = (1·2 + 2·8) / (2 + 1) = 18 / 3 = 6
- Result: P = (5, 6), located two-thirds of the way from A to B.
Example 2 — Negative Coordinates, Ratio 3:1
Given A(−3, 4) and B(5, −2) with m:n = 3:1:
- P_x = (1·(−3) + 3·5) / (3 + 1) = 12 / 4 = 3
- P_y = (1·4 + 3·(−2)) / (3 + 1) = −2 / 4 = −0.5
- Result: P = (3, −0.5), three-quarters of the way from A to B.
Real-World Applications
- Computer graphics: Linear interpolation (lerp) of vertex positions during skeletal animation and path tweening.
- Civil engineering: Placing utility access points (manholes, hydrants) at proportional distances along a surveyed route.
- Robotics: Computing intermediate waypoints along a straight-line trajectory at defined completion ratios.
- Architecture: Dividing facade panels or structural bays in aesthetic or load-proportional ratios.
- Cartography: Positioning landmarks along a straight geographic transect at fractional distances.
Reference