system
Given the following post, respond as if you're commenting on Reddit:
human
Andromeda Collision

I've been told that the Milky Way is on a collision course with the Andromeda galaxy, but I've also heard that all the galaxy's are moving away from each other, how does this work?
gpt
Cosmological expansion only causes things that are already sufficiently far apart to expand away from one another. For things that are relatively close to one another, like the galaxies in the Local Group, the behavior is much more closely approximated by the standard picture of attractive gravity.

In other words, gravitationally bound systems (like galaxy groups) don't experience cosmological expansion. It's only when you consider widely separated galaxies that you find the distance between them increasing due to expansion.