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 &lt;=&gt;[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 &lt;=&gt;[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 &lt;=&gt;[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.