# What is the math behind the formula for the concentration of the strong titrant when calculating theoretical buffer capacity of a diprotic system?

I have a question related to finding the theoretical buffer capacity of a diprotic system, specifically about the formula for the concentration of the strong titrant. In this post:

What is the formula for theoretical buffer capacity for a diprotic buffer system?

The top answer, given by grsousajunior, gives the equation for a buffer capacity, calculated by taking the derivative of the concentration of strong base as a function of pH. All of the math makes sense to me, except for the given equation for the concentration of strong base, $$C_\mathrm{B}$$. Here’s how my math for that equation worked out (most of this is reiterated in grsousajunior’s answer):

The first ionization is represented by the equation:

$$\mathrm{H_2A+H_2O\rightleftharpoons HA^-+H_3O^+}$$, and therefore has a $$K_\mathrm{a1}$$ of $$K_\mathrm{a1}=\mathrm{\frac{[H_3O^+][HA^-]}{[H_2A]}}$$

The second ionization is represented by the equation:

$$\mathrm{HA^-+H_2O\rightleftharpoons A^{2-}+H_3O^+}$$, and therefore has a $$K_\mathrm{a2}$$ of $$K_\mathrm{a2}=\mathrm{\frac{[H_3O^+][A^{2-}]}{[HA^-]}}$$

Shifting around the equation for $$K_\mathrm{a1}$$ to find $$\mathrm{[HA^-]}=\frac{K_\mathrm{a1}\mathrm{[H_2A]}}{\mathrm{[H_3O^+]}}$$ and putting that into the equation $$\mathrm{[A^{2-}]}=\frac{K_\mathrm{a2}\mathrm{[HA^-]}}{\mathrm{[H_3O^+]}}$$, $$\mathrm{[A^{2-}]}=\frac{K_\mathrm{a1} K_\mathrm{a2}\mathrm{[H_2A]}}{\mathrm{[H_3O^+]^2}}$$, at least by my math.

As far as I can tell, grsousajunior after that used the equation for the charge balance:

$$\mathrm{[H_3O^+]+[B^+]=[OH^-]+[HA^-]+2[A^{2-}]}$$

Which I think is correct, solved it for $$\mathrm{[B^+]}$$, and got $$\mathrm{[B^+]}=C_\mathrm B=\mathrm{[OH^-]-[H_3O^+]+[HA^-]+2\,[A^{2-}]}$$. Again, this is just speculation on my part. This brings me to my source of confusion. In the answer, grsousajunior gives the equation $$C_\mathrm B=\frac{K_\mathrm w}{\mathrm{[H_3O^+]}}-\mathrm{[H_3O^+]}+\frac{K_\mathrm{a1}\,\mathrm{[H_2A]}\left(\mathrm{[H_3O^+]}+2K_\mathrm{a2}\right)}{\mathrm{[H_3O^+]^2}+K_\mathrm{a1}\mathrm{[H_3O^+]}+K_\mathrm{a1}K_\mathrm{a2}}$$. To me, it looks like $$\mathrm{[OH^-]}$$ from the charge balance equation became $$\frac{K_\mathrm w}{\mathrm{[H_3O^+]}}$$, which makes perfect sense.

What I don’t get is how $$\mathrm{[HA^-]+2[A^{2-}]}$$ became $$\frac{K_\mathrm{a1}\,\mathrm{[H_2A]}\left(\mathrm{[H_3O^+]}+2K_\mathrm{a2}\right)}{\mathrm{[H_3O^+]^2}+K_\mathrm{a1}\mathrm{[H_3O^+]}+K_\mathrm{a1}K_\mathrm{a2}}$$.

When I add the equations that I have for those two concentrations, doubling the latter, I instead get $$\frac{K_\mathrm{a1}\,\mathrm{[H_2A]}\left(\mathrm{[H_3O^+]}+2K_\mathrm{a2}\right)}{\mathrm{[H_3O^+]^2}}$$. Everything is the same, except for the denominator. To me, it looks like the denominator somehow ended up as a quadratic, and I have know idea why. My best guess is that the concentrations of hydronium are separate between the two ionizations, but I don’t know how to wrangle out the math for that.

Does anyone know if or how the math I did is wrong? Thank you!

P.S. - Everything after this step makes sense to me, but the equation for buffer capacity that I would end up with using my equation for the concentration of strong base would look a bit different.

The equation that you have derived (the last one you show) $$$$\frac{K_\mathrm{a1}\mathrm{[H_2A]}\left(\mathrm{[H_3O^+]}+2K_\mathrm{a2}\right)} {\mathrm{[H_3O^+]^2}} = \color{blue}{\left(\frac{\ce{[H2A]}}{\ce{[H3O^+]}^2}\right)} K_\mathrm{a1}([\ce{H3O+}] + 2K_\mathrm{a2}) \tag{1}$$$$ is correct. However
1. $$C_\ce{H2A}$$ refers to the initial concentration of the species
2. $$\ce{[H2A]}$$ refers to the equilibrium concentration of the species. This is the term that appears in the equilibrium constants.
The relation between both can be found by a mass balance, and replacing $$\ce{[HA-]}$$ and $$\ce{[A^2-]}$$ with the expressions that you have obtained \begin{align} C_\ce{H2A} &= \ce{[H2A]} + \ce{[HA-]} + \ce{[A^2-]} \\ &= \ce{[H2A]} + \frac{K_\mathrm{a1}\ce{[H2A]}}{\ce{[H3O^+]}} + \frac{K_\mathrm{a1}K_\mathrm{a2}\ce{[H2A]}}{\ce{[H3O^+]}^2} \\ &= \frac{\ce{[H3O^+]}^2\ce{[H2A]}}{\ce{[H3O^+]}^2} + \frac{\ce{[H3O^+]} K_\mathrm{a1}\ce{[H2A]}}{\ce{[H3O^+]}^2} + \frac{K_\mathrm{a1}K_\mathrm{a2}\ce{[H2A]}}{\ce{[H3O^+]}^2} \\ &= \frac{[\ce{H2A}]}{\ce{[H3O^+]}^2} (\ce{[H3O^+]}^2 + K_\mathrm{a1} \ce{[H3O^+]} + K_\mathrm{a1}K_\mathrm{a2}) \\ \color{blue}{\frac{[\ce{H2A}]}{\ce{[H3O^+]}^2}} &= \frac{C_\ce{H2A}}{{\ce{[H3O^+]}^2 + K_\mathrm{a1} \ce{[H3O^+]} + K_\mathrm{a1}K_\mathrm{a2}}} \tag{2} \end{align} and combining Eqs. (1) and (2) in blue $$$$\frac{C_\mathrm{H_2A}K_\mathrm{a1}([\ce{H3O+}] + 2K_\mathrm{a2})} {{\ce{[H3O^+]}^2 + K_\mathrm{a1} \ce{[H3O^+]} + K_\mathrm{a1}K_\mathrm{a2}}}$$$$ which is the term that you are searching for.