Proving centre of mass formula I came across a question:      

Find $f(r)$ and prove the centre of mass formula:
  $\vec{r_{cm}} = \frac{1}{V} \int f(r)  \vec{dS} $
  Where V is the total volume and our surface integral is over a body with uniform density.

I'm not even quite sure where to start. I spent a while fiddling around with the divergence theorem but to no avail. I think $f(r) =\frac{r^2}{2} $ but this is only a guess. Any hints would he great to get me started along the right track. 
Thanks 
 A: The intended formula suggests to use Gauss' divergence theorem. This theorem is about the flux of some vector field ${\bf v}$ through the boundary surface $\partial B$ of a body $B$. But your formula integrates a scalar function over $\partial B$, albeit in a "vectorial" way. The trick is to choose a fixed "test vector" ${\bf e}$, and to consider the vector field
$${\bf v}({\bf x}):={|{\bf x}|^2\over2}{\bf e}={(x_1^2+x_2^2+x_3)^2\over2}(e_1,e_2,e_3)\ .$$
One computes
$${\rm div}({\bf v})=x_1e_1+x_2e_2+x_3e_3={\bf x}\cdot{\bf e}\ .$$
The centroid ${\bf c}$ of $B$ is defined by the moment equation
$${\bf c}\>V=\int_B{\bf x}\>{\rm d}({\bf x})\ ,\tag{1}$$
where $V$ denotes the volume of $B$. We now take the scalar product of $(1)$ with the vector ${\bf e}$ and apply Gauss' theorem:
$$\eqalign{{\bf c}\>V\cdot{\bf e}&=\int_B{\bf x}\cdot{\bf e}\ {\rm d}({\bf x})=\int_B{\rm div}({\bf v})\>{\rm d}({\bf x})\cr &=\int_{\partial B}{\bf v}\cdot{\bf n}\>{\rm d}\omega=\int_{\partial B}{|{\bf x}|^2\over2}\>{\bf e}\cdot{\bf n}\>{\rm d}\omega\cr &=\left(\int_{\partial B}{|{\bf x}|^2\over2}\>{\bf n}\>{\rm d}\omega\right)\cdot{\bf e}\quad .\cr}$$
Since this is true for every "test vector" ${\bf e}$ it follows that the hoped for  formula holds with  $f({\bf x}):={1\over2}|{\bf x}|^2$.
