Choose the kind of point and the dimension, then enter the coordinates of the two points A and B and the ratio m:n. The formula below is linked to the input fields, so you can also edit the coordinates or the ratio right in the formula.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and figures
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter the coordinates of two points \(\mathrm{A}\) and \(\mathrm{B}\) and a ratio \(m:n\), and you get the coordinates of the point that divides segment \(\mathrm{AB}\) in the ratio \(m:n\), internally or externally, on the spot
- The midpoint (internal division in the ratio \(1:1\)) and the centroid of a triangle (the average of the coordinates of its three vertices) can be found on the same page
- Works on the number line (1D), in the coordinate plane (2D) and in space (3D)
- The answer is shown both as an exact fraction in lowest terms, such as \(\dfrac{13}{2}\), and as a decimal. You can also see the steps with the numbers put into the formula
- A figure shows where the point is on the segment (inside it, or outside on which side). Coordinates and ratios can be decimals, negative numbers or fractions such as 3/4
- An explanation of the "criss-cross" in the formula (why \(m\) and \(n\) seem to swap places) and copy-and-paste formulas for Excel, Google Sheets and Python are also on this page
What is this calculation used for?
When a character or a camera moves from point A to point B, the computer finds its position in every frame as "the point dividing segment AB internally in the ratio \(t : \left(1-t\right)\)" (where \(t\) is a number between \(0\) and \(1\)). This is called linear interpolation (lerp), the most basic calculation in computer graphics.
Increase t little by little from 0 to 1, and the object moves from A to B at a steady speed; change how fast t increases, and you get natural motion that starts slowly and stops slowly. Blending colors, resizing images and morphing between two faces all apply the same internal division calculation to colors or coordinates.
Put a 1 lb weight and a 2 lb weight on the two ends of a 3 ft rod (assume the rod's own weight is small enough to ignore). Where should the support go so that it balances? That is exactly an internal division calculation. The answer is 2 ft from the 1 lb end: the center of gravity is an average weighted by the weights, and it moves toward the heavier end. As a formula, with mass \(m_1\) at position \(x_1\) and mass \(m_2\) at position \(x_2\), the center of gravity is \(\dfrac{m_1 x_1 + m_2 x_2}{m_1 + m_2}\), the same form as the internal division formula.
Here it does not look like "the coordinate of the lighter end is multiplied by the heavier mass", because the masses themselves are the weights. In internal division, which works with the ratio of lengths, the weight is "the length of the part on the other side". The same idea is used to find the center of gravity of triangles, plates, cars and airplanes.
If a class of 40 students averages 60 points and a class of 20 students averages 90 points, the combined average of the two classes is not 75 but \(\dfrac{40 \times 60 + 20 \times 90}{40 + 20} = 70\) points. Think of 60 and 90 as two points \(\mathrm{A}\) and \(\mathrm{B}\) on the number line: the answer divides segment \(\mathrm{AB}\) internally in the ratio \(20:40\), which is the ratio of students \(40:20\) swapped around. The answer moves toward 60, the side with more students, because the other side's number of students is the weight. It is exactly the same swap as the criss-cross on this page.
Price indexes, batting averages, overall survey ratings and the average cost per share of an investment are all averages that combine groups of different sizes, and all take this form. It keeps you from the mistake of simply adding and dividing by 2, which gives too much weight to the smaller group.
In road and site construction, workers use the coordinates of two surveyed points to find "the position a set fraction of the way between them" and drive a stake there. The points that split a 400 ft stretch into four equal parts, at 100, 200 and 300 ft, are the internal division points for the ratios 1:3, 1:1 and 3:1.
With 3D coordinates that include height, the same formula finds points partway up a slope. Even for a tunnel dug from both ends that must meet exactly in the middle, many coordinate calculations like this keep the work accurate.
Treat the latitude and longitude of two places as coordinates, and the midpoint formula gives a place about halfway between them. This is used by features that suggest meeting places, and to split a long route into evenly spaced points to check the elevation or the weather along the way.
Over long distances you need calculations that take the round shape of the Earth into account, but within a city, treating the coordinates as flat and using internal division makes almost no difference in practice.
Formulas and figures
Symbols and terms
Symbols
| \(\mathrm{A},\ \mathrm{B},\ \mathrm{C}\) | A, B, C | Names for points. In geometry, points are named with capital letters, usually A, B, C in order. On this page, the ends of the segment are \(\mathrm{A}\) and \(\mathrm{B}\), and the third vertex of the triangle is \(\mathrm{C}\). |
| \(x_1,\ y_1\) | x sub one, y sub one | The coordinates of point \(\mathrm{A}\). The small number at the lower right (the subscript) is a label telling which point it is, not a number used in the calculation. In the same way, \(x_2,\ y_2\) are the coordinates of point \(\mathrm{B}\), and \(x_3,\ y_3\) those of point \(\mathrm{C}\). |
| \(m:n\) | m to n | The ratio that divides the segment. \(m\) is the share for the part from \(\mathrm{A}\) to the dividing point, and \(n\) the share for the part from the dividing point to \(\mathrm{B}\). \(m\) and \(n\) are simply letters often used for ratios. Swapping the order gives a different point. |
| \(\mathrm{P}\) | P | A name often given to the point of internal division, from the first letter of "point". |
| \(\mathrm{Q}\) | Q | A name often given to the point of external division. By custom, it is the letter after \(\mathrm{P}\). |
| \(\mathrm{M}\) | M | A name often given to the midpoint, from the first letter of "midpoint". |
| \(\mathrm{G}\) | G | A name often given to the centroid. It is said to come from the "G" in "center of gravity". |
| \(\mathrm{AB}\) | segment AB | The line segment joining point \(\mathrm{A}\) and point \(\mathrm{B}\): the part of a straight line between two fixed ends. On this page, its length is also written \(\mathrm{AB}\). |
| \(\mathrm{AP} : \mathrm{PB}\) | AP to PB | The ratio of the length of segment \(\mathrm{AP}\) to the length of segment \(\mathrm{PB}\). The point \(\mathrm{P}\) with \(\mathrm{AP} : \mathrm{PB} = m : n\) is the point dividing segment \(\mathrm{AB}\) internally in the ratio \(m:n\). |
Terms
| line segment | The part of a straight line between two points. A part with two ends is a line segment, one that goes on forever in one direction is a ray, and one that goes on forever in both directions is a line. |
| internal division | Dividing a segment at a point inside it in a given ratio. The point \(\mathrm{P}\) dividing segment \(\mathrm{AB}\) internally in the ratio \(m:n\) is the point on segment \(\mathrm{AB}\) with \(\mathrm{AP} : \mathrm{PB} = m : n\). In US geometry this is called partitioning a directed line segment. |
| external division | Dividing a segment at a point on its extension, outside the segment, so that \(\mathrm{AQ} : \mathrm{QB} = m : n\). The point lands on the side of the end with the smaller ratio part (beyond \(\mathrm{B}\) if \(m > n\), before \(\mathrm{A}\) if \(m < n\)). There is no such point when \(m\) and \(n\) are equal. |
| dividing point | A general name for a point that divides a segment in a given ratio, covering both internal and external division. |
| midpoint | The point in the middle of a segment, equally far from both ends. It is internal division in the ratio \(1:1\). |
| centroid | The one point where the three medians of a triangle meet. A triangular plate balances level when supported there (its center of gravity), and its coordinates are the average of the coordinates of the three vertices. |
| median | The segment joining a vertex of a triangle to the midpoint of the opposite side. The three medians always meet at one point (the centroid), which divides each median internally in the ratio \(2:1\) from the vertex. |
| ratio | A way of comparing two amounts, written side by side as in "\(2:1\)". \(2:1\) and \(4:2\) are the same ratio. On this page, it compares the lengths of the two parts of a divided segment. |
| coordinates | Numbers that give the position of a point: one number on the number line, two \((x,\ y)\) in the plane, and three \((x,\ y,\ z)\) in space. |
| number line | A straight line with a scale marked on it, so that each number matches exactly one point. It is the simplest kind of coordinate, where one number gives a position. |
| coordinate plane | A plane with a horizontal \(x\)-axis and a vertical \(y\)-axis, so that any point on it can be given by two numbers \((x,\ y)\). |
| weighted average | An average where each number is given a "weight". The coordinate of internal division \(\dfrac{n x_1 + m x_2}{m+n}\) is exactly the weighted average of \(x_1\) with weight \(n\) and \(x_2\) with weight \(m\). An ordinary average is the special case where all the weights are equal. |
| subscript | A small number written at the lower right of a letter, as in \(x_1\) and \(x_2\). It is a label that tells apart quantities of the same kind; it is neither a factor nor an exponent. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back over these topics is the fastest way forward.
| The number line and coordinates (Grades 4–6) |
|
| Ratios and proportions (Grades 6–7) |
|
| Operations with positive and negative numbers (Grade 7) |
|
| Working with fractions (Grades 4–6) |
|
| Algebraic expressions and substitution (Grades 6–8) |
|
| Averages (Grade 6) |
|
How to calculate it in Excel
| Point A x-coordinate x1 | 1 |
| Point A y-coordinate y1 | 2 |
| Point B x-coordinate x2 | 7 |
| Point B y-coordinate y2 | 5 |
| Ratio part m (from A to the point) | 2 |
| Ratio part n (from the point to B) | 1 |
| x-coordinate of P (internal) | =(B6*B1+B5*B3)/(B5+B6) |
| y-coordinate of P (internal) | =(B6*B2+B5*B4)/(B5+B6) |
| Point A x-coordinate x1 | 1 |
| Point A y-coordinate y1 | 2 |
| Point B x-coordinate x2 | 7 |
| Point B y-coordinate y2 | 5 |
| Ratio part m (from A to the point) | 3 |
| Ratio part n (from the point to B) | 1 |
| x-coordinate of Q (external) | =(-B6*B1+B5*B3)/(B5-B6) |
| y-coordinate of Q (external) | =(-B6*B2+B5*B4)/(B5-B6) |
| Point A x-coordinate x1 | 1 |
| Point A y-coordinate y1 | 2 |
| Point B x-coordinate x2 | 7 |
| Point B y-coordinate y2 | 5 |
| x-coordinate of midpoint M | =(B1+B3)/2 |
| y-coordinate of midpoint M | =(B2+B4)/2 |
| Vertex A x-coordinate x1 | 1 |
| Vertex A y-coordinate y1 | 2 |
| Vertex B x-coordinate x2 | 7 |
| Vertex B y-coordinate y2 | 5 |
| Vertex C x-coordinate x3 | 4 |
| Vertex C y-coordinate y3 | 8 |
| x-coordinate of centroid G | =(B1+B3+B5)/3 |
| y-coordinate of centroid G | =(B2+B4+B6)/3 |
The first table divides A(1, 2), B(7, 5) internally in the ratio 2:1, giving P(5, 4). The formula for the x-coordinate, "=(B6*B1+B5*B3)/(B5+B6)", looks mismatched at first because it multiplies B1 (the x-coordinate of A) by B6 (the ratio part n), and B3 (the x-coordinate of B) by B5 (the ratio part m). This is the criss-cross, and swapping them changes the answer.
The second table divides the same two points externally in the ratio 3:1, giving Q(10, 6.5). The only differences from the first table are the minus sign in front of B6 and the subtraction instead of addition in the denominator. If you enter the same value for m and n, the denominator becomes 0 and an error (#DIV/0!) appears; this tells you there is no point of external division.
The third table gives the midpoint M(4, 3.5). The fourth table gives the centroid G(4, 5) of the triangle with vertices A(1, 2), B(7, 5) and C(4, 8).
How to calculate it in Google Sheets
| Point A x-coordinate x1 | 1 |
| Point A y-coordinate y1 | 2 |
| Point B x-coordinate x2 | 7 |
| Point B y-coordinate y2 | 5 |
| Ratio part m (from A to the point) | 2 |
| Ratio part n (from the point to B) | 1 |
| x-coordinate of P (internal) | =(B6*B1+B5*B3)/(B5+B6) |
| y-coordinate of P (internal) | =(B6*B2+B5*B4)/(B5+B6) |
| Point A x-coordinate x1 | 1 |
| Point A y-coordinate y1 | 2 |
| Point B x-coordinate x2 | 7 |
| Point B y-coordinate y2 | 5 |
| Ratio part m (from A to the point) | 3 |
| Ratio part n (from the point to B) | 1 |
| x-coordinate of Q (external) | =(-B6*B1+B5*B3)/(B5-B6) |
| y-coordinate of Q (external) | =(-B6*B2+B5*B4)/(B5-B6) |
| Point A x-coordinate x1 | 1 |
| Point A y-coordinate y1 | 2 |
| Point B x-coordinate x2 | 7 |
| Point B y-coordinate y2 | 5 |
| x-coordinate of midpoint M | =(B1+B3)/2 |
| y-coordinate of midpoint M | =(B2+B4)/2 |
| Vertex A x-coordinate x1 | 1 |
| Vertex A y-coordinate y1 | 2 |
| Vertex B x-coordinate x2 | 7 |
| Vertex B y-coordinate y2 | 5 |
| Vertex C x-coordinate x3 | 4 |
| Vertex C y-coordinate y3 | 8 |
| x-coordinate of centroid G | =(B1+B3+B5)/3 |
| y-coordinate of centroid G | =(B2+B4+B6)/3 |
How to calculate it in Python
from fractions import Fraction
# Coordinates of the points (a fraction such as 3/4 can be written Fraction(3, 4))
point_a = (Fraction(1), Fraction(2))
point_b = (Fraction(7), Fraction(5))
point_c = (Fraction(4), Fraction(8)) # third vertex, used for the centroid
def internal_point(a, b, m, n):
# Internal division: multiply by the number for the far side (n for point A, m for point B)
return tuple((n * p + m * q) / (m + n) for p, q in zip(a, b))
def external_point(a, b, m, n):
# External division: internal division with n replaced by -n (cannot be calculated when m equals n)
return tuple((-n * p + m * q) / (m - n) for p, q in zip(a, b))
def midpoint(a, b):
# Midpoint: the average of the two coordinates (internal division 1:1)
return tuple((p + q) / 2 for p, q in zip(a, b))
def centroid(a, b, c):
# Centroid of a triangle: the average of the coordinates of the three vertices
return tuple((p + q + r) / 3 for p, q, r in zip(a, b, c))
def show(point):
# Show the fractions in an easy-to-read form such as "(5, 4)" or "(10, 13/2)"
return "(" + ", ".join(str(v) for v in point) + ")"
print("Internal 2:1 :", show(internal_point(point_a, point_b, Fraction(2), Fraction(1))))
print("External 3:1 :", show(external_point(point_a, point_b, Fraction(3), Fraction(1))))
print("Midpoint :", show(midpoint(point_a, point_b)))
print("Centroid :", show(centroid(point_a, point_b, point_c)))
How to write it in LaTeX and other math languages (copy and paste)
P = ((n·x₁ + m·x₂) ÷ (m + n), (n·y₁ + m·y₂) ÷ (m + n))
P\left(\dfrac{n x_1 + m x_2}{m + n},\ \dfrac{n y_1 + m y_2}{m + n}\right)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mi>n</mi><msub><mi>x</mi><mn>1</mn></msub>
<mo>+</mo>
<mi>m</mi><msub><mi>x</mi><mn>2</mn></msub>
</mrow>
<mrow><mi>m</mi><mo>+</mo><mi>n</mi></mrow>
</mfrac>
</mrow>
</math>
x = (n*x_1 + m*x_2)/(m + n)
{(n*x1 + m*x2)/(m + n), (n*y1 + m*y2)/(m + n)}
P := [(n*x1 + m*x2)/(m + n), (n*y1 + m*y2)/(m + n)];
P = [(n*x1 + m*x2)/(m + n), (n*y1 + m*y2)/(m + n)];
x = (n x_1 + m x_2)/(m + n)
Q = ((−n·x₁ + m·x₂) ÷ (m − n), (−n·y₁ + m·y₂) ÷ (m − n))
Q\left(\dfrac{-n x_1 + m x_2}{m - n},\ \dfrac{-n y_1 + m y_2}{m - n}\right)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<mo>−</mo><mi>n</mi><msub><mi>x</mi><mn>1</mn></msub>
<mo>+</mo>
<mi>m</mi><msub><mi>x</mi><mn>2</mn></msub>
</mrow>
<mrow><mi>m</mi><mo>−</mo><mi>n</mi></mrow>
</mfrac>
</mrow>
</math>
x = (-n*x_1 + m*x_2)/(m - n)
{(-n*x1 + m*x2)/(m - n), (-n*y1 + m*y2)/(m - n)}
Q := [(-n*x1 + m*x2)/(m - n), (-n*y1 + m*y2)/(m - n)];
Q = [(-n*x1 + m*x2)/(m - n), (-n*y1 + m*y2)/(m - n)];
x = (-n x_1 + m x_2)/(m - n)
M = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2)
M\left(\dfrac{x_1 + x_2}{2},\ \dfrac{y_1 + y_2}{2}\right)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow><msub><mi>x</mi><mn>1</mn></msub><mo>+</mo><msub><mi>x</mi><mn>2</mn></msub></mrow>
<mn>2</mn>
</mfrac>
</mrow>
</math>
x = (x_1 + x_2)/2
{(x1 + x2)/2, (y1 + y2)/2}
M := [(x1 + x2)/2, (y1 + y2)/2];
M = [(x1 + x2)/2, (y1 + y2)/2];
x = (x_1 + x_2)/2
G = ((x₁ + x₂ + x₃) ÷ 3, (y₁ + y₂ + y₃) ÷ 3)
G\left(\dfrac{x_1 + x_2 + x_3}{3},\ \dfrac{y_1 + y_2 + y_3}{3}\right)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>x</mi>
<mo>=</mo>
<mfrac>
<mrow>
<msub><mi>x</mi><mn>1</mn></msub><mo>+</mo>
<msub><mi>x</mi><mn>2</mn></msub><mo>+</mo>
<msub><mi>x</mi><mn>3</mn></msub>
</mrow>
<mn>3</mn>
</mfrac>
</mrow>
</math>
x = (x_1 + x_2 + x_3)/3
{(x1 + x2 + x3)/3, (y1 + y2 + y3)/3}
G := [(x1 + x2 + x3)/3, (y1 + y2 + y3)/3];
G = [(x1 + x2 + x3)/3, (y1 + y2 + y3)/3];
x = (x_1 + x_2 + x_3)/3
How to have ChatGPT do the calculation
You are a math calculation assistant for coordinate geometry. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). For the two points A(1, 2) and B(7, 5) on the coordinate plane, find: 1. The coordinates of the point P dividing segment AB internally in the ratio 2:1 2. The coordinates of the point Q dividing segment AB externally in the ratio 3:1 3. The coordinates of the midpoint M of segment AB 4. The coordinates of the centroid G of triangle ABC, with the added point C(4, 8) In Python, use the fractions module from the standard library to calculate exactly, and give each answer both as a fraction in lowest terms and as a decimal. Also explain, by following the algebra step by step, why the coordinate of point A is multiplied by n in the internal division formula (why the formula is "criss-crossed").
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
