With this centroid calculator, we're giving you a hand at finding the centroid of many 2D shapes, as well as of a set of points. In just a few clicks and several numbers inputted, you can find the centroid of a rectangle, triangle, trapezoid, kite, or any other shape imaginable — the only restrictions are that the polygon should be closed, non-self-intersecting, and consist of a maximum of ten vertices. Also, if you're searching for a simple centroid definition, or formulas explaining how to find the centroid, you won't be disappointed — we have it all.
What is centroid?
A centroid, also called a geometric center, is the center of mass of an object of uniform density. To make it easier to understand, you can imagine it as the point on which you should position the tip of a pin to have your geometric figure balanced on it.
We now know the centroid definition, so let's discuss how to localize it. In the following section, we show you the centroid formula.
What is the formula for the centroid?
In general, a centroid is the arithmetic mean of all the points in the shape. The x- and y-coordinate of the centroid read
Gₓ = (x₁ + x₂ + x₃ + ... + xk) / k
Gᵧ = (y₁ + y₂ + y₃ +... + yk) / k
where (x₁,y₁), ..., (xk,yk) are the vertices of our shape.
For convex shapes, the centroid lays inside the object; for concave ones, the centroid can lay outside (e.g., in a ring-shaped object).
Finding the centroid of a triangle or a set of points is an easy task – the formula is really intuitive. However, if you're searching for the centroid of a polygon – like a rectangle, a trapezoid, a rhombus, a parallelogram, an irregular quadrilateral shape, or another polygon- it is, unfortunately, a bit more complicated.
What is the centroid formula for a triangle?
To find the centroid of a triangle ABC, you need to find the average of vertex coordinates. So if A = (X₁,Y₁), B = (X₂,Y₂), C = (X₃,Y₃), the centroid formula is:
G = [ (X₁ + X₂ + X₃)/3 , (Y₁ + Y₂ + Y₃)/3 ]
If you don't want to do it by hand, just use our centroid calculator! 🙂
🙋 In a triangle, the centroid is the point at which all three medians intersect. That means it's one of a triangle's points of concurrency. Also, a centroid divides each median in a 2:1 ratio (the bigger part is closer to the vertex).
For special triangles, you can find the centroid quite easily:
Centroid of an equilateral triangle
If you know the side length, a, you can find the centroid of an equilateral triangle:
G = (a/2, a√3/6)
(you can determine the value of a with our equilateral triangle calculator)
Centroid of an isosceles triangle
If your isosceles triangle has legs of length l and height h, then the centroid is described as:
G = (l/2, h/3)
(if you don't know the leg length l or the height h, you can find them with our isosceles triangle calculator)
Centroid of a right triangle
For a right triangle, if you're given the two legs, b and h, you can find the right centroid formula straight away:
G = (b/3, h/3)
(the right triangle calculator can help you to find the legs of this type of triangle)
Sometimes people wonder what the midpoint of a triangle is — but hey, there's no such thing! The midpoint is a term tied to a line segment. It's the middle point of a line segment and therefore does not apply to 2D shapes.
However, you can say that the midpoint of a segment is both the centroid of the segment and the centroid of the segment's endpoints.
You can check it in this centroid calculator: choose the N-points option from the drop-down list, enter 2 points, and input some random coordinates. The result should be equal to the outcome from the midpoint calculator.
(Keep in mind that calculations won't work if you use the second option, the N-sided polygon. Why? That's because that formula uses the shape area, and a line segment doesn't have one).
Centroid of a set of points
To find the centroid of a set of k points, you need to calculate the average of their coordinates:
Gₓ = (x₁ + x₂ + x₃ +... + xk) / k
Gᵧ = (y₁ + y₂ + y₃ +... + yk) / k
And that's it! Did you notice that it's the general formula we presented before?
Calculating the centroid of a set of points is used in many different real-life applications, e.g., in data analysis. The most popular method is K-means clustering, where an algorithm tries to minimize the squared distance between the data points and the cluster's centroids.
Centroid of a polygon (centroid of a trapezoid, centroid of a rectangle, and others)
To calculate a polygon's centroid, G(Cx, Cy), which is defined by its n vertices (x0,y), (x1,y1), ..., (xn-1,yn-1), all you need to do is to use these following three formulas:
where A is a polygon's signed area:
Remember that the vertices should be inputted in order, and the polygon should be closed — meaning that the vertex (x0, y0) is the same as the vertex (xn, yn).
If that centroid formula scares you a bit, wait no further — use this centroid calculator, as we've implemented that equation for you.
Even though you can find many different formulas for a centroid of a trapezoid on the Internet, the equations presented above are universal — you don't need to have the origin coinciding with one vertex, nor the trapezoid base in line with the x-axis. Here, you can find the centroid position by knowing just the vertices. The same applies to the centroid of a rectangle, rhombus, parallelogram, pentagon, or any other closed, non-self-intersecting polygon.
To use this centroid calculator, simply input the vertices of your shape as Cartesian coordinates. Let's check how to find the centroid of a trapezoid:
Choose the type of shape for which you want to calculate the centroid. In our case, we will choose an N-sided polygon.
Enter the parameter for N (if required). For our example, we need to input the number of sides of our polygon. As the trapezoid is, of course, the quadrilateral, we type 4 into the N box.
- The fields for inputting coordinates will then appear. Enter the coordinates of the vertices of your shape. Let's assume our trapezoid vertices are:
- A = (1,1)
- B = (2,4)
- C = (5,4)
- D = (11,1)
- Our centroid calculator will then display the answer! The centroid of the trapezoid of our choice is (4.974, 2.231).
How do I construct the centroid in a triangle?
Recall the centroid is the point at which the medians intersect. Hence, to construct the centroid in a given triangle:
- Construct the perpendicular bisectors of any two sides to find their midpoints.
- Draw the medians: connect the midpoints with the opposite vertices.
- The intersection point of these medians is the centroid of your triangle. Congrats!
How do I compute the centroid in a polygon?
Here's how you can quickly determine the centroid of a polygon:
- Write down the coordinates of each polygon vertex.
- Count the vertices and denote their number by
- Add all the
xvalues from the vertices and divide the sum by
- Add all the
yvalues from the vertices and divide the sum by
- That's it! The result from Step 3 is the x-coordinate of the centroid. The result from Step 4 is the y-coordinate of the centroid.
What is the centroid of a (0,0), (0,3), (3,3) triangle?
Recall the coordinates of the centroid are the averages of vertex coordinates. So for the given vertices, we have:
G = [(0 + 0 + 3)/3, (0 + 3 + 3)/3] = [1,2]