Ratios of Directed Line Segments Calculator

Enter the coordinates of points A, B, and P to find the ratio AP:PB in which P divides the directed line segment from A to B — including whether the division is internal or external.

Quick Facts

Section formula (internal)
P = ((mx₂+nx₁)/(m+n), (my₂+ny₁)/(m+n))
Point P divides AB internally in ratio m:n when 0 < m/n.
Ratio from coordinates
AP:PB = k:1, where k = t/(1−t)
t is P's position fraction along AB, found by projecting P onto the line through A and B.
Division type
k > 0 → internal, k < 0 → external
Internal division places P between A and B; external division places P outside the segment on the extended line.

Your Results

Calculated
Ratio AP : PB
-
Directed ratio, expressed as k : 1
Division type
-
Internal or external division
k = AP / PB
-
Signed ratio value
Distances AP and PB
-
Magnitudes along the line

Ready

Enter the coordinates of A, B, and P, then press Calculate.

How the Ratios of Directed Line Segments Calculator works

Given three collinear points A, B, and P, this calculator finds the ratio AP:PB in which P divides the directed segment from A to B. Unlike an ordinary distance ratio, AP and PB are directed (signed) lengths — they carry direction along the line, so the ratio can be positive or negative depending on whether P sits between A and B or outside that segment. This is the inverse of the classic section formula: instead of computing a point from a known ratio, it computes the ratio from a known point.

Formula and derivation

Write P as a point on the line through A(x₁, y₁) and B(x₂, y₂): P = A + t(B − A) for some scalar t. Solving for t using both coordinates (a projection onto the AB direction) gives t = [(x − x₁)(x₂ − x₁) + (y − y₁)(y₂ − y₁)] / [(x₂ − x₁)² + (y₂ − y₁)²]. Since AP = t·|AB| and PB = (1 − t)·|AB|, the directed ratio is k = AP/PB = t/(1 − t), written as AP:PB = k:1. When 0 < t < 1, P lies between A and B and k is positive (internal division). When t < 0 or t > 1, P lies outside segment AB on the extended line and k is negative (external division). Before reporting a ratio, the calculator verifies A, B, and P are collinear by checking that the perpendicular distance from P to line AB is (near) zero — if P is off the line, no directed ratio exists.

Common mistakes

  • Using unsigned distances: a plain distance ratio |AP|:|PB| is always positive and cannot distinguish internal from external division — the directed ratio keeps the sign to preserve that information.
  • Assuming P is on the line: if A, B, and P are not exactly collinear (a rounding error or a mistyped coordinate), the ratio AP:PB is undefined; always confirm the collinearity check passes.
  • Mixing up A and B: AP:PB is not the same as PA:PB or BP:AP — swapping the reference points inverts or negates the ratio, so keep A, B, and P consistent with your diagram.

Real-world applications

  • Analytic geometry problems that ask "in what ratio does point P divide segment AB" — common when verifying a given point against the section formula.
  • Computer graphics and CAD, where directed ratios locate a point along a segment or extend a line to a control point outside the original endpoints.
  • Physics and engineering, such as finding the ratio in which a support or load point divides a beam, using signed positions along the beam's axis.
  • Checking whether three points are collinear and, if so, characterizing their order on the line (between the endpoints versus beyond one of them).

Frequently Asked Questions

What does the ratio of directed line segments AP:PB mean?
If A, B, and P are collinear points, AP and PB are directed (signed) lengths along the line from A to P and from P to B. Their ratio AP:PB, often written as k:1, tells you where P sits relative to A and B: a positive k means P lies between A and B (internal division), while a negative k means P lies outside segment AB on the extended line (external division).
How is the ratio AP:PB calculated from coordinates?
First find the parameter t such that P = A + t(B − A), computed as t = [(x − x₁)(x₂ − x₁) + (y − y₁)(y₂ − y₁)] / [(x₂ − x₁)² + (y₂ − y₁)²]. The ratio is then k = t / (1 − t), so AP:PB = k:1. This works for lines in any direction, including vertical and horizontal segments.
What's the difference between internal and external division?
Internal division means P lies on the segment between A and B (0 < t < 1), so both AP and PB point in the same direction and k is positive. External division means P lies on the line through A and B but outside the segment (t < 0 or t > 1), so AP and PB point in opposite directions and k is negative.
What if points A, B, and P aren't exactly collinear?
The ratio of directed line segments is only defined when all three points lie on the same line. This calculator checks the perpendicular distance from P to line AB; if it's not close to zero, the points aren't collinear and no ratio is reported.