The removal of hard-water cations, called water softening, is accomplished by exchanging ions for and ions.
A typical domestic system for ion exchange contains an ion exchange resin, an insoluble polymer that has covalently bonded anion groups, such as or ,to which ions are attached to balance the charges.
The divalent cations in hard water are attracted to the resin’s anionic groups and displace the ions into the water.
Therefore, Water containing and ions is called hard water. Water is "softened" by the removal of dissolved hard water cations, which displace from a resin.