MathsGeometry

Coordinate Geometry
calculator.

Find a triangle's area and centers from three points, or a line's equation from two of them.

How it's worked out

Coordinates let you measure without a ruler. The distance formula and the midpoint formula give every side and every middle point. For the line through two points, the slope is the rise over the run, and a line at a right angle to it has the negative reciprocal slope.

m\displaystyle m=y2−y1x2−x1\displaystyle {}= \frac{y_2 - y_1}{x_2 - x_1}

A vertical line breaks that formula, since the run is 0, so its equation is simply x=cx = c. A point at a ratio of m to n along the segment is a weighted average of the two ends, with each end weighted by the other part.

A triangle's area comes straight from its corners, with no angles or side lengths needed. This is half of a determinant, often called the shoelace formula.

D\displaystyle D=(xB−xA)(yC−yA)\displaystyle {}= (x_B - x_A)(y_C - y_A)−(xC−xA)(yB−yA)\displaystyle {}- (x_C - x_A)(y_B - y_A)
K\displaystyle K=12|D|\displaystyle {}= \frac{1}{2} |D|

The four centers answer four different questions. The centroid G is the balance point, the average of the corners. The circumcenter O is where the perpendicular bisectors of the sides meet, equally far from all three corners. The incenter I is equally far from all three sides, with each corner weighted by the side across from it. The orthocenter H is where the altitudes meet.

The Euler line ties three of them together, because G always sits one third of the way from O to H. So once G and O are known, H follows.

H\displaystyle H=3G−2O\displaystyle {}= 3G - 2O

Worked examples

Lena places a sprinkler between three trees

Lena maps three trees in meters at (0, 0), (6, 0) and (2, 4). The ground between them covers 12 m², and Heron's formula from the three sides gives the same 12.

She wants a sprinkler that reaches each tree equally, so she needs the circumcenter. It lies at (3, 1), which is 3.1623 m from every tree, and that is the throw it must have.

The balance point is another spot. The centroid is at 8 over 3 and 4 over 3, about (2.6667, 1.3333). All the centers sit inside because this triangle is acute, and its largest angle is 71.5651°.

Open this example in the tool

Tom sees centers fall outside an obtuse triangle

Tom's corners at (0, 0), (8, 0) and (1, 2) give an angle of 100.6197° at C. The area is 8, and the triangle is scalene.

The circumcenter lands at (4, −0.75), below the base, and the orthocenter lands at (1, 3.5), above the top corner. Both are outside the triangle. The centroid, at (3, 0.6667), and the incenter, at (1.478, 0.9134), stay inside, as they do for any triangle.

Open this example in the tool

Ines writes the line through two survey marks

The rise is −4 and the run is 6, so the slope is −2 over 3, about −0.6667. That gives y = −0.6667x + 1.6667, or 2x + 3y = 5 in whole numbers.

The two marks are 7.2111 apart, with their midpoint at (1, 1). Ines also wants a stake one third of the way along, a ratio of 1 to 2, which falls at (0, 1.6667). The line of points equally far from both marks is 3x − 2y = 1.

Open this example in the tool

Reading your result

The vertex order sets a sign. Going counterclockwise gives a positive signed area, and clockwise gives a negative one. Listing Lena's corners in the other order gives −12. The area itself is the size of that number, and the sign only tells you the direction.

The largest angle predicts where the centers land. With every angle under 90°, all four are inside. Over 90°, O and H are outside. At exactly 90°, O sits at the middle of the longest side and H at the right-angle corner: for (0, 0), (4, 0) and (0, 3), O is (2, 1.5) and H is (0, 0).

The converse of the Pythagorean theorem classifies by angle. With the longest side cc, the two squares on the shorter sides add up to more than c2c^{2} for an acute triangle, to the same for a right one, and to less for an obtuse one.

A flat or a steep line has a missing piece. A horizontal line through (0, 2) has slope 0 and never crosses the x-axis, and a vertical line has no slope or y-intercept. For (3, 1) and (3, 5), the equation is just x = 3.

Common mistakes

  • Subtracting in opposite orders. The slope needs the same point first on the top and the bottom. Swapping only one of them flips the sign of the slope.
  • Averaging for the wrong center. The average of the corners is the centroid. The circumcenter and the incenter need their own steps, and they only match it for an equilateral triangle.
  • Forgetting the incenter's weights. Each corner is weighted by the side across from it, not the side next to it. Using the wrong side shifts the point.
  • Treating points on one line as a triangle. Three such points have zero area, so there is no circle through them, and the tool says so.

Questions people ask

Yes. Multiply across the listed corners in pairs, take the differences, add them, then halve the size of the result. The same steps work for a four-sided shape or any simple polygon, as long as its edges do not cross.

Sources