It functions similar to a prism we used to split light in school during physics experiments.
Everyday, we are amazed by new discoveries into space. The instruments used to see the space are generally known as telescopes. They detect visible light. But, to see the band of light, i.e. colour present in the spectrum of light, we use spectroscope. This plays an essential role in detecting wavelength (i.e. colour) of the light source. Red is the longer wavelength and blue is the shortest wavelength known to us. Other colours remain in between these two. Now, how to graph these colours? How do we see into deep space which is not visible to naked eye?
Spectroscope is an instrument used to draw astronomical spectrum. This works on the principle of the diffraction grating. We used to use Compact Disc (CD) for storage until the USB sticks and cloud computing came into existence. The colours of the rainbow coming out of CD must have attracted you when holding it in the light and bending it into various angles. The light present around you is nothing but a spectrum of colours reflected from a CD. CD has circular lines separated by millimetre distance. The data is written by laser technology on these lines. This splits light into equivalent bands present in the light falling on it. The same way spectrograph is used to see bands of light present in the source.

The light sensed by telescope lens goes through a slit on the focal plane. Then it falls on the mirror as shown in the above image. The reflected waves from the collimating mirror fall on the spectrograph. Here, light is split into many present colours in the source light from diffraction grating on a spectrograph. It functions similar to a prism used to split light in school physics experiments. The light is captured from the camera. It is then passed through the detector for further processing to computer. The graph is plotted on the computer screen after post-processing. Thus, enhancing our ability to explore the universe in depth and with enhanced resolution!