# Engineering Statics: Open and Interactive

## Section7.7Centroids using Integration

In this section we will use the integral form of (7.4.2) to find the centroids of non-homogenous objects or shapes with curved boundaries.
\begin{align} \bar x \amp = \frac{ \int \bar{x}_{\text{el}}\ dA}{\int dA} \amp\bar y \amp= \frac{ \int \bar{y}_{\text{el}}\ dA}{\int dA} \amp\bar z \amp= \frac{ \int \bar{z}_{\text{el}}\ dA}{\int dA}\tag{7.7.1} \end{align}
With the integral equations we are mathematically breaking up a shape into an infinite number of infinitesimally small pieces and adding them together by integrating. This powerful method is conceptually identical to the discrete sums we introduced first.

### Subsection7.7.1Integration Process

Determining the centroid of a area using integration involves finding weighted average values $$\bar{x}$$ and $$\bar{y}\text{,}$$ by evaluating these three integrals,
\begin{align} A \amp = \int dA, \amp Q_x\amp =\int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA\tag{7.7.2} \end{align}
, where
• $$dA$$ is a differential bit of area called the element.
• $$A$$ is the total area enclosed by the shape, and is found by evaluating the first integral.
• $$\bar{x}_{\text{el}}$$ and $$\bar{y}_{\text{el}}$$ are the coordinates of the centroid of the element. These are frequently functions of $$x$$ or $$y\text{,}$$ not constant values.
• $$Q_x$$ and $$Q_y$$ are the First moments of Area with respect to the $$x$$ and $$y$$ axis.
The procedure for finding centroids with integration can be broken into three steps:
1. Set up the integrals.
Usually this is the hardest step.
You should always begin by drawing a sketch of the problem and reviewing the given information.
You will need to understand the boundaries of the shape, which may be lines or functions. You may need to know some math facts, like the definition of slope, or the equation of a line or parabola. A bounding function may be given as a function of $$x\text{,}$$ but you want it as a function of $$y,$$ or vice-versa or it may have a constant which you will need to determine.
You will need to choose an element of area $$dA\text{.}$$ There are several choices available, including vertical strips, horizontal strips, or square elements; or in polar coordinates, rings, wedges or squares. There really is no right or wrong choice; they will all work, but one may make the integration easier than another. The best choice depends on the nature of the problem, and it takes some experience to predict which it will be.
The two most common choices for differential elements are:
• Square elements and double integrals.
If you choose an infinitesimal square element $$dA = dx\;dy\text{,}$$ you must integrate twice, over $$x$$ and over $$y$$ between the appropriate integration limits. The position of the element typically designated $$(x,y)\text{.}$$
• Rectangular elements and single integrals.
If you choose rectangular strips you eliminate the need to integrate twice. You may select a vertical element with a different width $$dx\text{,}$$ and a height extending from the lower to the upper bound, or a horizontal strip with a differential height $$dy$$ and a width extending from the left to the right boundaries. Either way, you only integrate once to cover the enclosed area.
When finding the area enclosed by a single function $$y=f(x)\text{,}$$ and the $$x$$ and $$y$$ axes $$(x,y)$$ represents a point on the function and $$dA = y\ dx$$ for vertical strips, or $$dA = x\ dy$$ for horizontal strips.
You must find expressions for the area $$dA$$ and centroid of the element $$(\bar{x}_{\text{el}}, \bar{y}_{\text{el}})$$ in terms of the bounding functions. This is how we turn an integral over an area into a definite integral which can be integrated.
When you have established all these items, you can substitute them into (7.7.2) and proceed to the integration step.
2. Solve the integrals.
This step is pure mathematics.
Here are some tips if you are doing integration “by hand”. Be neat, work carefully, and check your work as you go along. Use proper mathematics notation: don’t lose the differential $$dx$$ or $$dy$$ before the integration step, and don’t include it afterwords. Don’t forget to use equals signs between steps. Simplify as you go and don’t substitute numbers or other constants too soon. Pay attention to units: Area $$A$$ should have units of $$[\textrm{length}]^2$$ and the first moments of area $$Q_x$$ and $$Q_y$$ should have units of $$[\textrm{length}]^3\text{.}$$ If your units aren’t consistent, then you have made a mistake.
3. Evaluate the centroid.
After you have evaluated the integrals you will have expressions or values for $$A\text{,}$$ $$Q_x\text{,}$$ and $$Q_y\text{.}$$ All that remains is to substitute these into the defining equations for $$\bar{x}$$ and $$\bar{y}$$ and simplify. Notice the $$Q_x$$ goes into the $$\bar{y}$$ equation, and vice-versa.
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y}\amp = \frac{Q_x}{A} \end{align*}
Finally, plot the centroid at $$(\bar{x}, \bar{y})$$ on your sketch and decide if your answer makes sense for area.

#### Thinking Deeper7.7.2.What is $$dA\text{?}$$

$$dA$$ is just an area, but an extremely tiny one!
It’s an example of an differential quantityalso called an infinitesimal. A differential quantity is a value which is as close to zero as it can possibly be without actually being zero. You can think of its value as $$\frac{1}{\infty}\text{.}$$ Integration is the process of adding up an infinite number of infinitesimal quantities.
Some other differential quantities we will see in statics are $$dx\text{,}$$ $$dy$$ and $$dz\text{,}$$ which are infinitesimal increments of distance; $$dV\text{,}$$ which is a differential volume; $$dW\text{,}$$ a differential weight; $$dm\text{,}$$ a differential mass, and so on.
Any product involving a differential quantity is itself a differential quantity, so if the area of a vertical strip is given by $$dA =y\ dx$$ then, even though height $$y$$ is a real number, the area is a differential because $$dx$$ is differential.
If you like, you can pronounce the $$d$$ as “the little bit of” so $$dA = y\ dx$$ reads “The little bit of area is the height $$y$$ times a little bit of $$x\text{.}$$” and $$A = \int dA$$ reads “The total area is the sum of the little bits of area.”

