I think you are assuming the cavity is centered on the body which the question says it isn't.

You are almost correct in your approach. Imagine the main body was filled with mass and the cavity was a separate body with negative mass - then sum the result

This is basically a proof of the Shell theorem

Simple. First, you must know that gravitational forces superpose.

Ok. First, calculate the force at a distance $r$ from the origin for a sphere of mass $M$ and radius $R$. You ought to get the result that it is $\frac{GMm}{r}$ if $r\geq R$, 0 otherwise. This is a standard textbook formula.

Ok, now, pretend the shell is made up of a larger sphere with positive mass and a smaller sphere with "negative" mass that cancels out all the mass except a shell of thickness $t$ on the outside. If you feel uncomfortable doing this, convert it into an electrostatics problem, calculate the formula with a similar method, convert it back.

Knowing $M,R,t$, you can calculate the masses and radii of the component spheres. Both have equal magnitudes of density.

Now, calculate the force at $r$, and superpose the two, taking care to subtract the force of the inner "negative" sphere.

That's it. You have (ab)used the principle of superposition to calculate this force, which is the final answer (it will have three cases -- the gravitational field inside will be 0).

The harder you try to avoid integration, the more fun newtonian mechanocs becomes :)

I'm on mobile right now (hard to add math) if you want I'll put more math in the answer tomorrow.

## Best Answer

As per @lemon mentioned :

So I just did like that only.

Taking sphere as point mass then point mass will experiences one gravitational force of attraction that is:

$$df=cos\theta$$

As vertical component will cancel out.

Integrating it we will get:

$$F=\frac{GMm}{r^2}.sin\theta$$

$$F=\frac{GMm}{5a^2}.\frac{3a}{5a}$$

$$F=\frac{3GMm}{125a^2}$$

Which is our required answer and that's how we can determine the gravitational force of attraction between ring and sphere.