Consider the parabola $18x-3x^2-12$ (https://www.desmos.com/calculator/efel9y5dbj). It is required to find the centroid of this parabola contained between x=0 and x=2. For x=0 to x=0.764 its ordinates are negative and beyond x=0.764 the ordinates are positive. I considered the two areas separately and tried determining the centroid. However something is going wrong. The area enclosed between x=0 to x=0.764 is 4.3607 and the other area is 8.3607.
The centroid of area between x=0 to x=0.764 is,0.2481. The centroid of the other area is 1.5647, measured from the origin. When I use the formula for finding the centroid of composite sections, it gives a value of 3. But, it can't be correct as the parabola taken here has its domain limited to x=2. I am completely clueless about how to do it correctly.
Let $f(x)=18x-3x^2-12$. First of all, the area $A$ of your region is $$ \int_0^{3-\sqrt5}\int_{f(x)}^01\,dy\,dx+\int_{3-\sqrt5}^2\int_0^{f(x)}1\,dy\,dx=20\sqrt5-32. $$ Now, the $x$-coordinate of the centroid is \begin{align} \frac1A\left(\int_0^{3-\sqrt5}\int_{f(x)}^0x\,dy\,dx+\int_{3-\sqrt5}^2\int_0^{f(x)}x\,dy\,dx\right)&=\frac{15}{61} \left(9-2 \sqrt{5}\right)\\ &\approx1.11341 \end{align} and the $y$-coordinate of the centroid is \begin{align} \frac1A\left(\int_0^{3-\sqrt5}\int_{f(x)}^0y\,dy\,dx+\int_{3-\sqrt5}^2\int_0^{f(x)}y\,dy\,dx\right)&=\frac{6}{305} \left(209-60 \sqrt{5}\right)\\ &\approx1.47218. \end{align}