Some sources suggest that the Andromeda Galaxy is likely to collide with our own in approximately 3 to 5 billion years.
We can estimate the distance to the Andromeda Galaxy using various techniques, including measuring the apparent brightness of Cepheid variable stars; its distance is currently estimated to be about 2.5 million light-years.
We can measure its radial velocity (i.e., the rate at which it's either approaching or receding from us) using Doppler shift. One source, the same Wikipedia article I linked to above, indicates that its radial velocity with respect to the Sun is about 300 km/s in our direction; another article says the radial velocity relative to our galaxy is about 120 km/sec, also in our direction. (Presumably the difference is due to the Sun's orbital motion around the core of the Milky Way.)
But that's just the radial component of the velocity. Taking the 120 km/sec figure, it could be moving directly toward the Milky Way (more precisely, its core could be moving directly toward the core of the Milky Way) at 120 km/sec, or it could be moving at a 45° angle at about 170 km/sec, or any of a number of other possibilities.
Without an estimate of the lateral component of the velocity, there's no way to be sure whether the collision will occur or not. I'm reasonably sure we can't measure the lateral velocity directly; 120 km/sec over a century would cause Andromeda to move only about 0.04 light-year (if my calculations are correct).
And yet this Wikipedia article says:
The best indirect estimates of the transverse velocity indicate that it is less than 100 km/s.
with a reference to "Abraham Loeb, Mark J. Reid, Andreas Brunthaler and Heino Falcke The Astrophysical Journal, 633:894–898, 10 November 2005", but the link is invalid.
So how can a galaxy's lateral velocity be measured, or at least estimated? How accurate can such an estimate be with current technology? Can we expect improvements in the near future?