Over and over again IFLScience and other popular science websites report on the discovery of an element or molecule in space, whether in a star, a comet or the atmosphere of planet beyond our Solar System. No doubt many people wonder how we can tell, since we haven’t been there to collect a sample. Such articles often come with a mention of spectroscopy, and sometimes even a brief outline of how it works, but given how often we cover research done this way, we thought it was time for a deeper dive.
When Newton used a prism to split light into a spectrum he earned the ire of John Keats, who claimed rainbows were less beautiful now they had been explained (ignoring the fact others had beaten Newton to it). In the process, however, Newton lit the way to the discovery of many more mysteries, some accompanying equally remarkable beauty.
The spectrum Newton’s prism revealed exists because light comes in different wavelengths, with red the longest we can see and violet the shortest. The spectrum of sunlight is not equally bright at all wavelengths, partly because intensity peaks in the green. More importantly dark and bright lines can be seen at specific wavelengths, although it took until the early 19th Century and diffraction gratings replacing prisms for anyone to see them clearly enough to study them intensively.
The dark components are known as absorption or Fraunhofer lines, and several 19th Century scientists were able to match specific lines to the presence of elements or molecules in the atmosphere of the Sun or Earth. Further research revealed that when elements are heated under low pressure, they produce light of the same wavelength (known as emission lines) that the element at cooler temperatures will absorb.
The reason elements have their distinctive lines at particular wavelengths was not known until much later, but long before that, scientists had spotted the discovery’s potential.

The spectrum of the Sun, with dark lines indicating the presence of elements absorbing light at their distinctive wavelengths
Public Domain
Use In Astronomy
Emission lines quickly revealed something of the composition of the Sun, and absorption lines told us what was in its outer atmosphere, blocking the light at those wavelengths. Full sunlight is so bright that emission lines don’t stand out from the background well, but during total solar eclipses the only light is from the Sun’s outer atmosphere, or chromosphere.
Spectra collected during eclipses told astronomers the Sun’s chromosphere contained several familiar elements, but in 1868 the new science of astronomical spectroscopy had its shining hour, with an unfamiliar yellow line observed during an eclipse in India. At first the line was confused with the two famous sodium lines at nearby wavelengths, but eventually astronomers realized there must be an element they didn’t know, which was named helium.
The increasing power of telescopes to collect more light allowed us to compare the spectra of different stars. Astronomers learned that while hydrogen and helium are almost always the most common elements, variations in just how rare the other elements are can reveal a star’s age and origins.

Some elements, such as iron shown here, have rather a lot of emission lines.
Image Credit: Nilda/Public Domain
When light from more distant stars shines through clouds of gas, or sunlight reflects off comets, we can detect not just the elements that make up these objects, but the presence of molecules like water or carbon dioxide. Sometimes the distinctive lines associated with surprisingly complex elements can be seen, offering hints of an astronomical origin for molecules that make life possible.
A specific line from one molecule may be at a wavelength so similar to one from another that they are very hard to distinguish. That’s why it’s fortunate that any element or molecule produces multiple lines, which together create a fingerprint unlike any other.
Spectral lines distinctive to complex elements are usually at infrared, not visible, wavelengths. One of the JWST’s major projects is to collect infrared radiation from stars filtered through the atmosphere of their planets when they transit across the star’s face. Earthlike planets’ atmospheres block such a small portion of the starlight that the absorption lines are very faint. Only by combining the light collected from many transits can we expect to see the molecules we seek. Nevertheless, the race is on to answer one of humanity’s biggest questions.
The Bonus Benefit Of Doppler Shifted Lines
When a source of light is moving away from us, its light is red-shifted, that is wavelengths are longer than if it was still. However, without spectroscopy this would tell us little – yes, more distant galaxies would look red, but we would have no way of knowing if they just had a lot of red light or if they really were moving away.
Spectroscopy changes that. We can look out for specific lines we know will be there and are distinctively spaced relative to each other. If these are at much longer wavelengths than they would be if the source were still (for example those twin sodium lines appearing in the red, or even infrared), we know the emitter is moving away from us fast. The extent the lines are shifted tells us just how fast, which in an expanding universe offers a good estimate of its distance.
This has proven essential for mapping the scale of the universe, and was also the way we found most of the first planets we identified beyond the Solar System.
Applications In Other Fields
Spectroscopy is not just for astronomers, of course. Heating samples of unknown composition until they emit light to tell us what is in them has also been popular since the mid-19th Century. Trace elements that might be hard to find another way can reveal themselves through their emission lines.
Nevertheless, while spectroscopy is often the best way for chemists to identify what is in their samples, it’s seldom the only one, so it’s astronomers who have the most to be grateful for these lines’ existence.
Why Spectral Lines Exist
It took more than a century from the discovery of spectra lines to an explanation. Quantum physics revealed that electrons cannot orbit their atom with any amount of energy they like. Instead, they are restricted to orbitals, which have a specific energy.
When an atom gets hot, the electrons absorb some of that energy and jump to higher orbitals. But what goes up, must come down applies to energy as well. At some point these excited electrons release energy equivalent to the gap between the higher orbital and the lower one in the form of a photon. Since the energy of a photon of light is dictated by its wavelength, that difference will produce light of a specific wavelength. Enough electrons all making a jump of the same size produce an emission line we can detect.
Similarly, when light meets an atom, if a photon’s energy is just the right amount to jump an electron to a higher orbital, it will be absorbed. However, if the photon carries an amount of energy that would leave the electron between two orbitals, that energy level is impossible, and the photon passes the atom unaffected, potentially to be captured by our instruments.
The situation is more complex than this, because of course it is. Not only do molecules have different gaps between their orbitals than the elements that make them up, but influences such as magnetic fields can affect the electron energy gap. Although this can make it harder to know what we are looking at – the fingerprint of one molecule in a magnetic field might look like another outside one – it also adds extra layers of information that spectroscopy can provide.
Source Link: What Is Spectroscopy And Why Is It So Important To Science?