### Subsection7.7.2Area of a General Spandrel

In this section we will use the integration process describe above to calculate the area of the general spandrel shown in Figure 7.7.3. A spandrel is the area between a curve and a rectangular frame. This is a general spandrel because the curve is defined by the function $$y = k x^n\text{,}$$ where $$n$$ is not specified. If $$n = 0$$ the function is constant, if $$n=1$$ then it is a straight line, $$n=2$$ it’s a parabola, etc. . You can change the slider to see the effect of different values of $$n\text{.}$$
Begin by identifying the bounding functions. From the diagram, we see that the boundaries are the function, the $$x$$ axis and, the vertical line $$x = b\text{.}$$ The function $$y=kx^n$$ has a constant $$k$$ which has not been specified, but which is not arbitrary. The diagram indicates that the function passes through the origin and point $$(a,b)\text{,}$$ and there is only one value of $$k$$ which will cause this. We can find $$k$$ by substituting $$a$$ and $$b$$ into the function for $$x$$ and $$y$$ then solving for it.
\begin{align*} y \amp = k x^n\\ b \amp = k a^n\\ k \amp = \frac{b}{a^n} \end{align*}
Next, choose a differential area. For this problem a vertical strip works well. A vertical strip has a width $$dx\text{,}$$ and extends from the bottom boundary to the top boundary. Any point on the curve is $$(x,y)$$ and a point directly below it on the $$x$$ axis is $$(x,0)\text{.}$$ This means that the height of the strip is $$(y-0) = y$$ and the area of the strip is (base $$\times$$ height), so
\begin{equation*} dA =y\ dx\text{.} \end{equation*}
The limits on the integral are from $$x=0$$ on the left to $$x=a$$ on the right since we are integrating with respect to $$x\text{.}$$
With these details established, the next step is to set up and evaluate the integral $$A = \int dA = \int_0^a y\ dx\text{.}$$ This is the familiar formula from calculus for the area under a curve. Proceeding with the integration
\begin{align*} A \amp = \int_0^a y\ dx \amp \left(y = kx^n\right)\\ \amp = \int_0^a k x^n dx \amp \text{(integrate)}\\ \amp = k \left. \frac{x^{n+1}}{n+1} \right \vert_0^a \amp \text{(evaluate limits)} \\ \amp = k \frac{a^{n+1}}{n+1} \amp \left(k = \frac{b}{a^n}\right)\\ \amp = \frac{b}{a^n} \frac{a^{n+1}}{n+1} \text{(simplify)}\\ A \amp = \frac{ab}{n+1} \amp \text{(result)} \end{align*}
This result is not a number, but a general formula for the area under a curve in terms of $$a\text{,}$$ $$b\text{,}$$ and $$n\text{.}$$ Explore with the interactive, and notice for instance that when $$n=0\text{,}$$ the shape is a rectangle and $$A = ab\text{;}$$ when $$n=1$$ the shape is a triangle and the $$A = ab/2\text{;}$$ when $$n=2$$ the shape is a parabola and $$A = ab/3$$ etc. This single formula gives the equation for the area under a whole family of curves.

#### Thinking Deeper7.7.4.Which is better, horizontal or vertical elements?

Recall that the first moment of area $$Q_x = \int \bar{x}_{\text{el}}\ dA$$ is the distance weighted area as measured from a desired axis. The distance term $$\bar{x}_{\text{el}}$$ is the distance from the desired axis to the centroid of each differential element of area, $$dA\text{.}$$
If you’re using a single integral with a vertical element $$dA$$
\begin{equation*} dA = \underbrace{f(x)}_{\text{height}} \underbrace{(dx)}_{\text{base}} = y\,dx \end{equation*}
and the horizontal distance from the $$y$$ axis to the centroid of $$dA$$ would simply be
\begin{equation*} \bar{x}_{\text{el}}=x \end{equation*}
It is also possible to find $$\bar{x}$$ using a horizontal element but the computations are a bit more challenging. First the equation for $$dA$$ changes to
\begin{equation*} dA= \underbrace{g(y)}_{\text{height}} \underbrace{(dy)}_{\text{base}} = x\,dy\text{.} \end{equation*}
Additionally, the distance to the centroid of each element, $$\bar{x}_{\text{el}}\text{,}$$ must measure to the middle of the horizontal element. For this triangle,
\begin{equation*} \bar{x}_{\text{el}}=\frac{x}{2}\text{.} \end{equation*}
We find a similar contrast to finding the vertical centroidal distance $$\bar{y}$$ where it is easier to use a $$dy$$ element to find $$\bar{y}$$ than it is to use a $$dx$$ element.
The interactive below compares horizontal and vertical strips for a shape bounded by the parabola $$y^2 = x$$ and the diagonal line $$y = x-2\text{.}$$ Horizontal strips are a better choice in this case, because the left and right boundaries are easy to express as functions of $$y\text{.}$$ If vertical strips are chosen, the parabola must be expressed as two different functions of $$x\text{,}$$ and two integrals are needed to cover the area, the first from $$x=0$$ to $$x=1\text{,}$$ and the second from $$x=1$$ to $$x=4\text{.}$$

### Subsection7.7.3Examples

This section contains several examples of finding centroids by integration, starting with very simple shapes and getting progressively more difficult. All the examples include interactive diagrams to help you visualize the integration process, and to see how $$dA$$ is related to $$x$$ or $$y\text{.}$$
The first two examples are a rectangle and a triangle evaluated three different ways: with vertical strips, horizontal strips, and using double integration. The different approaches produce identical results, as you would expect. You should try to decide which method is easiest for a particular situation.

#### Example7.7.6.Centroid of a rectangle.

