Using the formula for gravitational attraction between the Moon/Earth and a test mass, m. We determine FE = (G*ME m)/(rE2 ), FM = (GMM*m )/ (rM2). Setting these two forces equal to each other and rearranging gives us the formula: rM2 = (MM/ME ) * rE2. Taking the square root of both sides, and noting the distances, r, should always be positive we get distance from the Earth is sqrt(MM/ME).