Due to the expansion of the universe we know that the galaxies are all moving away from each other at incredibly high speeds - the farther away from us they are, the faster they are shooting out into the distant reaches of the cosmos. However, this isn’t the case with our nearest neighbor, Andromeda (which is officially designated 'Messier 31' or 'M31').
This galaxy has a mass that is 1.25 times that of the Milky Way, and it's heading right for us.
Andromeda is considerably larger than us, spanning some 220,000 light-years (the Milky Way is just over 100,000 light-years across). And while scientists believe that our own galaxy houses some 200 to 400 billion stars, the most accurate estimates indicate that Andromeda has a staggering one trillion stars. Andromeda is also moving substantially faster than the Milky Way; it's moving more than 2,000 times faster, in fact, at an estimated 250,000 miles per hour. And as previously mentioned, it's moving straight in our direction.
It’s important to note that it is the force of gravity alone pulling the two giants together. The universe is expanding, but this is something that we see across large scales. When looking at smaller structures, the force of gravity is much stronger than the expansion of the universe (in short, the thing that is pulling these galaxies together is the same thing that keeps you firmly planted on the Earth).
Astronomers believe that the galaxies will collide in about 4.5 billion years time (the timescale may vary a little). Scientists were able to calculate this by using the Doppler Effect. Andromeda’s motion towards us compresses the light we receive from the galaxy, altering its wavelength and frequency and giving it bluer appearance. This blue-shift can be measured, and Andromeda’s speed and distance can be accurately worked out for use in collision models.
This sounds like a devastating prospect, but collisions between smaller galaxies were essential in creating the larger structures we see today. For example, studies on Andromeda suggest it has already merged with another large galaxy, and the Milky Way has already collided with many dwarf galaxies such as SagDEG.
But now, we are talking about something on a much bigger scale. So, what kind of impact could such an event have? A "starburst" occurs when gas clouds are compressed at faster rates than normal (e.g. the Antennae galactic collision). This increased collapse rate greatly increases proto-star formation. When this occurs, nebulae shine powerfully and super-massive black holes feast – sometimes this will lead to a quasar. In the case of Andromeda and the Milky Way, it’s believed that there will be little hydrogen gas clouds left for a large scale star burst, but quasars from both galactic cores could be a possibility.
It will take 2 billion more years for both galaxies to completely merge as gravity pulls them together, and a while longer before both super-massive black holes also combine. But this isn’t the end to the story - Andromeda has a companion.
WATCH: NASA Animation of Collision
The Triangulum Galaxy (Messier 33 or M33), also the third largest galaxy in our Local Galactic Group, will end up merging with the new giant formation. This will most likely happen long after the Milky Way–Andromeda collision, but depending on motion and speeds over the next few billion years, there is a tiny chance it will hit us first. In the distant future though M31, M33 and the rest of the galaxies in the Local Group will all combine into one enormous object. After this, it is very unlikely that we will ever collide with another galaxy again. That's it. We'll be done.
Universal expansion dictates that, even though the force of gravity is infinite in its reach, other giant galaxies will simply be too far away for any considerable effects to pull them together.
So what, specifically, is our Solar System in for? Well not a lot on the small scale. The planets’ orbits shouldn't be altered. A star could come barreling in, and changes in gravity may pull the planets into more elliptical orbits; however, stars are usually very far apart (space is, after all, amazingly huge), so such an interaction is unlikely. On the large scale, calculations suggest that we have a 50% chance of being moved up to three times farther outwards from the new center.
There’s also a 12% chance that our solar systems will get flung out of the nicknamed "Milkdromeda" and set adrift in the vast reaches of intergalactic space; it all depends on Andromeda’s transverse velocity and angular momentum at the time of the impact. In any case, the Sun would have already made sure all life on Earth had gone before any of this began to happen - but all in all, whether we have escaped to another planet or perished, this promises to be a fantastic show (hopefully our descendants' descendants' descendants' will be around to see it).