In addition there is a difference in the way the sodium and potassium soaps behave in water. Both potassium and sodium soaps dissolve in water and are effective as cleaning agents. Each has a polar end to the molecule identified by the negative charge and an end that is primarily carbon and hydrogen. The polar end attracts polar water molecules. The other end, hydrocarbon end, attracts oils and other water insoluble materials like fat or grease.
Water is a polar solvent and dissolves polar and ionic molecules.
Gasoline is nonpolar and dissolves nonpolar materials such as fat or oil. The nonpolar ends of the molecule associate with the fat, grime or dirt which is also nonpolar, The polar or ionic end of the molecule attracts the water molecules. This spherical shaped unit of soap and grime is a micelle . Magnesium and calcium salts of the same fatty acids that make up potassium and sodium soaps are not water soluble. When sodium or potassium soaps are put into water containing calcium and magnesium ions, the cloudyness, scum or curds consist of less soluble calcium and magnesium soaps.