Submitted by modsarebrainstems t3_1018gn0 in askscience
I'm a little confused about galactic movement in that we all know the universe is expanding like raisins in a loaf of bread. However, if that's true, why do galaxies collide? Moreover, how does a galaxy begin this movement in the first place?
Aseyhe t1_j2miy9u wrote
Galaxies exist in the first place because the early universe was not completely uniform. Some regions were slightly denser than others. These density variations were initially at the level of one part in 10-100 thousand (10^(-5) to 10^(-4)), but gravity amplified them over time. Denser regions tended to pull in surrounding matter, becoming still denser. Eventually, the densest patches formed galaxies.
However, initial variations in the density of the universe also existed at scales much larger than galaxies. Due to this large-scale structure, galaxies are now moving toward regions of higher density and away from regions of lower density.
Here's an example movie. "z" in the corner is the redshift, essentially inverse time (smaller is later). The key point is that galaxies form (the yellowish color) but continue moving as they coalesce into still larger systems.