Why do soaps not work with hard water ?
Calcium and magnesium salts present in hard water react with soaps to from insoluble compounds, which form curdy white precipitates and are difficult to remove from the clothes.
2C17H35COONaSoap+MgCl2(In hard water)⟶(C17H35COO)2Mg↓White curdy ppt
2C17H35COONaSoap+CaCl2(In hard water)⟶(C17H35COO)2Ca↓+2NaClWhite ppt