Use integration to show that the centroid of a rectangle with a base $$b$$ and a height of $$h$$ is at its center.
$$\bar{x} = b/2 \qquad \bar{y}=h/2\tag{7.7.3}$$
Solution 1.
This solution demonstrates solving integrals using vertical rectangular strips. Set the slider on the diagram to $$h\;dx$$ to see a representative element.
1. Set up the integrals.
The bounding functions in this example are vertical lines $$x=0$$ and $$x=a\text{,}$$ and horizontal lines $$y = 0$$ and $$y = h\text{.}$$
The strip extends from $$(x,0)$$ on the $$x$$ axis to $$(x,h)$$ on the top of the rectangle, and has a differential width $$dx\text{.}$$
The area of the strip is the base times the height, so
\begin{equation*} dA = h\ dx\text{.} \end{equation*}
The centroid of the strip is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = x \\ \bar{y}_{\text{el}} \amp = h/2 \end{align*}
With vertical strips the variable of integration is $$x\text{,}$$ and the limits on $$x$$ run from $$x=0$$ at the left to $$x=b$$ on the right. For a rectangle, both 0 and $$h$$ are constants, but in other situations, $$\bar{y}_{\text{el}}$$ and the left or right limits may be functions of $$x\text{.}$$
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate.
\begin{align*} A \amp = \int dA \amp Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^b h\ dx \amp \amp = \int_0^b \frac{h}{2} ( h\ dx ) \amp \amp = \int_0^b x\; (h\ dx)\\ \amp = \Big [ hx \Big ]_0^b \amp \amp = \frac{h^2}{2} \int_0^b dx \amp \amp = h \int_0^b x \ dx\\ \amp = hb - 0 \amp \amp = \frac{h^2}{2} \Big [x \Big ]_0^b \amp \amp = h \left[\frac{x^2}{2} \right ]_0^b\\ A \amp = bh \amp Q_x \amp = \frac{h^2 b}{2} \amp Q_y \amp = \frac{b^2 h}{2} \end{align*}
Unsurprisingly, we learn that the area of a rectangle is base times height. Since the area formula is well known, it was not really necessary to solve the first integral. Note that $$A$$ has units of $$[\textrm{length}]^2\text{,}$$ and $$Q_x$$ and $$Q_y$$ have units of $$[\textrm{length}]^3\text{.}$$
3. Find the centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{b^2h}{2} \bigg/ { bh} \amp \amp = \frac{h^2b}{2} \bigg/ { bh}\\ \amp = \frac{b}{2}\amp \amp = \frac{h}{2} \end{align*}
.
Solution 2.
This solution demonstrates solving integrals using horizontal rectangular strips. Set the slider on the diagram to $$b\;dy$$ to see a representative element.
1. Set up the integrals.
The bounding functions $$x=0\text{,}$$ $$x=a\text{,}$$ $$y = 0$$ and $$y = h\text{.}$$
The strip extends from $$(0,y)$$ on the $$y$$ axis to $$(b,y)$$ on the right, and has a differential height $$dy\text{.}$$
The area of the strip is the base times the height, so
\begin{equation*} dA = b\ dy\text{.} \end{equation*}
The centroid of the strip is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = b/2 \\ \bar{y}_{\text{el}} \amp = y \end{align*}
With horizontal strips the variable of integration is $$y\text{,}$$ and the limits on $$y$$ run from $$y=0$$ at the bottom to $$y = h$$ at the top.
For a rectangle, both 0 and $$h$$ are constants, but in other situations, $$\bar{x}_{\text{el}}$$ and the upper or lower limits may be functions of $$y\text{.}$$
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate. The results are the same as we found using vertical strips.
\begin{align*} A \amp = \int dA \amp Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^h b\ dy \amp \amp = \int_0^h y\ ( b\ dy ) \amp \amp = \int_0^h \frac{b}{2} (b\ dy)\\ \amp = \Big [ by \Big ]_0^h \amp \amp = b\int_0^h y\ dy \amp \amp = \frac{b^2}{2} \int_0^h dy\\ \amp = bh \amp \amp = b\ \Big [\frac{y^2}{2} \Big ]_0^h \amp \amp = \frac{b^2}{2} \Big[y \Big ]_0^h\\ A\amp = bh \amp Q_x \amp = \frac{h^2 b}{2} \amp Q_y \amp = \frac{b^2 h}{2} \end{align*}
3. Find the centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{b^2h}{2} \bigg/ { bh} \amp \amp = \frac{h^2b}{2} \bigg/ { bh}\\ \amp = \frac{b}{2}\amp \amp = \frac{h}{2} \end{align*}
.
Solution 3.
This solution demonstrates solving integrals using square elements and double integrals. Set the slider on the diagram to $$dx\;dy$$ to see a representative element.
1. Set up the integrals.
Set the slider on the diagram to $$dx\;dy$$ to see a representative element.
The bounding functions $$x=0\text{,}$$ $$x=a\text{,}$$ $$y = 0$$ and $$y = h\text{.}$$
Instead of strips, the integrals will be evaluated using square elements with width $$dx$$ and height $$dy$$ located at $$(x,y)\text{.}$$
The area of the square element is the base times the height, so
\begin{equation*} dA = dx\ dy = dy\ dx\text{.} \end{equation*}
The centroid of the strip is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = x \\ \bar{y}_{\text{el}} \amp = y \end{align*}
We will integrate twice, first with respect to $$y$$ and then with respect to $$x\text{.}$$ The limits on the first integral are $$y = 0$$ to $$h$$ and $$x = 0$$ to $$b$$ on the second. For a rectangle, both $$b$$ and $$h$$ are constants. In other situations, the upper or lower limits may be functions of $$x$$ or $$y\text{.}$$
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate the ‘inside’ integral, then the ‘outside’ integral. The results are the same as before.
\begin{align*} A \amp = \int dA \amp Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^b\int_0^h dy\ dx \amp \amp = \int_0^b\int_0^h y\ dy\ dx \amp \amp = \int_0^b \int_0^h x\ dy\ dx\\ \amp = \int_0^b \left[ \int_0^h dy \right] dx \amp \amp = \int_0^b \left[\int_0^h y\ dy\right] dx \amp \amp = \int_0^b x \left[ \int_0^h dy\right] dx\\ \amp = \int_0^b \Big[ y \Big]_0^h dx \amp \amp = \int_0^b \Big[ \frac{y^2}{2} \Big]_0^h dx \amp \amp = \int_0^b x \Big[ y \Big]_0^h dx\\ \amp = h \int_0^b dx \amp \amp = \frac{h^2}{2} \int_0^b dx \amp \amp = h\int_0^b x\ dx\\ \amp = h\Big [ x \Big ]_0^b \amp \amp =\frac{h^2}{2} \Big [ x \Big ]_0^b \amp \amp = h \Big [ \frac{x^2}{2} \Big ]_0^b \\ A\amp = hb \amp Q_x\amp = \frac{h^2b}{2} \amp Q_y \amp = \frac{b^2 h}{2} \end{align*}
3. Find the centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{b^2h}{2} \bigg/ { bh} \amp \amp = \frac{h^2b}{2} \bigg/ { bh}\\ \amp = \frac{b}{2}\amp \amp = \frac{h}{2} \end{align*}
.

