Given :
mass of rod M = 5.0 kg
length of the rod L = 3.0 m
Mass per unit length of the rod is, m = M / L = 5.0 / 3.0
d = 23 cm = 0.23 m
Mass of the element of the lnegth dr of the rod is , dm = m dr
particle of mass m1 = 0.67 kg
Distance between the element of the rod and mass m1 is
dF = G m1 dm / R2
dF = Gm1 dm/r2 = GMm1/L * dr/r2
integrate, limits: d to d + L
F = GMm1/L*(1/d - 1/(d + L))
= GMm1/[d(d + L)]