The spectrum of an element is a characteristic of that element, like a fingerprint. The electromagnetic spectrum observed in starlight can be used to identify elements present in the star and other characteristics of the star.

The image above shows emission spectra (over a continuous spectrum for reference) of various elements. The first thing to note is that the bright emission lines lie at different wavelengths, or different colors. You might also notice that hydrogen is relatively simple, with few lines. Helium is a bit more complicated, and the elements below get increasingly complicated.

 

Hydrogen spectrum is simple because there is only one electron in a hydrogen atom. A helium atom has two electrons, so there are more possibilities for the excited states. Atoms with increasingly large nuclei have more electrons, and so, more complicated spectra.

 

When atoms combine to form molecules, the spectrum becomes even more complicated, since there are many more possible energies available for electrons to occupy.

Stellar spectral classification

The above figure shows a comparison of absorption spectra for various kinds of stars. In general, the classifications O B A F G K M rank the stars from hottest to coolest. The dark streak coming vertically down through the different star's spectrum tell a story of the excitation of electrons at different temperatures. The top star, an O type star, is extremely hot and has very few lines. That is because the star is so hot that the electrons have been ionized. They do not occupy excited states, they have left the atoms entirely. Moderately cool stars in the center of the page show hydrogen spectral lines. They are cool enough to have electrons occupying excited states. The cooler stars lower on the page lose the dark lines again, since they are too cool to excite electrons. M5 stars are so cool that molecules can form, so they have very many lines.