No matter how much fun we have squishing our toes in the mud, we love to be clean. We want our clothes to be fresh, our dishes to be spotless, and our cars to be shiny. We continue to invent new ways to make things clean, and soap was probably discovered only shortly after cooking, as the fats from the food hit the ashes from the fire.
Surfactants have a hydrophilic side of the molecule attaches to water, and a hydrophobic side of the molecule that avoids water. In the absence of oils, the hydrophobic side sticks out of the surface of the water drop. There is no longer any water at the surface to form a strong surface tension, so the water no longer beads up, but spreads. The hydrophobic end of the molecule is also free to attach to grease, fat, or oil on the surface, aiding in the spreading.
Microbes could not break down branch-chain detergents, so they left foam in river water. They were replaced by straight-chain alkyl benzene sulfonates, such as Sodium dodecylbenzinesulfonate and sodium xylenesulfonate.
Straight-chain detergents don't work in hard water. Phosphates were added to detergents to soften the water, but phosphates are excellent fertilizer for algae in rivers and oceans. The algae blooms deplete the oxygen in the water, killing fish. Phosphates were replaced with other water softeners such as sodium carbonate and EDTA.
Later, surface-acting polyglucosides were created. These sugar-based detergents are easily broken down by microbes, leaving no traces in the environment. They consist of a pair of glucose molecules, with hydrocarbon side chains attached to act as the hydrophobic ends. They are milder than soaps, and work in hard water.
Another type of detergent is a group called the pyrrolidones. These are complex molecules that dissolve in both water and organic solvents.
Laundry detergent may also contain polyethylene glycol, a polymer that prevents dirt from re-depositing on the clothes. This function used to be the job of phosphates. Another polymer used for this purpose is carboxy methyl cellulose. This is derived from natural cellulose, but is very soluble in water.
Yet another ingredient in laundry detergents is Diethyl Ester Dimethyl Ammonium Chloride (DEEDMAC). It is a fabric softener. It is a cationic surfactant that is rapidly biodegradable. It works by reducing the friction between fibers, and between fibers and the skin. Cationic surfactants are those where the hydrophilic part (in this case the ammonium chloride) is positively charged, and is attracted to substrates that are negatively charged, such as proteins and many synthetic fabrics. Hair conditioners use this trick also. You can think of a hair conditioner as fabric softener for your head.
A cationic surfactant will often have an ammonium group attached to a halogen, as in the ammonium chloride mentioned above. Anionic surfactants, such as soap, often have a sodium, potassium, or ammonium group, as in sodium stearate.
Non-ionic surfactants like polyethylene glycol esters (PEG) are used as mild cleansers, or to add viscosity to a mixture like shampoo.
Amphoteric surfactants are those that are an acid and a base at the same time (like water is). Cocamidopropyl betaine is an example, used in shampoos to stabilize foam and thicken the mixture.
Some examples of detergents and surfactants are:
Classes of detergents: