Soap molecules sodium and potassium reacts with magnesium and calcium present in hard water and thus form slum. so, soap is not effective in hard water( tap water , hand pump water ) . this problem overcomes by using detergents . detergents are generally ammonium and sulphonate salts of long chain of carboxylic acids. This do not form slum ( insoluble precipitate ) and remain effective in hard water.