Advertisement
Advertisement
COORDINATE GEOMETRY

Line Segment Partition Calculator — divide a segment in a given ratio

Find the point that splits a directed segment in the ratio m to n, internally or externally, in two or three dimensions, with the section formula worked out in full.

The section formula is applied coordinate by coordinate, so it works unchanged in any number of dimensions.
m is the share of the segment on the A side of the dividing point.
The point P satisfies AP to PB equal to m to n. Setting both equal gives the midpoint.
Internal division uses m plus n in the denominator; external division uses m minus n, which fails when the two are equal.
Coordinates are computed at full double precision; this controls the display only.
Dividing point P
 
Parameter t along AB
Distance AP
Distance PB
Length of AB
Working:
Tip: the ratio is directed. AP to PB of 3 to 2 puts the point three fifths of the way from A towards B, not two fifths. Swapping the two numbers moves the point to the mirror position, and it is the single commonest slip on this calculation.
Advertisement

The line segment partition calculator above finds the point P that divides a directed segment from A to B so that AP is to PB as m is to n. It handles internal division, where P sits between the endpoints, and external division, where P sits on the extended line beyond one of them. It reports the parameter t, both part lengths and the whole length, so you can check the ratio came out the way you meant.

Arb Digital publishes it because the section formula is easy to state and easy to get backwards. The number m goes with the coordinate of B, not of A, which looks wrong on first reading and catches almost everyone once. Our slope calculator covers the midpoint, the distance and the line equation through two points; this page covers every other division ratio, of which the midpoint is just the case m equals n.

What This Line Segment Partition Calculator Does

It applies the section formula independently to each coordinate. For internal division the x coordinate of P is (n×xA + m×xB) divided by (m + n), and the same expression with y or z substituted gives the other coordinates. Because the formula treats each axis separately, extending it from two dimensions to three changes nothing structurally, which is why the dimension toggle simply adds a field.

For external division the denominator becomes m − n and the first numerator term changes sign. That places P on the line through A and B but outside the segment, on the far side of B when m exceeds n and on the far side of A when n exceeds m. When m equals n there is no external division point at all, and the tool explains that rather than dividing by zero.

Alongside the point it reports the parameter t, which is m divided by (m + n) internally and m divided by (m − n) externally. That single number is often more useful than the coordinates, because it expresses the position as a fraction of the way from A to B and transfers directly into any interpolation you are doing. A t of 0 is A, a t of 1 is B, a t of 0.5 is the midpoint, and anything outside the interval from 0 to 1 is external.

How to Use It

  1. Enter the two endpoints in the order that matters to you. A to B and B to A give different points for the same ratio unless that ratio is 1 to 1.
  2. Set m and n so that m is the share on A's side. If a question says "partitions AB in the ratio 3:2", m is 3.
  3. Choose internal or external. Most textbook problems are internal; external division appears in projective geometry and in harmonic ranges.
  4. Check the two part distances in the grid. Their ratio should reproduce m to n, and if it does not you have the two numbers the wrong way round.
  5. Read the parameter t if you are feeding the result into an interpolation rather than plotting a point.

The Formula and How It Is Calculated

Write the segment parametrically as P = A + t(B − A). Internal division in the ratio m to n means AP divided by PB equals m divided by n, and since AP is t times the whole length and PB is (1 − t) times it, that gives t divided by (1 − t) equals m divided by n, so t = m ÷ (m + n). Substituting back produces the familiar form P = (n·A + m·B) ÷ (m + n).

Work the default. A is (−4, 3), B is (6, 8), and the ratio is 3 to 2 internally. So t = 3 ÷ 5 = 0.6. The x coordinate is (2×−4 + 3×6) ÷ 5 = (−8 + 18) ÷ 5 = 2, and the y coordinate is (2×3 + 3×8) ÷ 5 = (6 + 24) ÷ 5 = 6. So P is (2, 6). The length of AB is the square root of 100 plus 25, which is 11.1803, and AP is 0.6 of that, or 6.7082, against PB of 4.4721. Their ratio is exactly 1.5, which is 3 to 2.

For internal division the point is a convex combination of the two endpoints: the weights n÷(m+n) and m÷(m+n) are both non-negative and sum to one. Wolfram MathWorld's page on convex combinations gives exactly that condition. External division breaks it — one weight goes negative — which is precisely why the point leaves the segment.

Advertisement

The Midpoint Is the 1:1 Case

Set m and n both to 1 and the internal formula collapses to (A + B) ÷ 2, the midpoint. OpenStax's section 2.1 of Algebra and Trigonometry 2e states the midpoint and distance formulas in that standard form. If the midpoint is all you need, our slope calculator already reports it along with the slope, the intercepts and the three standard forms of the line equation.

The useful observation is what happens either side of that case. As m grows relative to n the point slides towards B; as n grows it slides towards A. The relationship is not linear in the ratio: a ratio of 2 to 1 puts the point two thirds along, and 3 to 1 puts it three quarters along, so each unit increase in m moves the point by a shrinking amount. That is why ratio problems are usually posed with small integers.

