Electrons jumping between different energy levels in atoms emit and absorb photons in a characteristic way for each element. Thus, astronomers can use the light from distant objects to deduce their chemical compositions.