Temporary hardness of water is due to the presence of soluble salts of magnesium and calcium in the form of hydrogen carbonates (MHCO3, where M = Mg, Ca) in water.
Permanent hardness of water is because of the presence of soluble salts of calcium and magnesium in the form of chlorides in water.