You can determine the characteristics of a star by breaking down its light into its components. This collection of colors obtained is called a spectrum, and is useful in determining the elements and other components of stars. We know the spectrum of our own sun whenever we view its spectrum, whenever we see a rainbow.
Taking this up to a level higher, you can break down a star’s spectrum and analyze it using a spectrograph. The spectrograph is the name for the instrument used in analyzing a star’s spectrum. There are two common ways by which a spectrograph splits a star’s light into its spectrum; via refraction and diffraction.
Refraction is done through a prism and this is similar to the process by which a rainbow is formed. Light is bent through the prism and the corresponding spectrum can be displayed and captured for analysis. In a rainbow, water acts as the prism and the sun’s light passing through the fine droplets of water in cloud is responsible for creating a rainbow.
Refraction is not the optimal way of obtaining a spectrum since the faint light of a distant star has to pass through the layers of the prism. A better option used in spectrographs is diffraction. This occurs by reflecting the light off a material that has many fine lines called the diffraction grating.
The reflected light then displays the star’s spectrum which can then be used for scientific analysis. A similar thing happens when you hold the underside of a CD and reflect the sun’s rays off it. The fine grooves on the CD act as the diffraction grating and reflect the sun’s spectrum.
A star’s spectrum can be captured on photographic paper or on CCD cameras which can then be analyzed to provide information on the star.