Spectroscopy is used to determine the composition of stars. When star light is passed through a prism or spectrograph, it separates into a spectrum of colors that can be analyzed. Each element emits or absorbs light at specific wavelengths, creating lines in the spectrum that act as a fingerprint to identify the elements present. By examining the spectra of unknown stars and matching the line patterns to known elements, astronomers can determine what chemicals stars are made of.