#### Example7.7.8.Centroid of a triangle.

Use integration to locate the centroid of a triangle with base $$b$$ and height of $$h$$ oriented as shown in the interactive.
$$\bar{x} = \frac{2}{3}b \qquad \bar{y}=\frac{1}{3}h\tag{7.7.4}$$
Solution 1.
This solution demonstrates finding the centroid of the triangle using vertical strips $$dA = y\ dx\text{.}$$ Set the slider on the diagram to $$y\;dx$$ to see a representative element.
1. Set up the integrals.
The bounding functions in this example are the $$x$$ axis, the vertical line $$x = b\text{,}$$ and the straight line through the origin with a slope of $$\frac{h}{b}\text{.}$$ Using the slope-intercept form of the equation of a line, the upper bounding function is
\begin{equation*} y = f(x) = \frac{h}{b} x \end{equation*}
and any point on this line is designated $$(x,y)\text{.}$$
The strip extends from $$(x,0)$$ on the $$x$$ axis to $$(x,y)$$ on the function, has a height of $$y\text{,}$$ and a differential width $$dx\text{.}$$ The area of this strip is
\begin{equation*} dA = y dx\text{.} \end{equation*}
The centroid of the strip is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = x \\ \bar{y}_{\text{el}} \amp = y/2 \end{align*}
With vertical strips the variable of integration is $$x\text{,}$$ and the limits are $$x=0$$ to $$x=b\text{.}$$
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate. In contrast to the rectangle example both $$dA$$ and $$\bar{y}_{\text{el}}$$ are functions of $$x\text{,}$$ and will have to be integrated accordingly.
\begin{align*} A \amp = \int dA \amp Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^b y\ dx \amp \amp = \int_0^b \frac{y}{2} (y\ dx ) \amp \amp = \int_0^b x\; (y\ dx)\\ \amp = \int_0^b \frac{h}{b}x\ dx \amp \amp = \frac{1}{2} \int_0^b \left(\frac{h}{b} x\right)^2\ dx \amp \amp = \int_0^b x\; \left(\frac{h}{b} x \right) \ dx\\ \amp = \frac{h}{b} \Big [ \frac{x^2}{2} \Big ]_0^b \amp \amp = \frac{h^2}{2 b^2} \int_0^b x^2 dx \amp \amp = \frac{h}{b} \int_0^b x^2 \ dx\\ \amp = \frac{h}{\cancel{b}} \frac{b^{\cancel{2}}}{2} \amp \amp = \frac{h^2}{2b^2} \Big [\frac{x^3}{3} \Big ]_0^b \amp \amp = \frac{h}{b} \left[\frac{x^3}{3} \right ]_0^b\\ A \amp =\frac{bh}{2} \amp Q_x \amp = \frac{h^2 b}{6} \amp Q_y \amp = \frac{b^2 h}{3} \end{align*}
We learn that the area of a triangle is one half base times height. Since the area formula is well known, it would have been more efficient to skip the first integral. Note that $$A$$ has units of $$[\textrm{length}]^2\text{,}$$ and $$Q_x$$ and $$Q_y$$ have units of $$[\textrm{length}]^3\text{.}$$
3. Find the Centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{b^2h}{3} \bigg/ \frac{bh}{2} \amp \amp = \frac{h^2b}{6} \bigg/ \frac{bh}{2}\\ \amp = \frac{2}{3}b\amp \amp = \frac{1}{3}h \end{align*}
.
Solution 2.
This solution demonstrates solving integrals using horizontal rectangular strips. Set the slider on the diagram to $$(b-x)\;dy$$ to see a representative element.
1. Set up the integrals.
As before, the triangle is bounded by the $$x$$ axis, the vertical line $$x = b\text{,}$$ and the line
\begin{equation*} y = f(x) = \frac{h}{b} x\text{.} \end{equation*}
To integrate using horizontal strips, the function $$f(x)$$ must be inverted to express $$x$$ in terms of $$y\text{.}$$ Solving for $$f(x)$$ for $$x$$ gives
\begin{equation*} x = g(y) = \frac{b}{h} y\text{.} \end{equation*}
The limits on the integral are from $$y = 0$$ to $$y = h\text{.}$$
The strip extends from $$(x,y)$$ to $$(b,y)\text{,}$$ has a height of $$dy\text{,}$$ and a length of $$(b-x)\text{,}$$ therefore the area of this strip is
\begin{equation*} dA = (b-x) dy\text{.} \end{equation*}
The coordinates of the midpoint of the element are
\begin{align*} \bar{y}_{\text{el}} \amp = y\\ \bar{x}_{\text{el}} \amp = x + \frac{(b-x)}{2} = \frac{b+x}{2} \end{align*}
.
These expressions are recognized as the average of the $$x$$ and $$y$$ coordinates of strip’s endpoints.
A common student mistake is to use $$dA = x\ dy\text{,}$$ and $$\bar{x}_{\text{el}} = x/2\text{.}$$ These would be correct if you were looking for the properties of the area to the left of the curve.
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into the definitions of $$Q_x$$ and $$Q_y$$ and integrate. The results are the same as we found using vertical strips. There in no need to evaluate $$A = \int dA$$ since we know that $$A = \frac{bh}{2}$$ for a triangle.
\begin{align*} Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^h y\ (b-x) \ dy \amp \amp = \int_0^h \frac{(b+x)}{2} (b-x)\ dy\\ \amp = \int_0^h \left( by - xy\right) \ dy \amp \amp = \frac{1}{2}\int_0^h \left(b^2-x^2\right)\ dy\\ \amp = \int_0^h \left( by -\frac{by^2}{h}\right) dy \amp \amp = \frac{1}{2}\int_0^h\left( b^2 - \frac{b^2y^2}{h^2}\right) dy\\ \amp = b \Big [\frac{ y^2}{2} - \frac{y^3}{3h} \Big ]_0^h \amp \amp = \frac{b^2}{2} \Big[y - \frac{y^3}{3 h^2}\Big ]_0^h\\ \amp = bh^2 \Big (\frac{1}{2} - \frac{1}{3} \Big ) \amp \amp = \frac{1}{2}( b^2h) \Big(1 - \frac{1}{3}\Big )\\ Q_x \amp = \frac{h^2 b}{6} \amp Q_y \amp = \frac{b^2 h}{3} \end{align*}
It makes solving these integrals easier if you avoid prematurely substituting in the function for $$x$$ and if you factor out constants whenever possible. Here it $$x = g(y)$$ was not substituted until the fourth line.
3. Find the centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{b^2h}{3} \bigg/ \frac{bh}{2} \amp \amp = \frac{h^2b}{6} \bigg/ \frac{bh}{2}\\ \amp = \frac{2}{3}b\amp \amp = \frac{1}{3}h \end{align*}
.
Solution 3.
This solution demonstrates solving integrals using square elements and double integrals. Set the slider on the diagram to $$dx\;dy$$ or $$dy\;dx$$ to see a representative element.
1. Set up the integrals.
As before, the triangle is bounded by the $$x$$ axis, the vertical line $$x = b\text{,}$$ and the line
\begin{equation*} y = f(x) = \frac{h}{b} x \quad \text{or in terms of } y, \quad x = g(y) = \frac{b}{h} y\text{.} \end{equation*}
In this solution the integrals will be evaluated using square differential elements $$dA=dy\; dx$$ located at $$(x,y)\text{.}$$
With double integration, you must take care to evaluate the limits correctly, since the limits on the inside integral are functions of the variable of integration of the outside integral. The inside integral essentially stacks the elements into strips and the outside integral adds all the strips to cover the area.
Choosing to express $$dA$$ as $$dy\;dx$$ means that the integral over $$y$$ will be conducted first. The limits on the inside integral are from $$y = 0$$ to $$y = f(x)\text{.}$$ Then, the limits on the outside integral are from $$x = 0$$ to $$x=b.$$
Using $$dA= dx\;dy$$ would reverse the order of integration, so the inside integral’s limits would be from $$x = g(y)$$ to $$x = b\text{,}$$ and the limits on the outside integral would be $$y=0$$ to $$y = h\text{.}$$ Either choice will give the same results —if you don’t make any errors!
The area of the square element is the base times the height, so
\begin{equation*} dA = dy\ dx\text{.} \end{equation*}
The centroid of the square is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = x \\ \bar{y}_{\text{el}} \amp = y \end{align*}
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate the ‘inside’ integral, then the ‘outside’ integral. The results are the same as before.
\begin{align*} Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^b\int_0^{f(x)} y\ dy\ dx \amp \amp = \int_0^b \int_0^{f(x)} x\ dy\ dx\\ \amp = \int_0^b \left[\int_0^{f(x)} y\ dy\right] dx \amp \amp = \int_0^b x \left[ \int_0^{f(x)} dy\right] dx\\ \amp = \int_0^b \left[ \frac{y^2}{2} \right]_0^{f(x)} dx \amp \amp = \int_0^b x \bigg[ y \bigg]_0^{f(x)} dx\\ \amp = \frac{1}{2}\int_0^b \left[ \frac{h^2}{b^2} x^2 \right] dx \amp \amp = \int_0^b x \left[ \frac{h}{b} x \right] dx\\ \amp = \frac{h^2}{2b^2} \int_0^b x^2 dx \amp \amp = \frac{h}{b}\int_0^b x^2\ dx\\ \amp =\frac{h^2}{2b^2} \Big [\frac{x^3}{3} \Big ]_0^b \amp \amp = \frac{h}{b} \Big [ \frac{x^3}{3} \Big ]_0^b \\ Q_x \amp = \frac{h^2 b}{6} \amp Q_y \amp = \frac{b^2 h}{3} \end{align*}
3. Find the centroid.
Substituting Q_x and $$Q_y$$ along with $$A = bh/2$$ into the centroid definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{b^2h}{3} \bigg/ \frac{bh}{2} \amp \amp = \frac{h^2b}{6} \bigg/ \frac{bh}{2}\\ \amp = \frac{2}{3}b\amp \amp = \frac{1}{3}h \end{align*}
.
The next two examples involve areas with functions for both boundaries,

