Different materials give off different light patterns and colors. So if you analyse light, and you can tell from the pattern that the star is 90% hydrogen, and 10% helium, then you know what color the light should be.
Then you can see how far that light has been red-shifteted or blue-shifted, and you know how long its been traveling because space expansion is happening at an constant acceleration.
So since you know how long its been travling, you mulitply by the speed of light and you have distance.
Latest Answers