Answer:
The spectrum of a star can be used to determine its composition by observing the spectrum lines that gains by the diffraction pattern of different light wavelengths and the Fraunhofer lines observed through spectroscope.
Explanation:
As far as we all have seen the attractive rainbow colours in the moist daylight, we know the seven colours that are visible to our eyes. what we see is actually the spectrum of the white light emitted by the light sources or we can say the Sun which is a star.
With the invention of spectroscopy, it gets feasible for us to evaluate the different spectrum displayed by the prism and diffraction grating. The light emitted from the source or stars as we can say in this discussion, are spread into its constituent visual wavelengths that is known as the Spectrum. This method is known as spectroscopy.
With the help of spectrometer, astronomers can easily observe the wavelengths, their properties and eventually judge the elements through which the lights is emitted.
For example, in case of Sun, it is composed of Hydrogen (87%), Helium (10%), and other elements (3%). With the estimation of the strength of various spectral lines, it gets possible to find various elements and their amount with which they are composed such as the Sun is mostly made of the Hydrogen and helium gas.
in this way, we can easily observe the elements according to the spectral pattern studied through spectrometer and compare them with the elements in the periodic table. Hence, we can determine the composition of stars.