Directed Line Segment Calculator
Test cases replayed : 2 of 2 match · Methodology · No outside source listed
Enter the coordinates of the start point A and end point B, and the ratio m:n in which P splits the segment from A toward B.
Result
P: x = x₁ + m/(m + n) × (x₂ − x₁)
P: y = y₁ + m/(m + n) × (y₂ − y₁)
- Share of the way from A to B
- Length AP
- Length PB
Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.
This browser did not allow copying. The sentence is in the box below, already selected: copy it with your keyboard or the menu.
How to use this calculator
Fill in the fields in this order; each step takes you to its field.
- A: x₁: enter a number.
- A: y₁: enter a number.
- B: x₂: enter a number.
- B: y₂: enter a number.
- Ratio part m (from A to P): enter 0 or more.
- Ratio part n (from P to B): enter 0 or more.
- Read the result: P: x = x₁ + m/(m + n) × (x₂ − x₁); the panel also shows P: y = y₁ + m/(m + n) × (y₂ − y₁), Share of the way from A to B, Length AP and Length PB.
How this calculator works
Section formula (internal division): the point P that divides the directed segment AB so that AP : PB = m : n is P = ((n x₁ + m x₂) ÷ (m + n), (n y₁ + m y₂) ÷ (m + n)), the same as moving the fraction m/(m + n) of the way from A to B.
The direction matters: dividing from B to A in the ratio m:n gives a different point (the one for n:m from A).
The formula
| Symbol | Meaning |
|---|---|
| A: x₁ | |
| B: x₂ | |
| Ratio part m (from A to P) | |
| Ratio part n (from P to B) | |
| P: x = x₁ + m/(m + n) × (x₂ − x₁) |
Worked example
| A: x₁ | 1 |
|---|---|
| A: y₁ | 2 |
| B: x₂ | 7 |
| B: y₂ | 8 |
| Ratio part m (from A to P) | 1 |
| Ratio part n (from P to B) | 2 |
| P: y = y₁ + m/(m + n) × (y₂ − y₁) | 4 |
|---|---|
| Share of the way from A to B | 33.33% |
| Length AP | 2.8284 |
| Length PB | 5.6569 |
P: x = x₁ + m/(m + n) × (x₂ − x₁) 3
Each step uses the unrounded value of the step before it; figures on this page are rounded for display.
Frequently asked questions
Which point divides A(1, 2) to B(7, 8) in the ratio 1:2?
P = (1 + ⅓ × 6, 2 + ⅓ × 6) = (3, 4).
What ratio gives the midpoint?
1:1, which puts P halfway (50%) from A to B.