calculating center of mass of the semicircle which the density at any point is proportional the distance from the center Assuming the radius is r, and the origin is put on the center of the semicircle.
Using polar coordinates. first, because symmetry, the $\bar{x}$ is 0, now trying to find $\bar{y}$:
the mass of the semicircle is 
$$\mathrm{\iint_D\rho\,dA=\iint_D(kr)rdrd\theta=\int_0^\pi\int_0^a(kr)rdrd\theta=\frac{k\pi\,a^3}{3}}$$
the y cordinates of the center of mass is 
 $$\mathrm{\bar{y}=\frac{1}{m}\iint_Dy\rho(x,y)\,dA=\frac{3}{k\pi a^3}\int_0^\pi\int_0^a\,r\sin(\theta)rdrd\theta=\frac{3a}{2\pi}}$$
However, when computing the center of mass, I was trying to find $\bar{r}$ and $\bar{\theta}$ instead of $\bar{y}$. 
$$ \mathrm{\bar{\theta}=\frac{1}{m}\int_0^\pi\int_0^a\theta(kr)rdrd\theta=\frac{\pi}{2} }$$
which is good. however, $\bar{r}$ went wrong.
$$\mathrm{\bar{r}=\frac{1}{m}\int_0^\pi\int_0^ar(kr)rdrd\theta}=\frac{3a}{4}\neq\frac{3a}{2\pi}$$
I have spent a lot of time on this , but fail to figure what went wrong. I believe the calculation is correct, at least I hope so. Any imputs would be appreciated.
 A: You don't need to use Polar Coordinates.
With the same set-up as you have described, consider semi-circular elements of radius $x$ and thickness $\delta x$
Then the area element is $\delta A=\pi x\delta x$
Now if the density per unit area is $\rho =kx$, then the mass element is $$\delta m=\pi kx^2\delta x$$
Integrating gives the mass of the lamina, as you have found, is $$m=\frac 13 \pi kr^3$$
Now using the formula for the centroid of an arc, the distance of the centroid of the semicircular element from the origin is $$\frac {x\sin \left(\frac {\pi}{2}\right)}{\frac {\pi}{2}}=\frac {2x}{\pi}$$
Now applying Varignon's Principle, $$\frac 13 \pi kr^3\bar x=\int_0^r\frac{2x}{\pi}\pi kx^2dx=\frac{kr^4}{2}$$
Hence the result $$\bar x=\frac{3r}{2\pi}$$
A: Let me first explain why mathematically  the integrals are not the same.
In general, let us consider any object occupying a domain $D$ with area
element $dA$ and density $\rho(x,y)$. Let us follow the chain of equations:
\begin{eqnarray}
     \bar{x}  &=& \frac{\iint_D x \rho(x,y) dA  }{m}  \\
      \bar{y} &=& \frac{\iint_D y \rho(x,y) dA  }{m}  \\
      \bar{R} &=& \sqrt{\overline{x}^2 + \overline{y}^2} \\
                   &=& \frac{1}{m} \sqrt{ \left ( \iint_D x \rho(x,y) dA  \right)^2
                     + \left ( \iint_D y \rho(x,y) dA  \right)^2} dA  \\
                   &\ne& \frac{1}{m} \iint_D \sqrt{x^2 + y^2} \rho(x,y) dA \\
                   &=& \frac{1}{m} \iint_D r \rho(x,y) dA .
\end{eqnarray}
Observe the unequal sign where the chain breaks. We can not say that the square root of an integral is equal to the integral of a square root.
What this means is that we can not compute $\overline{R}$ with the
expression $  \iint_D r \rho(x,y) dA /m$. 
Now to the physics:
Take an object occupying a domain $D$. Let us think now in polar coordinates
(it could be any other but, for now we can use polar).  The 2D vector $\bf{r}_c$ is the center of mass, and the 2D vector $\bf{r}$  is an arbitrary point in the object.
The static condition indicates that the sum of torques is zero around the center of mass. That is the integral $\iint_D (\bf{r} - \bf{r}_c) \times  \bf dm = \rm (0,0)$ . Now the gravity goes all down in the same direction orthogonal to the object (in the negative $z$ direction) so we can write (from $dm= \rho(r,\theta) r dr d \theta$)
\begin{eqnarray}
   \iint_D (\bf{r} - \bf{r}_c)  \it \rho(r, \theta) r dr d \theta &=& \rm (0,0) \\
    \iint_D  \bf{r} \it \rho(r, \theta) r dr d \theta &=&
     \iint_D \bf{r}_c \it \rho(r, \theta) r dr d \theta  \\
      &=& \bf{r}_c \it  \iint_D  \rho(r, \theta) r dr d \theta \\
      &=&  \bf{r}_c  \it m.
\end{eqnarray}
Hence
\begin{eqnarray}
    \bf{r}_c \it = \frac{1}{m} \iint_D  \bf{r} \it \rho(r, \theta) r dr d \theta.
\end{eqnarray}
Now we separate components. That is
\begin{eqnarray}
    ( r_c \cos \theta,  r_c \sin \theta) = 
   \left ( \frac{1}{m} \iint_D r \cos \theta \rho(r,\theta) r dr d \theta,
      \frac{1}{m} \iint_D r \sin \theta \rho(r,\theta) r dr d \theta \right)
\end{eqnarray}
from which follows:
\begin{eqnarray}
     \bar{x} = \frac{1}{m} \iint_D  x \rho(r,\theta) r dr d \theta \\
      \bar{y} = \frac{1}{m} \iint_D  y \rho(r,\theta) r dr d \theta \\ 
\end{eqnarray}
with $r_c= \lVert \bf{r}_c  \rVert$ and there is no room for using $(r, \theta)$ instead of $(x,y)$. 
