Astronomers estimate the distances to far-away galaxies by measuring the brightness of their stars. An easy way to do this is to find a type of star called a Cepheid variable, whose brightness varies overtime.
Astronomer Henrietta Leavitt discovered over 100 years ago that the period of these fluctuations relates to Cepheid variable stars’ true brightness. By comparing the star’s true brightness to how bright it appears from Earth, its distance can be calculated. Edwin Hubble used this method in 1923 to make the first accurate measurements of how far away the Andromeda galaxy is.