# Calculating the center of mass in spherical coordinates

So normally, to calculate the center of mass you would use a triple integral. In my particular problem, I need to calculate the center of mass of an eight of a sphere where it's density is proportional to the distance from origin.

Say we want to get the x coordinate of the center of mass. The formula is something like

$\frac{1}{M}\int\int\int (r^2\sin\phi)(\lambda r)(r\sin\phi\cos\theta)$

where the groups in that product are the jacobian of the spherical transformation, the density function of r and the x coordinate expressed with spherical variables.

Now, I'm thinking if this is really necessary. Could I just multiply with $r$ instead of $(r\sin\phi\cos\theta)$ to get the radius of the center of mass, then do the same for $\phi$ and $\theta$, and then transform them back to $x, y, z$?

This makes sense to me since what I'm basically doing it summing up all the coordinates for each point in the body with each point having different influence on the result. The way I see it, the jacobian is there to account for the fact that the transformation is much more dense around the origin, the $\lambda r$ is there to give denser areas more influence on the final center of mass. I don't really see any reason why I couldn't sum up their coordinates in spherical form.

The potential problem I could see here is that if I tried to calculate the center of mass of a whole sphere, the $x,y,z$ would all be 0, but in spherical coordinates I might get unexpected results due to angles not being defined.

• This may seem trivial, but when the triple integral is separable, e.g., the density is of the form $f(r)$ and the region "simple", e.g., a fraction of a sphere, then you may recover $\bar{x}$ by computing $\bar{r}$, $\bar{\sin{\phi}}$, and $\bar{\cos{\theta}}$, then multiplying. Not so sure you can get there by computing $\bar{\theta}$, etc. Commented Apr 16, 2014 at 13:14
• I would have thought that $\bar{x}=\bar{r}\sin\bar{\phi}\cos\bar{\theta}$ Commented Apr 16, 2014 at 13:21
• Yeah, you would think, but the trig functions are nonlinear and belie the linearity of the integration which allows the rearranging I described. Commented Apr 16, 2014 at 13:48

$$\bar{\cos{\theta}} = \int dr \, r^2 f(r) \, \int d\phi \, \sin{\phi} \, \int d\theta \, \cos{\theta}$$ $$\bar{\sin{\phi}} = \int dr \, r^3 f(r) \, \int d\phi \, \sin^2{\phi} \, \int d\theta \,$$ $$\bar{r} = \int dr \, r^3 f(r) \, \int d\phi \, \sin{\phi} \, \int d\theta \,$$
\begin{align}\bar{r} \,\bar{\sin{\phi}}\,\bar{\cos{\theta}} &= \frac{\int dr \, r^3 f(r)\left (\int dr \, r^3 f(r) \right )^2 \int d\phi \, \sin^2{\phi} \left ( \int d\phi \, \sin{\phi} \right )^2\int d\theta \, \cos{\theta} \left ( \int d\theta \right )^2}{\left (\int dr \, r^2 f(r) \right )^3 \left ( \int d\phi \, \sin{\phi} \right )^3 \left ( \int d\theta \right )^3}\\ &= \frac{\int dr \, r^3 f(r) \, \int d\phi \, \sin^2{\phi} \,\, \int d\theta \, \cos{\theta} }{\int dr \, r^2 f(r)\, \int d\phi \, \sin{\phi}\, \int d\theta }\\ &= \bar{x}\end{align}
But I do not think you can work with the bare $\phi$ and $\theta$ because the trig functions introduce a nonlinearity that belies the linearity of the integrals.