#### Example7.7.10.Centroid of a semi-parabola.

Find the coordinates of the centroid of a parabolic spandrel bounded by the $$y$$ axis, a horizontal line passing through the point $$(a,b),$$ and a parabola with a vertex at the origin and passing through the same point. $$a$$ and $$b$$ are positive integers.
\begin{equation*} \bar{x} = \frac{3}{8} a \qquad \bar{y} \frac{2}{5} b \end{equation*}
Solution.
We will use (7.7.2) with vertical strips to find the centroid of a spandrel.
1. Set up the integrals.
Determining the bounding functions and setting up the integrals is usually the most difficult part of problems like this. Begin by drawing and labeling a sketch of the situation.
1. Place a point in the first quadrant and label it $$P=(a,b)\text{.}$$ This point is in the first quadrant and fixed since we are told that $$a$$ and $$b$$ are positive integers
2. Place a horizontal line through $$P$$ to make the upper bound.
3. Sketch in a parabola with a vertex at the origin and passing through $$P$$ and shade in the enclosed area.
4. Decide which differential element you intend to use. For this example we choose to use vertical strips, which you can see if you tick show strips in the interactive above. Horizontal strips $$dA = x\ dy$$ would give the same result, but you would need to define the equation for the parabola in terms of $$y\text{.}$$
Determining the equation of the parabola and expressing it in terms of $$x$$ and any known constants is a critical step. You should remember from algebra that the general equation of parabola with a vertex at the origin is $$y = k x^2\text{,}$$ where $$k$$ is a constant which determines the shape of the parabola. If $$k \gt 0\text{,}$$ the parabola opens upward and if $$k \lt 0\text{,}$$ the parabola opens downward.
To find the value of $$k\text{,}$$ substitute the coordinates of $$P$$ into the general equation, then solve for $$k\text{.}$$
\begin{align*} y \amp = k x^2, \text{ so at } P \\ (b) \amp = k (a)^2\\ k \amp= \frac{b}{a^2} \end{align*}
The resulting function of the parabola is
\begin{equation*} y = y(x) = \frac{b}{a^2} x^2\text{.} \end{equation*}
To perform the integrations, express the area and centroidal coordinates of the element in terms of the points at the top and bottom of the strip. The area of the strip is its height times its base, so
\begin{equation*} dA = (b-y)\ dx\text{.} \end{equation*}
If you incorrectly used $$dA = y\ dx\text{,}$$ you would find the centroid of the spandrel below the curve.
For vertical strips, the bottom is at $$(x,y)$$ on the parabola, and the top is directly above at $$(x,b)\text{.}$$ The strip has a differential width $$dx\text{.}$$ The centroid of the strip is located at its midpoint and the coordinates are found by averaging the $$x$$ and $$y$$ coordinates of the points at the top and bottom.
\begin{align*} \bar{x}_{\text{el}} \amp = (x + x)/2 = x\\ \bar{y}_{\text{el}} \amp = (y+b)/2 \end{align*}
For vertical strips, the integrations are with respect to $$x\text{,}$$ and the limits on the integrals are $$x=0$$ on the left to $$x = a$$ on the right.
2. Solve the integrals.
We have already established that $$y(x) = k x^2$$ where $$k = b/a^2\text{.}$$ To simplify the algebra, it is best not to prematurely substitute y(x) and $$k\text{,}$$ but you must substitute in any functions of $$x$$ before you do the integration step.
\begin{align*} A \amp = \int dA \amp Q_x \amp = \int \bar{y}_{\text{el}} dA \amp Q_y \amp = \int \bar{x}_{\text{el}} dA \\ \amp = \int_0^a (b-y)\ dx \amp \amp = \int_0^a \frac{(b+y)}{2} (b-y) dx \amp \amp = \int_0^a x (b-y)\ dx\\ \amp = \int_0^a (b-kx^2)\ dx \amp \amp = \frac{1}{2}\int_0^a (b^2-y^2)\ dx \amp \amp = \int_o^a x (b-y) \ dx\\ \amp = \left. bx - k \frac{x^3}{3} \right |_0^a \amp \amp = \frac{1}{2} \int_0^a (b^2-(k x^2)^2)\ dx \amp \amp = \int_o^a x (b-k x^2) \ dx\\ \amp = ba - k \frac{a^3}{3} \amp \amp = \frac{1}{2} \int_0^a (b^2-k^2 x^4)\ dx \amp \amp = \int_o^a (bx-k x^3) \ dx\\ \amp = ba - \left(\frac{b}{a^2}\right)\frac{a^3}{3} \amp \amp = \frac{1}{2} \left[b^2 x - k^2 \frac{x^5}{5} \right ]_0^a \amp \amp = \left[\frac{bx^2}{2} - k \frac{x^4}{4}\right ]_0^a\\ \amp = \frac{3ba}{3} - \frac{ba}{3} \amp \amp = \frac{1}{2} \left[b^2 a - \left(\frac{b}{a^2}\right)^2 \frac{a^5}{5} \right ] \amp \amp = \left[\frac{ba^2}{2} - \left(\frac{b}{a^2}\right) \frac{4^4}{4}\right ]\\ \amp = \frac{2}{3} ba \amp \amp = \frac{1}{2} b^2a \left[1-\frac{1}{5}\right] \amp \amp = ba^2\left[\frac{1}{2} - \frac{1}{4}\right]\\ A \amp = \frac{2}{3} ba \amp Q_x \amp = \frac{2}{5} b^2a \amp Q_y \amp = \frac{1}{4} ba^2 \end{align*}
The area of the spandrel is $$2/3$$ of the area of the enclosing rectangle and the moments of area have units of $$[\textrm{length}]^3\text{.}$$
3. Find the centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = {Q_x}{A}\\ \amp = \frac{ba^2}{4 } \bigg/ \frac{2 ba}{3} \amp \amp = \frac{2 b^2a }{5}\bigg/ \frac{2 ba}{3}\\ \amp = \frac{3}{8} a \amp \amp = \frac{2}{5} b \end{align*}
.
$$\bar{x}$$ is $$3/8$$ of the width and $$\bar{y}$$ is $$2/5$$ of the height of the enclosing rectangle.

