One might wonder how we can determine what a star is made of. If they are so far away, how can we possibly know anything about them? Well, it turns out that we can measure quite accurately what elements are in stars and approximate their quantities as well. Not only this, but we can use the same technique to measure how far away they are.
Stars give of light in a spectrum of wavelengths. Our eyes mix all of these different wavelengths and we usually see white. Stars can be colors too, but even these stars give off a wide spectrum of wavelengths. They just give off the color that we see at a greater magnitude than the other colors. It turns out that our own Sun gives off green light more than any other color, but our eyes are adapted to it and we see white, not green.
A prism or diffraction slit can divide white light into all of the wavelengths of which it is composed. This creates a rainbow. When you look at a rainbow you miss a lot. There is a lot of information in there that we have to stretch it out to see. We can stretch it out so that it’s extremely wide, then cut it into pieces and stack them on top of each other like sentences on a page and we get this:
Those black lines that look like a bar code are the fingerprints left behind by the atoms that are in that star. Every element on the periodic table has a specific fingerprint that it leaves. Elements can emit certain colors when stimulated which is what gives the Aurora their colors as well as nebulae.
Elements can also absorb colors leaving behind black bands in the spectrum of light that passes through them.
Each element has a unique “bar code” that it leaves in light that passes through it. Using these dark bands in a star’s spectrum, we can determine which elements are present in a star.
If a star is moving, the bands shift as the wavelength of the light coming from that star shifts. It is the same Doppler Effect that makes an approaching sound higher in pitch and a receding sound lower in pitch. Light shifts too but instead of pitch, it changes color. By looking at the bands in a star’s spectrum, knowing specifically what wavelengths or colors each element absorbs, finding these patterns in the observed stars light and measuring how much these patterns shift, we can effectively measure how fast and which direction a star is moving.