Soap scum is an informal term for the white solid that results from the addition of soap to hard water. Hard water contains calcium or magnesium ions, which react with the fatty acid component of soap to give what are technically called lime soaps:
In this reaction, the sodium ion in soap is replaced by calcium ions to form insoluble compounds.
Lime soaps are ineffective in washing dishes or clothes or hair. Thus, hard water needs large amounts of soap to form a lather, and in hair washing, the soap scum sticks in the hair. Synthetic detergents are less susceptible to the effects of hard water.
Although soap scum is generally considered a nuisance, its components, calcium stearate and magnesium stearate, when produced intentionally, are very useful materials in the polymer industry and in pharmaceutical industry.
Soap scum on vinyl shower curtains has been reported to constitute a rich microbial biofilm, containing potentially pathogenic bacteria.