# Gravitational force inside a sphere - Where is the mistake?

There is a sphere, with $\frac{dM}{dV}=\frac{M}{V}=\rho$. I want to calculate the gravitaional force along the z-axis. $$dF=G\frac{m*dM}{r^2}$$ $$dF=\frac{GmM}{V}*\frac{dxdydz}{r^2}$$ $$dF=\iiint \limits_V \frac{GmM}{V}*\frac{dxdydz}{x^2+y^2+z^2}$$ If $\textbf{v}(x,y,z)=\textbf{v}(0,0,-1)$, then $\textbf{F}=F_{down}\textbf{v}-F_{up}\textbf{v}$ $$dV=r*dz*dr*d\theta$$ $$F_{down}=\int \limits_{-R}^{h} \int \limits_{0}^{2 \pi} \int \limits_{0}^{\sqrt{R^2-z^2}} c*\frac{r}{z^2+r^2} dr*d\theta*dz$$ $$F_{up}=\int \limits_{h}^{R} \int \limits_{0}^{2 \pi} \int \limits_{0}^{\sqrt{R^2-z^2}} c*\frac{r}{z^2+r^2} dr*d\theta*dz$$ Where $c=\frac{GmM}{V}$, and $h$ is the (signed) distance from the centre off mass.

And I've god $\textbf{F}=2ch\pi(\log{\frac{R^2}{h^2}}+1)\textbf{v}$

But with $R=1$, $2c\pi=1$, the graph looks like this:

And it looks wrong for me, because i think the max/min should be at $|z|=R$ for $z\in[-R,R]$.

• why are you restricting your integration to positive $z$'s? Commented Mar 5, 2017 at 15:39
• What do you mean, @ZeroTheHero? Commented Mar 5, 2017 at 15:45
• Sorry I misread your setup. I thought your last integral was over $z$'s since it's the last in your differential element. I don't follow at all your train of thoughts so I'm afraid I can't be helpful... Commented Mar 5, 2017 at 16:17

$$dF_{z} = \frac{G\,m\,\rho\,dx\,dy\,dz}{x^{2} + y^{2} + z^{2}}\left(\frac{z}{\sqrt{x^{2} + y^{2} + z^{2}}}\right)$$