#### Example7.7.12.Centroid of an area between two curves.

Use integration to locate the centroid of the area bounded by
\begin{equation*} y_1 = \dfrac{x}{4} \text{ and }y_2 = \dfrac{x^2}{2}\text{.} \end{equation*}
Find the centroid location $$(\bar{x}\text{, }\bar{y})$$ of the shaded area between the two curves below.
$$\bar{x} = \frac{1}{4} \qquad \bar{y}=\frac{1}{20}\tag{7.7.5}$$
Solution 1.
This solution demonstrates finding the centroid of the area between two functions using vertical strips $$dA = y\ dx\text{.}$$ Set the slider on the diagram to $$h\;dx$$ to see a representative element.
1. Set up the integrals.
The bounding functions in this example are the $$x$$ axis, the vertical line $$x = b\text{,}$$ and the straight line through the origin with a slope of $$\frac{h}{b}\text{.}$$ Using the slope-intercept form of the equation of a line, the upper bounding function is
\begin{equation*} y = f(x) = \frac{h}{b} x \end{equation*}
and any point on this line is designated $$(x,y)\text{.}$$
The strip extends from $$(x,0)$$ on the $$x$$ axis to $$(x,y)$$ on the function, has a height of $$y\text{,}$$ and a differential width $$dx\text{.}$$ The area of this strip is
\begin{equation*} dA = y dx\text{.} \end{equation*}
The centroid of the strip is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = x \\ \bar{y}_{\text{el}} \amp = y/2 \end{align*}
With vertical strips the variable of integration is $$x\text{,}$$ and the limits are $$x=0$$ to $$x=b\text{.}$$
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate. In contrast to the rectangle example both $$dA$$ and $$\bar{y}_{\text{el}}$$ are functions of $$x\text{,}$$ and will have to be integrated accordingly.
\begin{align*} A \amp = \int dA \\ \amp = \int_0^{1/2} (y_1 - y_2) \ dx \\ \amp = \int_0^{1/2} \left (\frac{x}{4} - \frac{x^2}{2}\right) \ dx \\ \amp = \Big [ \frac{x^2}{8} - \frac{x^3}{6} \Big ]_0^{1/2} \\ \amp = \Big [ \frac{1}{32} - \frac{1}{48} \Big ] \\ A \amp =\frac{1}{96} \end{align*}
\begin{align*} Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^{1/2} \left(\frac{y_1+y_2}{2} \right) (y_1-y_2)\ dx \amp \amp = \int_0^{1/2} x(y_1-y_2)\ dx\\ \amp = \frac{1}{2} \int_0^{1/2} \left(y_1^2 - y_2^2 \right)\ dx \amp \amp = \int_0^{1/2} x\left(\frac{x}{4} - \frac{x^2}{2}\right) \ dx\\ \amp = \frac{1}{2} \int_0^{1/2} \left(\frac{x^2}{16} - \frac{x^4}{4}\right)\ dx\amp \amp = \int_0^{1/2}\left(\frac{x^2}{4} - \frac{x^3}{2}\right)\ dx\\ \amp = \frac{1}{2} \Big [\frac{x^3}{48}-\frac{x^5}{20} \Big ]_0^{1/2} \amp \amp = \left[\frac{x^3}{12}- \frac{x^4}{8} \right ]_0^{1/2}\\ \amp = \frac{1}{2} \Big [\frac{1}{384}-\frac{1}{640} \Big ] \amp \amp = \Big [\frac{1}{96}-\frac{1}{128} \Big ] \\ Q_x \amp = \frac{1}{1920} \amp Q_y \amp = \frac{1}{384} \end{align*}
3. Find the Centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{1}{384} \bigg/ \frac{1}{96} \amp \amp = \frac{1}{1920} \bigg/ \frac{1}{96}\\ \bar{x} \amp= \frac{1}{4} \amp \bar{y}\amp =\frac{1}{20} \end{align*}
.
Solution 2.
This solution demonstrates finding the centroid of the area between two functions using vertical strips $$dA = y\ dx\text{.}$$ Set the slider on the diagram to $$h\;dx$$ to see a representative element.
1. Set up the integrals.
The bounding functions in this example are the $$x$$ axis, the vertical line $$x = b\text{,}$$ and the straight line through the origin with a slope of $$\frac{h}{b}\text{.}$$ Using the slope-intercept form of the equation of a line, the upper bounding function is
\begin{equation*} y = f(x) = \frac{h}{b} x \end{equation*}
and any point on this line is designated $$(x,y)\text{.}$$
The strip extends from $$(x,0)$$ on the $$x$$ axis to $$(x,y)$$ on the function, has a height of $$y\text{,}$$ and a differential width $$dx\text{.}$$ The area of this strip is
\begin{equation*} dA = y dx\text{.} \end{equation*}
The centroid of the strip is located at its midpoint so, by inspection
\begin{align*} \bar{x}_{\text{el}} \amp = x \\ \bar{y}_{\text{el}} \amp = y/2 \end{align*}
With vertical strips the variable of integration is $$x\text{,}$$ and the limits are $$x=0$$ to $$x=b\text{.}$$
2. Solve the integrals.
Substitute $$dA\text{,}$$ $$\bar{x}_{\text{el}}\text{,}$$ and $$\bar{y}_{\text{el}}$$ into (7.7.2) and integrate. In contrast to the rectangle example both $$dA$$ and $$\bar{y}_{\text{el}}$$ are functions of $$x\text{,}$$ and will have to be integrated accordingly.
\begin{align*} A \amp = \int dA \\ \amp = \int_0^y (x_2 - x_1) \ dy \\ \amp = \int_0^{1/8} \left (4y - \sqrt{2y} \right) \ dy \\ \amp = \Big [ 2y^2 - \frac{4}{3} y^{3/2} \Big ]_0^{1/8} \\ \amp = \Big [ \frac{1}{32} - \frac{1}{48} \Big ] \\ A \amp =\frac{1}{96} \end{align*}
\begin{align*} Q_x \amp = \int \bar{y}_{\text{el}}\ dA \amp Q_y \amp = \int \bar{x}_{\text{el}}\ dA \\ \amp = \int_0^{1/8} y (x_2-x_1)\ dy \amp \amp = \int_0^{1/8} \left(\frac{x_2+x_1}{2} \right) (x_2-x_1)\ dy\\ \amp = \int_0^{1/8} y \left(\sqrt{2y}-4y\right)\ dy \amp \amp = \frac{1}{2} \int_0^{1/8} \left(x_2^2 - x_1^2\right) \ dy\\ \amp = \int_0^{1/8} \left(\sqrt{2} y^{3/2} - 4y^2 \right)\ dy\amp \amp = \frac{1}{2} \int_0^{1/8}\left(2y -16 y^2\right)\ dy\\ \amp = \Big [\frac{2\sqrt{2}}{5} y^{5/2} -\frac{4}{3} y^3 \Big ]_0^{1/8} \amp \amp = \frac{1}{2} \left[y^2- \frac{16}{3}y^3 \right ]_0^{1/8}\\ \amp = \Big [\frac{1}{320}-\frac{1}{384} \Big ] \amp \amp = \frac{1}{2} \Big [\frac{1}{64}-\frac{1}{96} \Big ] \\ Q_x \amp = \frac{1}{1920} \amp Q_y \amp = \frac{1}{384} \end{align*}
3. Find the Centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{x} \amp = \frac{Q_y}{A} \amp \bar{y} \amp = \frac{Q_x}{A}\\ \amp = \frac{1}{384} \bigg/ \frac{1}{96} \amp \amp = \frac{1}{1920} \bigg/ \frac{1}{96}\\ \bar{x} \amp= \frac{1}{4} \amp \bar{y}\amp =\frac{1}{20} \end{align*}
.
The last example demonstrates using double integration with polar coordinates.

