# If galaxies are moving away from each other then why are the Milky Way and Andromeda galaxy coming towards each other?

The Andromeda Galaxy is approaching the Milky Way at about 684000 mi/hours, making it one of the few blueshifted galaxies. The Andromeda Galaxy and the Milky Way are thus expected to collide in about 3.75 or 4.5 billion years.

Why are some galaxies moving away and why are our galaxy and Andromeda coming towards each other?

Here is my answer to a similar question posted on the physics stack exchange website.

Hubble's law (the law that deals with the expansion of the universe) applies to the expansion of space itself, i.e., if two objects stationary to each other that had no force between them were left alone the distance between would increase with time because space itself is expanding. This is what Hubble's law addresses.

In the case of the Milky Way and Andromeda galaxies (and all galaxies for that matter) there is a force between them: gravity. The gravitational force between the Milky Way and Andromeda galaxies has produced an acceleration that is causing the two galaxies to be moving towards each other faster than the space between them is expanding as calculated by Hubble's law. However, the vast majority of galaxies lie far enough away from the Milky Way that the gravitational force between us and them is small compared to the Hubble expansion and Hubble's law dominates.

In short, Hubble's law applies throughout the universe, but localized systems may have enough gravitational attraction between them that the gravitational effects dominate

The farther away, the faster the galaxies move away from us. But that's only the overall expansion of the universe. Locally velocities can differ and are to be added to the overall expansion. The Andromeda Galaxy is close enough to Milky Way to be able overcome the overall expansion of space. The Andromeda Galaxy and the Milky Way attract each other by gravity.

Hubble's law applied to Andromeda Galaxy/Milky Way returns an expansion of space of less than 70 km/s, since Hubble's constant is about 70 km/s/Mpc, and the distance is about 2.5 million light-years, less than 1 Mpc (= 3.26 light-years, see Parsec). That speed is slower than the about -300 km/s helio-radial velocity (space expansion already subtracted) of the Andromeda galaxy, hence feasible to overcome.

Alexander Friedmann showed that if there is no extra cosmological constant, and the universe is filled with anything energetic (e.g. matter, radiation, dust, fluid, etc.) there were two classes of solutions: one for a contracting Universe and one for an expanding Universe. It's as though the fabric of space itself is getting stretched over time, and all the objects within that space are being dragged apart from one another. The farther away an object is from another, the more stretching occurs. If all of the universe was filled evenly with matter, that matter would simply get less dense.

Hubble discovery is of that individual stars could be measured in other galaxies, determining their distance. On the largest scales, the expansion wins, on smaller - the own system gravity. The superclusters of the universe, stretching for over a billion light years, are being stretched and pulled apart by the universe's expansion. Still, the Milky Way's nearest large galaxy cluster, the Virgo cluster, at just 50 million light years away, will not pull Milky Way into it. Nearby, the Virgo cluster itself will remain bound. The Milky Way and all the local group galaxies stay together, eventually merging under their own gravity. The fabric of space itself still expanding, but it doesn't have a measurable effect on every object/system.