Understanding the directed line segment ratio calculator — concept and principle
This calculator finds the point P that divides a directed segment from A to B in a given ratio m : n, either internally (between A and B) or externally (on the line beyond the segment). It also shows the fraction of the way from A to B and the lengths AP and PB. Use it for coordinate geometry, analytic geometry homework and design layouts.
How it is calculated
- Internal division (AP : PB = m : n): P = ((n·x₁ + m·x₂)/(m + n), (n·y₁ + m·y₂)/(m + n)).
- Equivalently, P = A + (m/(m + n))·(B − A), the fraction m/(m + n) of the way from A.
- External division: P = ((m·x₂ − n·x₁)/(m − n), (m·y₂ − n·y₁)/(m − n)), which requires m ≠ n.
- Lengths use the distance formula √((Δx)² + (Δy)²).
The principle
Moving along a straight segment changes x and y in proportion. If P is m parts of the way and there are m + n parts in all, P must be at the fraction m/(m + n) in both coordinates. Writing this out gives a weighted average of the endpoints, where each endpoint is weighted by the part of the segment on the other side; that is why x₂ is multiplied by m. The midpoint formula is the special case m = n = 1. For external division the point is outside the segment, so one of the parts points backward, which turns m + n into m − n.
Worked example
Default inputs: A(−2, 1), B(8, 6), ratio 3 : 2, internal.
- Fraction of the way from A: 3 ÷ (3 + 2) = 0.6.
- x = (2 × (−2) + 3 × 8) ÷ 5 = 20 ÷ 5 = 4.
- y = (2 × 1 + 3 × 6) ÷ 5 = 20 ÷ 5 = 4. So P = (4, 4).
- AP = √(6² + 3²) = √45 ≈ 6.7082.
- PB = √(4² + 2²) = √20 ≈ 4.47214, and 6.7082 : 4.47214 = 3 : 2.
How to read the result
For internal division, P always lies between A and B, and the fraction tells you how far along it is. The ratio of AP to PB should match m : n, which is a quick check. For external division, P lies on the extension of the line: beyond B if m > n, behind A if m < n.
Common mistakes
- Swapping the weights: x₁ goes with n, x₂ with m.
- Mixing up the direction, A to B versus B to A, which changes the answer.
- Using m : n as the fraction m/n instead of m/(m + n).
- Using external division with m = n, which has no solution.
Frequently asked questions
What is the midpoint formula in this form?
With m = n = 1, P = ((x₁ + x₂)/2, (y₁ + y₂)/2).
How do I find the point one third of the way from A to B?
Use the ratio 1 : 2, which gives the fraction 1/3.
Why is it called a directed segment?
Because it has a start and an end; dividing from A to B differs from dividing from B to A.
Sources: OpenStax, Algebra and Trigonometry, §2.1 (midpoint and distance formulas)