What pH buffer solution is needed to give a Mg2+ concentration of 3.0×10−2 M in equilibrium with solid magnesium oxalate?

ksp for magnesium oxalate is 8.6 * 10^-5
ksp for magnesium hudroxide is 1.8 *10^-11 (not sure if needed)

This is not an easy problem to explain on the computer but I'll try. Just repost with questions if you don't understand. I'll just give the steps.

Ksp MgC2O4 = 8.6E-5
k1 for H2C2O4 = 6.5E-2
k2 for H2C2O4 = 6.1E-5
The equations you need are
MgC2O4 ==> Mg^2+ + C2O4^2-
Ksp = (Mg^2+)(C2O4^2-) = 8.6E-5
As you already know the solubility of MgC2O4 is increased when acid is added due to the following reactions:
C2O4^2- + H^+ ==> HC2O4^- (this is k2) and
HC2O4^- + H^+ ==> H2C2O4.(this is k1) That is the H^+ adds to the oxalate ion and to the hydrogen oxalate ion to tie up the C2O4^2- ion and that pulls the Ksp equilibrium to the right which increases the solubility of MgC2O4. I intend to ignore the H^+ + HC2O4^- ==> H2C2O4 (the k1 part). You can look at the k1 vs k2 values and see that they are different by essentially 1000; therefore, for every 1000 C2O4^2- that are tied up by k2 there is ONLY 1 tied up with k1.
Let S = solubility of MgC2O4 and
MgC2O4 ==> Mg^2+ + C2O4^2-
solid..................S...............S
So (Mg^2+)(C2O4^2-) = 8.6E-5
(Mg^2+) = S
Total (C2O4^2-) = S = (Mg^2+) = (C2O4^2-) from MgC2O4 + (HC2O4^-) from the first H^+ + (H2C2O4) from the 2nd H^+ addition. I am ignoring this 2nd one since it contributes so little BUT you can add it in (the k1 part) if you wish once you see how to do the k2 part. So S = C2O4^2- + HC2O4^- = total oxalate which I will call X, then
S/X = (C2O4^2-). Go back to Ksp and put this in.
(Mg^2+)(Mg^2+/X) = Ksp = 8.6E-5 (That's the same as (S)(S/X) = 8.6E-5
But you want (Mg^2+) = 3E-2. Plug that in to get (Mg^2+)^2 = 8.6E-5*X and solve for X. I get something like 10.5. Take this back to the
X = 10.5 = (C2O4^2-) + [(H^+)/k2](C2O4^2-) so
C2O4^2- = 1 and HC2O4^- = 9.5
9.5 = (H^+)(C2O4^2-)/k2. Solve for (H^+) and I get something like 5.79E-4 and convert that to pH. I did that then worked the problem from beginning with just pH known and calculated (Mg^2+) and obtained 3.0E-2.
Hope this helps. I think I just showed that this is hard to explain on the computer.