Law of Universal Gravitation
Every object in the Universe attracts every other object with a force directed along the line of centers for the two objects that is proportional to the product of their masses and inversely proportional to the square of the separation between the two objects.
God I love science when I'm dr0nk
now for Hubble's Law which tells us the expansion of the universe is smooth. This relates to the expansion of galaxies.
V = Ho D
Recessional velocity that we observe agalaxy (ie: moving away from us)
Hubble's Constant (around 70km/second per megaparsec) (There is some debate in the community whether this is the true value for all cases)
Distance to the obseved galaxy in megaparsecs
Remember a parsec is about 19,173,560,000,000 miles, which is also means a metric fuckton of gas money.
So if we see a galaxy with a recessional velocity (compared to us) at 5000000mph, that is 0.00745582 the speed of light.
Lets divide that by Hubble's Law (Constant) of 70km/s per Mpc and we get 31.95 Megaparsecs, which is equal to 104.22 million light years. That galaxy is 104.22 MILLION light years away.