# Why do stars have absorption spectra?

Absorption spectra are a result of light of a certain wavelength exciting an atom from a lower energy level to a higher one and at the same time being absorbed. However, the atom should eventually go back down to its lower energy state, and at the same time emit a photon of same frequency it absorbed earlier. Overall, no changes to the star's spectrum should occur.

-

When the energy level drops and the photon is re-emitted, it is scattered or re-emitted in a random direction, so less of that frequency reaches your telescope/spectroscope. It is sort of analogous to the "why is the sky blue" question. What you are looking at is direct line photons(line of sight), so photons passing through the star's gaseous layers are depleted in this line of sight by the random scattering.

-
What do you mean "random direction"? Stars are spherically symmetric, the photons are already going in random directions. –  Itai Bar-Natan Feb 12 '11 at 2:49
@Itai ---photons heading from the star straight to your line of sight are absorbed by gas in their path. The re-emitted photons are rarely re-emitted directly in their former path, hence, they are scattered, so fewer of those original line of sight photons reach your CCD or spectrometer. –  Gordon Feb 12 '11 at 3:18
As Omega Centauri points out in his answer, the crucial extra ingredient is that the deeper layers of a star have higher temperatures than the outer layers. If a star were at a uniform temperature, then there would be no absorption lines: as many photons would be scattered into your line of sight as out of it. –  Ted Bunn Feb 12 '11 at 15:55
Stars have plenty of "cold" gas (atoms in their ground states). If you put some gas on the way from a light source to you, some frequencies will be less represented (dark absorption lines) than non resonance frequencies. Atoms for such frequencies are like a fog on the light way - they capture and diffuse the resonance frequencies to the whole solid angle $4\pi$. So you observe them as less represented than the neighboring non resonance frequencies in the continuous spectrum.