Here's how it works:
* Prisms: A prism is a triangular piece of glass or other transparent material. As light passes through a prism, it bends at different angles depending on its wavelength. This separation of colors is called refraction.
* Diffraction Gratings: A diffraction grating is a surface with many closely spaced lines or grooves. When light passes through a diffraction grating, it is diffracted, meaning it spreads out into its component wavelengths. This creates a spectrum of colors similar to what a prism produces.
Both prisms and diffraction gratings are used in spectroscopes. The choice depends on the specific application and the desired level of detail in the spectrum.