Hi Student
Hard water contains dissolved magnesium(Mg++) and calcium ions(Ca++). These make it more difficult for the water to form a lather with soap. Temporary hardness is caused by dissolved calcium hydrogencarbonate (which is removed by boiling). Permanent hardness is caused by dissolved calcium sulfate (which is not removed by boiling).