A related trap is the difference between "divides AB in the ratio 3:2" and "is 3:2 of the way from A". The first is the ratio of the two parts and gives t = 0.6. The second is not standard phrasing and usually means t = 1.5, which is external. When a question is ambiguous, check the answer against the part distances the tool reports.

External Division, and When It Fails

External division asks for a point P on line AB, outside the segment, whose distances to A and B are still in the ratio m to n. The parameter is t = m ÷ (m − n). With m = 3 and n = 2 that is t = 3, so P sits at A plus three times the vector from A to B, which for the default endpoints is (26, 18). Check it: AP is three times the length of AB and PB is two times it, and 3 to 2 is the ratio asked for.

When m equals n the denominator is zero and there is no such point. Geometrically this is clear: you are asking for a point outside the segment that is equidistant from both endpoints, and the only equidistant point on the line is the midpoint, which is inside. In projective terms the external division point of a 1:1 ratio is the point at infinity in the direction of the line. The tool reports this in words instead of returning an infinity or a NaN.

The pair of points dividing a segment internally and externally in the same ratio forms what is called a harmonic range, and it is the configuration behind the Apollonius circle: the locus of points whose distances to A and B are in a fixed ratio is a circle passing through both division points. Our 3D distance calculator is useful for checking the distances when you extend this into space.

Where This Comes Up Outside a Textbook

Computer graphics uses the parametric form constantly. Every linear interpolation between two positions, colours or keyframe values is exactly this calculation with the ratio expressed as a single fraction t, and Bezier curve evaluation by de Casteljau's algorithm is nothing but repeated segment partition. Our linear interpolation calculator covers the same arithmetic in the one-dimensional case where you are interpolating a value rather than a position.

Surveying and civil engineering use it for setting out points along a straight alignment at specified chainages, where the ratio comes from a distance rather than being given directly. Structural analysis uses it to locate the point of contraflexure along a member. And in geographic work, dividing a straight line between two coordinates in a ratio is the flat-earth approximation that is perfectly adequate over short distances and wrong over long ones, where a great circle is needed instead.

The common thread is that the operation is cheap, exact and dimension-independent, so it appears wherever a position between two known positions is required. Our vector calculator handles the underlying vector arithmetic if you would rather work with B minus A directly.

Need a geometry tool that shows the substitution?

Arb Digital builds free maths tools that print the numbers going into the formula, not just the answer coming out.

Browse All Free Tools Talk To Our Team

Common Mistakes to Avoid

  • Pairing m with A instead of B — in the internal formula m multiplies the coordinates of B. Getting this backwards produces the mirror-image point, which often still looks plausible.
  • Reversing the endpoints — the ratio is directed, so partitioning BA in 3:2 gives a different point from partitioning AB in 3:2 unless the ratio is 1:1.
  • Using m + n for external division — external division needs m − n, and using the sum silently returns the internal point instead.
  • Expecting an external point for a 1:1 ratio — there is none. The construction degenerates to the point at infinity along the line.
  • Treating the ratio as a fraction of the length — a 3:2 ratio is three fifths of the way along, not three halves and not three tenths.

Related Free Tools From Arb Digital

Get the midpoint, slope and line equations from two points with the slope calculator, interpolate a value between two known ones with the linear interpolation calculator, measure separation in space with the 3D distance calculator, work with position vectors using the vector calculator, or switch coordinate systems with the coordinates converter. The full free online tools hub lists every geometry tool we publish.

Frequently Asked Questions

What is the section formula?

For internal division in the ratio m to n, the dividing point is (n times A plus m times B) divided by m plus n, applied to each coordinate separately. The share m goes with the coordinates of B.

Is the midpoint a special case of this?

Yes. Setting m and n both to 1 reduces the formula to the average of the two endpoints, which is the midpoint. Every other ratio moves the point off centre towards one end.

What does the parameter t mean?

It is the fraction of the way from A to B. A t of 0 is A, 1 is B and 0.5 is the midpoint. Values outside that interval put the point on the line but outside the segment.

What is external division?

A point on the line through A and B, outside the segment, whose distances to the endpoints are still in the ratio m to n. It uses m minus n in the denominator instead of m plus n.

Why does external division fail for a 1:1 ratio?

Because the denominator m minus n becomes zero. Geometrically no point outside the segment is equidistant from both ends, so the construction has no finite answer.

Does the order of the endpoints matter?

Yes. The ratio is directed from A to B, so swapping the points while keeping the ratio moves the dividing point to the mirror position unless the ratio is 1 to 1.

Does the formula work in three dimensions?

Yes, unchanged. It is applied to each coordinate independently, so adding a z coordinate adds a third identical calculation and nothing else.

Can m or n be negative?

A negative part converts an internal division into an external one and vice versa. It is cleaner to keep both positive and use the division type selector to say which you want.

This page explains a standard result of coordinate geometry for educational purposes. Results are computed in double-precision floating point, so coordinates from very large or very small inputs may show rounding in the final displayed digits.

Advertisement
Advertisement

Take it further