The distance formula gives the length of the straight segment joining two points and : . Subtract the x values, subtract the y values, square both differences, add, and take the square root. That is all it does, and it works for any two points in the plane.
This page covers the distance formula in maths from its Pythagoras proof to the version with three coordinates, then the other formulas that travel with it in class 10 and class 11: the midpoint formula, the section formula (internal and external), the slope formula and the two point form of a line, the collinearity test and the triangle area you get straight from three vertices. Each one comes with a short example worked step by step, and the calculator below lets you check your own answers.

Key formulas
Distance formula (two points)
Also called the Euclidean distance formula
Distance from the origin
Distance formula with three coordinates
Midpoint formula
Section formula (internal, ratio m:n)
Section formula (external, ratio m:n)
Slope formula
Two point slope form of a line
Area of a triangle from coordinates
Centroid of a triangle
Point to line distance formula
distance of from the line
The distance formula, term by term
Take two points and . The formula is
- is the horizontal gap between the points (how far you move left or right).
- is the vertical gap (how far you move up or down).
- Squaring removes the sign, so it does not matter which point you call A and which you call B.
- The square root turns the sum of squares back into a length, in the same units as the axes.
The answer is never negative. If you get zero, the two points are the same point. Because the straight segment is the shortest path between two points in a plane, this point to point distance formula always gives the shortest distance, and teachers often add that the shortest distance between two points is a straight line. Many books call it the Euclidean distance formula, after Euclid, and the same idea with more terms under the root is used for vectors and in data science.
Proof of the distance formula from Pythagoras (class 10)
Plot and . Draw a horizontal line through A and a vertical line through B. They meet at , and angle C is a right angle.
- Side AC lies along a horizontal line, so its length is .
- Side BC lies along a vertical line, so its length is .
By the Pythagoras theorem in right triangle ACB:
This is the derivation of the distance formula used in the class 10 coordinate geometry chapter, and you may be asked to write it out. To verify the distance formula by a graphical method, plot two points on graph paper, measure the segment with a scale, and compare it with the value from the formula. They agree up to your measuring error.
Distance in 3D and from the origin
When one of the points is the origin , put and the formula shrinks to . For , .
In space each point has three coordinates. Class 11 adds a third squared gap:
For and , the gaps are 3, 4 and 12, so . The same pattern works with vectors: the distance between position vectors and is the magnitude , which is why the vector distance formula looks identical once you write the components out. In calculus the distance formula applied to tiny pieces of a curve leads to the arc length integral you meet on the integration formulas page.
Midpoint formula
The midpoint of AB is the point exactly halfway along it. Its x value is the average of the two x values and its y value is the average of the two y values:
For and , . Notice the plus signs: the midpoint adds coordinates, the distance formula subtracts them. Students mix these up under pressure. The mid point formula in class 10 is simply the section formula with the ratio 1:1, so you do not need to learn it as a separate idea. A related result is the centroid of a triangle, found by averaging all three vertices.
Section formula for class 10
The section formula finds the point P that divides the segment from to in the ratio , meaning .
Internal division
P lies between A and B:
Memory hook: m goes with the far point B, n goes with the near point A. Cross multiplication, not straight.
External division
P lies on line AB extended beyond B (when m is larger than n). Change both plus signs between the products to minus:
External division is not in the class 10 NCERT book; it turns up mainly in competitive exams. The class 10 NCERT chapter on coordinate geometry uses only the internal form, often in questions like "in what ratio does the x axis divide the segment".
Slope formula and the two point form of a line
The slope (gradient) of the line through two points measures how steep it is: rise divided by run.
Here is the angle the line makes with the positive x axis, which links slope to the trigonometry formulas. A positive slope rises to the right, a negative slope falls, a horizontal line has slope 0, and a vertical line has no defined slope because .
Put the slope into the point slope form and you get the two point slope formula (some books write 2 point slope formula) for the line itself:
Other slope results you should know: slope from the equation is m; slope from is (when b is not 0); parallel lines have equal slopes; perpendicular lines have slopes whose product is . Students of statistics also meet a slope formula in linear regression, but that one is built from sums of data values rather than two points.
Collinear points and area of a triangle
Three points are collinear when they lie on one straight line. There are three ways to test this, and all of them come from the formulas above:
- Slopes: slope of AB equals slope of BC.
- Distances: the two shorter distances add up to the longest one.
- Area: the triangle formed has zero area.
Given vertices , , , the enclosed area is
For the vertices , and : square units. If you only know the three side lengths, use Heron's formula instead, and the area formulas page lists the base and height methods.
Distance formula examples, solved step by step
Example 1: find the distance between two points
Find the distance between and .
and .
.
Answer: units.
Example 2: negative coordinates and a surd answer
Find the distance between and .
and .
.
Answer: units. Leave it in surd form unless the question asks for a decimal.
Example 3: an unknown coordinate
The distance between and is 10 units. Find y.
, so .
, so or .
Answer: or . Both are valid: there are two points at that distance.
Example 4: ratio of division by the x axis
In what ratio does the x axis divide the segment joining and ? Find the point.
Let the ratio be . Any point on the x axis has y equal to 0, so , giving .
x coordinate: .
Answer: the ratio is 2:1 and the point is .
Example 5: slope, line and collinearity
Show that , and are collinear.
Slope of the first pair: . Slope of the second pair: .
Equal slopes with a common point mean one line. Check with area: .
Answer: the points are collinear, on the line .
Common mistakes with these formulas
Watch out for these:
- Writing and forgetting to square the gaps.
- Taking the square root of each term separately. is 10, not 6 + 8.
- Losing a minus sign: is 7, not 1. Put brackets around negative coordinates every time.
- Using minus signs in the midpoint formula or plus signs in the distance formula.
- Swapping m and n in the section formula. Check that your point really is closer to the end with the smaller share.
- Dividing in the wrong order in the slope formula, such as , which flips the sign.
Where these formulas appear in exams
Class 10 maths coordinate geometry formulas in the NCERT book are the distance formula and the section formula (with the midpoint as a special case). Expect a 2 or 3 mark question on finding a distance or a ratio, and one word problem where points stand for houses, trees or towns on a map and you have to show they form an isosceles or right triangle. Class 11 adds slope, the forms of a straight line, the point to line distance formula and the 3D distance formula. Engineering and other entrance tests mix all of these with circles, where the radius formula in coordinate geometry is the distance formula used once, between the centre and a known point of the circle.
The formula sheet PDF below gives you a one page revision copy. For every other chapter, see the full list on the all maths formulas page.
Practice: (1) Distance between and . (2) Midpoint of and . (3) Point dividing to internally in 2:1. (4) Point dividing to externally in 2:1. Answers: (1) 10, (2) , (3) , (4) .
Download the PDF
Questions students ask
What is the distance formula in coordinate geometry?
For points and , the distance is . It is the Pythagoras theorem applied to the horizontal and vertical gaps between the points.
In which class is the distance formula taught?
Class 10 students meet it in the coordinate geometry chapter along with the section formula. Class 11 extends it to three dimensions and adds slope and straight lines.
What is the difference between the distance formula and the midpoint formula?
The distance formula gives a length (one number) by subtracting coordinates, squaring and taking a root. The midpoint formula gives a point (two coordinates) by averaging the x values and the y values.
Does it matter which point I take first?
No. Each gap is squared, and . Just keep the order the same for x and y in the slope formula, where the sign matters.
How do I find the distance between a point and a line?
Write the line as . The perpendicular distance of from it is . For and this is .
Why is the shortest distance between two points a straight line?
In a flat plane, any bent path can be shortened by joining its ends directly, which is the triangle inequality: one side of a triangle is shorter than the other two put together. In physics, this straight line length from start to end is the magnitude of the displacement.
