Mass spectrometry is an analytical technique that measures the mass-to-charge ratio of ions to determine the composition of samples, originally conceptualized by J.J. Thomson and further developed by notable scientists like Francis Aston. This technique is widely used in both organic and inorganic chemistry for identifying, quantifying, and analyzing various substances, including organic molecules and metal contaminants. Mass spectrometers work by ionizing molecules, accelerating them, and then separating and detecting the ions based on their mass, making it essential in fields ranging from biochemistry to environmental analysis.