The thing about the solution is that the Mg
2+ and Ca
2+ ions are in the same solution. As a result, when you add OH
- ions, the solubilities of both of the metal hydroxides are affected.
We can find the concentrations of solutes in solution using Ksp. In you r case, the Ksp is the equilibrium constant for the reaction M(OH)
2 M
2+ + 2OH
-, when M is either Mg or Ca.
The Mg(OH)
2 precipitates out first. However, that doesn't mean that there still isn't Mg(OH)
2 still dissolved in the solution. The formation of a precipitate just means that there is too much solute that can be dissolved in the solution at that particular time, and so any excess solute falls out.
Since there will always some amount dissolved, no matter how infinitesimally small that amount may be, and the amount dissolved will always follow the Ksp equilibrium, we can use the Ksp to calculate the amount of dissolved solute at any time, even after solute begins to precipitate.
What the problem is asking for is the concentration of [Mg
2+] still in solution at the point at which Ca(OH)
2 is beginning to precipitate. The logic of the problem is that, since the hydroxide ion concentration will be the same when we solve for the concentration of the metal ions in both Ksp equations, we can find the concentration of both ions in the solution when we know the hydroxide concentration. You would first solve for the hydroxide concentration when Ca(OH)
2 begins to precipitate, and then "plug it in" into the Ksp for for Mg(OH)
2 precipitation. Then you can solve for [Mg
2+] using the Ksp value and [OH
-].
Essentially, you find [OH
-] from the Ca(OH)
2 Ksp equilibrium, and then substitute it into the Mg(OH)
2 equilibrium to calculate the amount of [Mg
2+] still left dissolved in the solution.