Mass spectrometry involves ionizing a sample, separating the ions based on their mass-to-charge ratio, and detecting the ions. It provides information about molecular weight, structure, and composition. The sample is bombarded with electrons to produce positively charged ions, which are accelerated and deflected by a magnetic field according to their mass. Different types of ions are detected based on their unique mass-to-charge ratios. Mass spectrometry is used to determine molecular formulas, reveal structural units, and prove molecular identities. It is a sensitive technique requiring only a small amount of sample.