Weak acid mass and charge balances (source code)

= Weak acid mass and charge balances

Consider only neutral $\mathrm{HA}$ added to pure <water>, at fixed <temperature>, with ideal dilute <thermodynamic activities>, <water> <thermodynamic activity> approximated by one, and no added salts or other <chemical species>. Normalize every <concentration> by $c^\circ=1\,\mathrm{mol\,L^{-1}}$:
$$
c=C_T/c^\circ,\qquad h=[\mathrm H_3\mathrm O^+]/c^\circ,\qquad x=[\mathrm A^-]/c^\circ,\qquad y=[\mathrm{HA}]/c^\circ,\qquad o=[\mathrm{OH}^-]/c^\circ.
$$
Conservation of acid units and zero net <electric charge>, respectively, require
$$
x+y=c,\qquad h=x+o.
$$
The second equation balances positive <hydronium> against negative <conjugate base> and <hydroxide>. It would need all additional <ions> if salts or a <chemical base> were added. Together with <acid dissociation constant> $K_a=hx/y$ and the <self-ionization of water> relation $K_w=ho$, these give
$$
x=\frac{K_ac}{K_a+h},\qquad y=\frac{hc}{K_a+h},\qquad o=\frac{K_w}{h},\qquad
h-\frac{K_w}{h}-\frac{K_ac}{K_a+h}=0.
$$
This is exact within the stated ideal model, including depletion and <self-ionization of water>. Multiplication by $h(K_a+h)$ yields the <cubic equation>
$$
h^3+K_ah^2-(K_w+K_ac)h-K_aK_w=0.
$$
For positive $K_a,K_w,c$, the unmultiplied left-hand side increases strictly from negative to positive values as $h$ increases from zero to infinity; its <derivative> is $1+K_w/h^2+K_ac/(K_a+h)^2>0$. There is therefore exactly one positive <root of a polynomial>. A <bisection method> can find it without choosing an unphysical <root of a polynomial>.

If $K_w/h^2\ll1$, neglect <hydroxide>, so $h\approx x$ and the <quadratic equation> retaining acid depletion gives
$$
\frac{x^2}{c-x}=K_a,\qquad
x=\frac{\sqrt{K_a^2+4K_ac}-K_a}{2}
=\frac{2K_ac}{\sqrt{K_a^2+4K_ac}+K_a}.
$$
The last form avoids subtracting nearly equal numbers. If also $x/c\ll1$, neglect depletion to obtain
$$
h\approx x\approx\sqrt{K_ac},\qquad
[\mathrm H_3\mathrm O^+]\approx\sqrt{K_a c^\circ C_T}.
$$
Check both conditions after computing: $x/c$ measures the fraction lost from the initial undissociated <weak acid> inventory, while $K_w/h^2$ measures the omitted <hydroxide> contribution to <electric charge> balance. A $5\%$ depletion criterion is a chosen tolerance, not a universal boundary. Keeping depletion does not cure the neglect of <self-ionization of water>. These <weak acid mass and charge balances> also explain why the <square root> estimate cannot be extended to arbitrarily dilute <chemical solutions>.