#### Example7.7.14.Centroid of a semi-circle.

Find the coordinates of the top half of a circle with radius $$r\text{,}$$ centered at the origin.
The centroid of a semicircle with radius $$r\text{,}$$ centered at the origin is
$$\bar{x} = 0 \qquad \bar{y} = \frac{4r}{3\pi}\tag{7.7.6}$$
Solution.
We will use (7.7.2) with polar coordinates $$(\rho, \theta)$$ to solve this problem because they are a natural fit for the geometry. In polar coordinates, the equation for the bounding semicircle is simply
\begin{equation*} \rho = r\text{.} \end{equation*}
Normally this involves evaluating three integrals but as you will see, we can take some shortcuts in this problem. Otherwise we will follow the same procedure as before.
1. Set up the integrals.
Divide the semi-circle into "rectangular" differential elements of area $$dA\text{,}$$ as shown in the interactive when you select Show element. This shape is not really a rectangle, but in the limit as $$d\rho$$ and $$d\theta$$ approach zero, it doesn’t make any difference.
The radial height of the rectangle is $$d\rho$$ and the tangential width is the arc length $$\rho d\theta\text{.}$$ The product is the differential area $$dA\text{.}$$
$$dA = (d\rho)(\rho\ d\theta) = \rho\ d\rho\ d\theta\text{.}\tag{7.7.7}$$
The differential element is located at $$(\rho, \theta)$$ in polar coordinates. Expressing this point in rectangular coordinates gives
\begin{align*} \bar{x}_{\text{el}} \amp = \rho \cos \theta\\ \bar{y}_{\text{el}} \amp = \rho \sin \theta \end{align*}
.
2. Solve the integrals.
The area of a semicircle is well known, so there is no need to actually evaluate $$A = \int dA\text{,}$$
\begin{equation*} A = \int dA = \frac{\pi r^2}{2}\text{.} \end{equation*}
Since the semi-circle is symmetrical about the $$y$$ axis,
\begin{equation*} Q_y = \int \bar{x}_{\text{el}}\; dA= 0\text{.} \end{equation*}
This is because each element of area to the right of the $$y$$ axis is balanced by a corresponding element the same distance the left which cancel each other out in the sum.
All that remains is to evaluate the integral $$Q_x$$ in the numerator of
\begin{equation*} \bar{y} = \frac{Q_x}{A} = \frac{\bar{y}_{\text{el}}\; dA}{A} \end{equation*}
The differential area $$dA$$ is the product of two differential quantities, we will need to perform a double integration.
\begin{align*} Q_x \amp = \int \bar{y}_{\text{el}} dA \\ \amp = \int_0^\pi \int_0^r (\rho \sin \theta) \rho \; d\rho\; d\theta\\ \amp = \int_0^\pi \sin \theta \left[ \int_0^r \rho^2 \; d\rho\right ] d\theta\\ \amp = \int_0^\pi \sin \theta \left[ \frac{\rho^3} {3}\right ]_0^r \; d\theta\\ \amp = \frac{r^3}{3} \ \int_0^\pi \sin \theta \; d\theta\\ \amp = \frac{r^3}{3} \left[ - \cos \theta \right]_0^\pi\\ \amp = -\frac{r^3}{3} \left[ \cos \pi - \cos 0 \right ]\\ \amp = -\frac{r^3}{3} \left[ (-1) - (1) \right ]\\ Q_x \amp = \frac{2}{3} r^3 \end{align*}
3. Find the centroid.
Substituting the results into the definitions gives
\begin{align*} \bar{y} \amp = \frac{Q_x}{A} \\ \amp = \frac{2 r^3}{3} \bigg/ \frac{\pi r^2}{2}\\ \amp = \frac{4r}{3\pi} \end{align*}
.
So $$\bar{x}=0$$ and lies on the axis of symmetry, and $$\bar{y} =\dfrac{4r}{3\pi}$$ above the diameter.
This result can be extended by noting that a semi-circle is mirrored quarter-circles on either side of the $$y$$ axis. These must have the same $$\bar{y}$$ value as the semi-circle. Further, quarter-circles are symmetric about a $$\ang{45}$$ line, so for the quarter-circle in the first quadrant,
\begin{equation*} \bar{x} = \bar{y} = \frac{4r}{3\pi}\text{.} \end{equation*}