How spectroscopy works?

Can you answer this question?