It is not derived. It is found using experiment. So this finding is written as proportional. Also they found masses of bodies also directly proportional. And finally write the equation f= GMm/r^2.
here G is constant of proportion. And it's value also found experimentally.