Phosphoric acid

P Reinhardt 5/2015

Example for the fact that chemistry needs a very high working precision

Input in logarithmic form

The concentration, as logarithm, should be between 0 and 7

pc=3;

Literature data for water and phosphoric acid

pKe=14;
pKa1=2.15;
pKa2=7.2;
pKa3=12.25;

In real values

Ke=10.^(-pKe);
Ka1=10.^(-pKa1);
Ka2=10.^(-pKa2);
Ka3=10.^(-pKa3);
c=10^(-pc);

The equation to be solved

The equation results from the autoprotolysis of water (Ke = [H3O+] [OH-] ), the electroneutrality ( [H3O+] =  [OH-] +  [AH2-] +  2 [AH--] +  3 [A---] ) and the definition of the acidities ( Ka_k = [A(k)-][H3O+]/[A(k-1)-] ). The solution may be expressed as a recursion in the A(k).

Sol=FindInstance[{h^2-Ke==c*Ka1(1+Ka2(2+3Ka3))/(1+Ka1/h(1+Ka2/h(1+Ka3/h))),h>0},h,WorkingPrecision->25]

h3o=h/.Sol[[1,1]]

Calculating the resulting calculations of the species

pH=-Log[10,h3o]

a0=c/(1+Ka1/h3o((1+Ka2/h3o(1+Ka3/h3o))))
a1=Ka1 a0/h3o
a2=Ka2 a1/h3o
a3=Ka3 a2/h3o

Sum of all species, should be the initial concentration

a0+a1+a2+a3==c

Graphical solution, showing that there is indeed just one single solution

Plot[{h^2-Ke,c*Ka1(1+Ka2(2+3Ka3))/(1+Ka1/h(1+Ka2/h(1+Ka3/h)))},{h,1. 10^-7,2c}]