When we want to know about what a material is made of, the first thing we need is, obviously, to have a certain amount of the material we want to study. Once we get it, we go to that area of the scientific knowledge, often hated by students, which is chemistry. Chemistry, as Linus Pauling defined it, is the science that study substances, its structure, its properties and the reactions that transform them in other substances.
Within chemistry, there is an area in charge of telling us what the chemical composition of the substance we want to study is: the analytical chemistry. To achieve its objective, the analytical chemistry uses a set of methods that depending on its nature can be pure chemical methods, based on the reactions that a substance has in the presence of other ones, or physical chemistry methods, which depend on how some substances physically interact with other ones.
But, how do we do to study the chemical composition of something that we do not have any amount at hand?. This is the situation that appears, without exception, when we want to know the composition of stars or the interstellar medium. It could seem to be impossible but it is true that we know it better and better. As a proof of that, it has been recently searched for ethanethiol in the Kleinmann-Low region inside the Orion nebula.
Kleinmann-Low region in the Orion nebula (Source: NASA APOD, CISCO, Subaru 8.3 m telescope, NAOJ)
Then, how do we do it? We need to go to different areas of science, among which we have chemistry (analytical chemistry), astrophysics and astronomy (concretely astronomical instrumentation)
We mentioned before that the analytical chemistry is in charge of studying the chemical composition and for that purpose it uses different methods. One of them is the spectrometric method, which consists in studying the interaction of the electromagnetic radiation (in every wavelength of the electromagnetic spectrum) with the matter it impacts. Spectrometry uses spectrometers (also known as spectroscopes or spectrographs) which are devices that separate de light in the wavelengths that is made of. The most simple spectroscope (in which functional principle are based all of them) is a simple prism. Using a prism, Newton managed to split the white light coming from the sun in the colors it was made of, getting in such a way the first spectrum in history. However, it was Kirchhoff and Bunsen who invented the first spectroscope by adding a graduated scale allowing them to identify the wavelength of the spectral lines observed when the light passed through the prism. When the image is registered on a device, either electronic or a simple photographic plate, we used to speak about a spectrograph.
Chemical substances can be found in the form of atoms or molecules. In the first one, individual atoms are not bounded to other atoms. In the second one, atoms, which can be of the same kind or different, are bonded amongst them through chemical bonds giving rise to molecules. The electrons that are inside atoms, or that are bond to make up a molecule, can be in different energy states. If there is not any radiation impacting on them (whatever the wavelength), electrons are in their lowest energy state. When radiation impact on them, the electrons jump to a higher energy state. However, due to the electrons tend to be in their lowest energy state, once the radiation stops impacting on them they return to their lowest energy state and, for it, they have to get rid of the energy excess provided by the incoming radiation, emitting the excess of energy in the form of radiation. The difference between the energy of the initial and final energy states tells us the wavelength of the emitted radiation.
Each atom or molecule has different energy states that are characteristic and, therefore, depending on the incoming energy, the transitions between energy states will be different and thus the emitted radiation will be different too. These energy states can be of different types and include vibrational states (due to the vibration of the atom or molecule) or rotational states (due to the rotation of the atom or molecule). On another hand, each energy state cannot be a single one, but can be split in different states in presence of, for instance, a magnetic field, thus enabling additional transitions and the possibility of the emission of the excess of energy in additional wavelengths.
Transitions between energy states that give rise to spectra (Source: monografías.com)
Analytical chemists use, amongst other methods, the spectrometric method to study the structure of these atoms or molecules and their interaction with radiation. Because each atom and molecule has a specific structure of energy levels different to the rest, and that it interacts with radiation in a specific way depending on the type of radiation (and the environmental conditions, such as the presence of magnetic fields), it can be created a catalogue of spectra, so that the next time we see the same spectrum in other place, we could identify the substance we are dealing with.
Some of the places where we can find spectra are stars and the interstellar medium. The problem we have is that we cannot directly access to the star, gather some amount of matter and take it back the laboratory to study it. What we can do is to use our optical telescopes or radio telescopes, to equip them with spectrographs to give us the chance to observe the spectra, with sensors appropriate for the type of radiation (wavelength) we want to observe and point them towards the region of the sky we want to study. The analysis of the spectra through its comparison with the spectra obtained in the laboratory could give us the chemical composition of our object under study. And not only that, we are going to be able to get much more information such as the rotation and translation speeds that have the object (through the measure of the Doppler effect, because the spectral lines will appear displaced, with regards to its position in the laboratory, to the spectrum part where there are longer or shorter wavelengths depending on whether the object is approaching to or recessing from us) or even the intensity of the magnetic field that could be in the region we are looking at.
As always, reality is always much more complex, but we can always rely on the human will and the capacity that scientists have to look for solutions to the problems that the universe presents. And as it has been seen, what for me is the most important thing, we can rely on the collaboration between different scientific areas in the search for those solutions, appearing, in some cases, new scientific fields as result of such collaboration. This is the case of Astrochemistry, which is basically the scientific area that has been addressed in this post.