Calculate ion concentrations in mixed buffers

I have to state that I'm not a chemist, nor a chemistry student, but an electrical engineer with some chemistry knowledge. However, for my work I have to deal with a problem, from which my question arose.

There is a buffer solution made by dissolving $\ce{Na2HPO4}$, citric acid and KCl for a certain measurement. I would like to calculate what the ion concenctrations are in the solution.

This is where i got.

• [$\ce{K+}$], [$\ce{Na+}$] and [$\ce{Cl-}$] are quite obvious.
• Denoting the hydrogen phosphate anion as $\ce{BH2-}$, I have written the equation for the phosphate: $\ce{BH^2- (aq) + H2O <=>[K_b] BH2^- (aq) + OH- (aq)}$ and [$\ce{BH^2-}$]+[$\ce{BH2^-}$]=$M_{\ce{Na2HPO4},init}$
• Denoting citric acid simply as $\ce{AH3}$ I have also written the equations for its three hydrolisation steps, such as $\ce{AH3 (aq) + H2O <=>[K_{a1}] AH2- +H3O+}$ and so on two equations more, plus [$\ce{AH3}$]+[$\ce{AH2^-}$]+[$\ce{AH^2-}$]+[$\ce{A^3-}$]=$M_{citric~acid,init}$
• I have written the water autohydrolysis equation $\ce{H2O <=>[K_W] 1/2 H3O+ + 1/2 OH-}$
• I have so far have the 9 unknowns [$\ce{H2O}$], [$\ce{H3O+}$], [$\ce{OH-}$], [$\ce{BH2-}$], [$\ce{BH-}$] [$\ce{AH3}$], [$\ce{AH2^-}$], [$\ce{AH^2-}$], [$\ce{A^3-}$] but only 7 equations. I could do the approximation that the water concentration is constant, which would be more than enough for practical purposes, but still there are 8 unknkowns remain. I could make the approx. that the dissolved citric acid concentration is equal to the final undissociated citric acid contentration, since hardly any dissociates, leaving 7 unknowns. But this is the point where it gets interesting for me, because I don't know how I should proceed without making these approximations, since I don't see clearly the physical and chemical processes in the system. Can you help me what other equations are there which (maybe at the cost of introducing some more variables) finally result in an exactly solvable equation system?

You can ignore K+, Na+ and Cl-. You have to deal with H2O, H3O+, OH-, Ap3-, HAp2-, H2Ap-, H3Ap, Ac3-, HAc2-, H2Ac-, H3Ac. Here H3Ap = H3PO4 and H3Ac = citric acid in neutral state. You have 11 unknowns.

(+1) [$\Delta$H+] = 3*[citric3-]+2*[Hcitric2-]+1*[H2citric-]+[(PO4)3-] - [HPO4-]-2*[H3PO4]
(+1) [H(from_water)+ + $\Delta$H+][OH(from_water)-]=10^-14 (dissociation of H2O)
(+1) [H(from_water)+] = [OH(from_water)-]
(+3) Three dissociation constants of H3PO4 are known
(+3) Three dissociation of citric acid are known
(+1) Concentration of [Ac3- + HAc2- + H2Ac- + H3Ac] is known
(+1) Concentration of [Ap3- + HAp2- + H2Ap- + H3Ap]is known

You have 11 equations.

OH(from_water)- corresponds to total OH- H3O+ corresponds to H(from_water)+ + $\Delta$H+]

//(+1) Water concentration is assumed 1 in solutions

Forget about (PO4)3- and H3PO4. They will have negligible impact on overall pH.

You didn't tell the ratios of Na2HPO4 and citric acid and these ratios are critical. Given pKa of citric (3.15, 4.77, 5.19) and phosphoric (2.15, 7.20, 12.35) acids you will most likely deal with either of these regions:
2.15-3.15 H3Citric + H2Phosphoric-
3.15-4.77 H3Citric+H2Citric-
4.77-5.19 H2Citric- - HCitric2-
5.19-7.20 H2PO4- - (HPO4)2-

If you know which interval you are working with (check ratio of the reagents, aka stoichiometry) then you can pick the relevant equilibrium and set all other concentrations to zero for initial evaluation. 10^-15 M of ions will have zero impact on overall pH.

I regrouped some equations and expanded the one you asked about.

Can you solve it for a general case. Yes, you can. But it is like accounting for air friction, Special and General Theories of Relativity and quantum effects. It is harder, but it does cover more cases. In this case you will be dealing with x^11+a*x^10+...=0 instead of a square equation. You can solve it using Wolframalpha. But at the end of a day you will find that in a given region the impact of majority of members is negligible. Think of it this way. You can approximate the system with a spline (5 polinomials of second degree) or one polinomial of 11th degree.

• Very nice answer, thank you. But I don't understand the last equation with "Added $\ce{H+}$". Do you mean I should set $[\ce{H3O+}]=[\ce{Na2HPO4}]+[\ce{H2Ac^-}]+[\ce{HAc^2-}]+[\ce{Ac^3-}]$? Why? $\ce{HPO4^2-}$ generates $\ce{OH-}$ and $\ce{H3O+}$ too, and the ions generated will be partly vanishing because the extra hydroxide and hydroxonium ions generated will partly react to form water, right? And lastly: can you at least write the principles of what you would do if you didn't want to make this approximation of constant water concentration? This I'd like to know out of personal interest. – user3237992 Jul 15 '16 at 8:14
• Be careful. AcOH is acetic acid. It only have 1 acidic hydrogen and a single pKa. Your original question was about citric acid. It has three acidic hydrogens and three corresponding pKa. Which one are you talking about? – sixtytrees Jul 15 '16 at 14:30
• You need to use right coefficients in the equation. If going from Na2HPO4 to H3PO4 requires 2 hydrogens then you take it as -2*[H3PO4] – sixtytrees Jul 15 '16 at 14:33
• Thank you again, I almost get it, but I see another problem. The way I see it, you've introduced a new variable, $\Delta\ce{H+}$ or $[\ce{H+}]_{total}=[\ce{H+}+\Delta\ce{H+}]$ (one of them is a new variable), but didn't increase the number of equations. The problem is, that I can't do $[\Delta\ce{H+}]\approx[\ce{H+}]$, because $[\Delta\ce{H+}]$ is sometimes negative, giving unphysical results. Second, I think in the equation for $[\Delta\ce{H+}]$ you wanted to write "$-[\ce{H2PO4^2-}]$" instead of "$-[\ce{HPO4^-}]$". – user3237992 Jul 15 '16 at 20:10
• @user3237992 Good catch. I've fixed it. When working with such large systems accounting errors (forgot "-" sign and a coefficient) are quite common and difficult to spot. It is much easier to spot them in "acetic acid was added to sodium acetate". The fact that glass walls also have buffering properties should be ignored because it complicates picture and doesn't impact the system. – sixtytrees Jul 15 '16 at 20:25