How do you integrate magnitudes of vectors not just scalars?

I am working on a method of integrating over the of shapes, starting with a sphere to find its mass to find its gravitational pull with a uniform density in space. I know the volume of a sphere in general is normally given by

$\int_{0}^{ \pi} \int_{0}^{2 \pi} \int_{0}^{R}drd \theta d \phi$.

and Newton's law of gravity given by

$F=\frac{G M_1 \cdot M_2}{r^2}$

where $M_1$ is the mass of a the spherical object like a star or cloud and $M_2$ would allegedly be the mass of something within the sphere like a planet.

In actual 3D space though, simple scalars aren't enough and the force of gravity is defined between the specific locations of objects, meaning I have to deal with vectors. Since the density of uniform, I would think it acts like a constant, but there are still all kinds of directions from different particles, and combining the two equations for integrating density over volume would give mass

G$\int_{0}^{ \pi} \int_{0}^{2 \pi} \int_{0}^{R} \frac{ M_{2} \rho \hat{\mathbf{r}} }{\| \mathbf{r} \|^{2}}drd \theta d \phi$

The problem is, I don't see how to just spontaneously integrate a vector. I can't think that after 300 or 400 years that no one has figured out how to do it. I could maybe say $r = \sqrt{x^2+y^2+z^2}$ but then I would have to define $\theta$ and $\phi$ in Cartesian coordinates and I don't see a reason to bother with that when I'm already in spherical coordinates. As far as I know, $r$ is its own coordinate.

• According to your formula the volume of a sphere is $2\pi^2 R$. – Christian Blatter Mar 13 '18 at 5:56
• Right, so obviously I know this process is wrong, which is why I'm asking how it can be corrected. – John Joe Mar 13 '18 at 21:25

2 Answers

There are two aspects of this question: (i) a conceptual, and (ii) an operational one.

As for (i) you have to understand an integral in the following way: You are given a domain $B\subset {\mathbb R}^d$ and a real-, complex-, or vector-valued function $f:\>B\to{\mathbb X}$ describing a certain economical, geometrical, or physical quantity depending on and changing with $x\in B$. The integral $$\Phi(B, f)=\int_B f(x)\>{\rm d}(x)$$ then captures the "total impact" realized by this $f$ on $B$. From intuitively obvious additivity and linearity considerations it then follows that $\Phi(B,f)$ should be a limit $$\Phi(B,f)=\lim_{\ldots}\sum_{k=1}^N f(\xi_k){\rm vol}(B_k)\ ,\tag{1}$$ whereby $B=\bigcup_{k=1}^N B_k$ is a partition of $B$ into tiny "almost disjoint" subdomains $B_k$, and for each $k\in[N]$ a sampling point $\xi_k\in B_k$ is chosen. (A lot of technical work is needed to make the $\ldots$ in $(1)$ precise.) In any case the integral is a limit of general Riemann sums defined without ado in a real, complex, or vectorial way.

When it comes to (ii), things are simple: While integrating you may of course describe the points $x\in B$ using your preferred coordinates, e.g., spherical coordinates $r$, $\phi$, $\theta$, and don't forget the Jacobian factor! It is another thing with the values of the function $f$ to be integrated. The linearity of the integral makes it obvious that we can compute the integral of a vector-valued function $f=(f_1,f_2,f_3)$ coordinate-wise. Here it is of course necessary to express the values of $f$ in ordinary cartesian coordinates. It is just not true that $$\left|\int_B f(x)\>{\rm d}(x)\right|=\int_B \bigl|f(x)\bigr|\>{\rm d}(x)\ ,$$ or similar. If, e.g., a complex-valued $f$ is given in the form $f(u,v,w)=r(u,v,w)e^{i\phi(u,v,w)}$ you have to deal with $${\rm Re}f(u,v,w)=r(u,v,w)\cos\phi(u,v,w),\quad {\rm Im}f(u,v,w)=r(u,v,w)\sin\phi(u,v,w)$$ separately.

• If I convert to Cartesian coordinates then I would get something like "θ=atan(x/z)" which is going to start giving me unsolvable equations quickly. I am exceptionally sure there is a way to do this by keeping r, I should not see x-y-z at all. – John Joe Mar 12 '18 at 16:42

I think there's a bit of an XY problem here: it seems like your actual problem is to find the gravitational field $\mathbf{g}$ of an irregular object, i.e., to find a $\phi$ satisfying the Poisson equation \begin{align}\nabla^2\phi&=-4\pi G\rho&\phi&=O(\tfrac{1}{r}) \end{align} where $\rho$ is a compactly supported mass distribution—then $\mathbf{g}$ is given by $$\mathbf{g}=-\nabla\phi\text{.}$$ The solution to this equation is $$\phi(\mathbf{x})=-Gm\int_{\mathbb{R}^3}\frac{\rho(\mathbf{x'})\mathrm{d}^3x'}{\lVert\mathbf{x}-\mathbf{x'}\rVert}$$ which is a scalar-valued integral; once this integral has been evaluated, $\mathbf{g}$ can be found by taking the gradient.

• You're focusing too much on the physics of the problem, with which there is no dispute, instead of the math of the problem, which needs generalization to prove how gravity only scales linearly towards the surface inside a solid sphere of uniform density. Obviously the triple integral should be modified, but you still haven't explained what I actually asked, "How do you integrate magnitudes of vectors not just scalars?" The issue is I see no consensus whatsoever on how vectors are integrated, only scalars. Here, r should not be <x, y, z>, r is a vector, its magnitude somehow also a coordinate. – John Joe Mar 14 '18 at 2:59