How did Edwin Hubble prove that the Andromeda Galaxy lies outside the Milky Way?
Edwin Hubble proved that the Andromeda Nebula (M31) lies outside the Milky Way by identifying Cepheid variable stars within it and using them to calculate its distance.12
Building on the work of Henrietta Swan Leavitt, who discovered the relationship between the period of a Cepheid’s brightness fluctuation and its actual luminosity, Hubble was able to use these stars as "standard candles" to measure cosmic distances. In 1923, using the 100-inch Hooker telescope at Mount Wilson Observatory, Hubble detected these variables in the Andromeda Nebula.12
By applying the period-luminosity relation, he estimated the distance to Andromeda to be approximately 900,000 light-years. This distance was far beyond the estimated boundaries of the Milky Way, which at the time were thought to be no more than 300,000 light-years in diameter. This evidence demonstrated that Andromeda was a separate, independent galaxy rather than a cloud of gas or a star cluster within our own system, fundamentally expanding the known scale of the universe.23