We consider the small differential element of rod of mass and thickness which is at distance from.
Using equation (i), the gravitational force between and is given by,
We can write change in mass in terms of density and change in length.
So, we have,
Substituting this we get,
Integrating above equation fromwe get,
Substituting all the values we get,
Hence, the force is