Explanation:
The water is hard due to the presence of ions of Mg²⁺. Now in hard water soaps are ineffective . Since in hard water Mg²⁺ ion forms precipitate , which concludes less number of soap molecules are present in the solution and less amount of froth which disables the cleansing property of the soap .
Now the experiment , the very last step is the hard water test where some amount of MgCl₂ is added ,
Now this magnesium salt act as a source of Mg²⁺ ion and now the soap action can be determined , whether it is able to form froth or not .