Soap is used to wash many things like dishes or clothing. It acts as a surfactant which emulsifies oils and allows them to be carried by water, it is called a cleaning and emulsifying agent.
Historically soap was made by using a combination of rain water, animal fats or vegetable oils and ashes. After thousands of years the major ingredient in the ashes was discovered, it is a strong base. For a very long time all soap was solid soap, until 1865 when a man named William Sheppard developed a liquid version. Now we have a big variety of different liquid soap which is very important because it makes cleaning things like floors and clothes much more easy.
Soap is derived from triglyceride which is the fat storage molecules. Animal fats and vegetable oils form pure triglycerides. A molecule of triglyceride is formed by a molecule of glycerol with three fatty acids. So, there are two major parts of the triglyceride molecule: the glycerol backbone and the fatty acid tails an ester bond connects the tails to the backbone.
Animal fats + Vegetable oil —> Triglyceride
The ester bond is relatively sensitive, when triglycerides are mixed with a strong base like sodium hydroxide a saponification reaction occurs, which leads to break this ester bond and to form glycerol and fatty acid salt. This salty fatty acids are the main component of soap.
One end (-COO–) has a strong charge, which makes it polar while the long carbon chain tail (R-) is nonpolar. The polar end is hydrophilic literally meaning water-loving and the nonpolar chain is lipophilic meaning fat loving. In general nonpolar molecules dissolve in nonpolar liquids like oils and polar molecules dissolve in polar liquids like water.
The molecule of soap is polar and nonpolar, so it acts as a bridge between the oil and the water. When soap is mixed with water the molecules arrange themselves into spherical structures called micelles, the hydrophilic and polar heads are on the outside in contact with the water and the nonpolar tails on the inside. the micelles are not dissolved in the water, they form a colloid.
Micelles can pick up and hold a small droplet of oil in their nonpolar interior. The nonpolar tails on the inside dissolve into the oil and the entire droplet is protected from water. The polar heads give the surface a negative charge which helps repel other micelles, this keeps the oil separated. The oil is taken away with water as very small stabilized droplets. That’s basically how soap works.