Acids and Bases
An acid HA is a proton donor; it produces H^{+} ions (or H_{3}O^{+}) when dissolved in water:
(1)  HA = H^{+} + A^{} 
(2)  HA + H_{2}O = H_{3}O^{+} + A^{} 
In the following we prefer the shorter notation of 1, but keep in mind that H^{+} ions do not exist in a free state; they are extremely reactive and form hydronium ions H_{3}O^{+}.
In contrast, a base B is a proton acceptor:
(3)  B^{} + H^{+} = HB 
According to Brønsted, protons are transferred between conjugate acidbase pairs, which becomes evident when 1 is added to 3:
(4a)  HA + B^{}  =  HB + A^{} 
(4b)  acid_{1} + base_{2}  =  acid_{2} + base_{1} 
One special case is the selfdissociation of water:
(5)  H_{2}O + H_{2}O = H_{3}O^{+} + OH^{} 
Here, water acts either as an acid or a base. Such substances are called ampholytes.
Acidity Constants K_{a} (and pK_{a})
The equilibrium constant of reaction (1) is called ‘acid dissociation constant’ or
(6)  acidity constant: 
The value of K_{a} resembles the strength of the acid (large numbers are strong acids, small numbers are weak acids). In practice, it is more convenient to use the (base10) logarithmic form of 6:
(7)  log K_{a} = log {H^{+}} + log {A^{}} – log {HA} 
The negative decadic logarithm of the acidity constant is abbreviated by pK_{a}:
(8)  pK_{a} = – log K_{a} 
Thus, using the definition of pH as pH = –log {H^{+}}, 7 converts to
(9)  pK_{a} = pH – log {A^{}} + log {HA} 
The pK_{a} value allows a classification into strong and weak acids: The smaller the pK_{a} the stronger the acid – quite the opposite to a K_{a}based ranking. In literature, several types of such classification exist. How this is handled in aqion is described here.
Polyprotic Acids
Acids can donate one, two or more protons (H^{+}). Typical examples are:
Monoprotic acid (HA)  Diprotocic acid (H_{2}A)  Triprotic acid (H_{3}A)  

HCl  H_{2}CO_{3}  H_{3}PO_{4}  
HNO_{3}  H_{2}SO_{4}  H_{3}AsO_{4}  
HI  H_{2}CrO_{4}  H_{3}BO_{3}  
HF  H_{2}SeO_{4}  citric acid  
formic acid  oxalic acid  …  
acetic acid, …  … 
A monoprotic acid is characterized by a single acidity constant K_{1} (= K_{a}), a diprotic acid by two acidity constants (K_{1}, K_{2}), and a triprotic acid by three acidity constants (K_{1}, K_{2}, K_{3}):
1^{st} diss. step:  H_{3}A = H^{+} + H_{2}A^{}  K_{1}  
2^{nd} diss. step:  H_{2}A^{} = H^{+} + HA^{2}  K_{2}  
3^{rd} diss. step:  HA^{2} = H^{+} + A^{3}  K_{3} 
The three reaction steps of a triprotic acid can also be written as:
H_{3}A = 3H^{+} + A^{3}  K_{1}K_{2}K_{3}  
H_{2}A^{} = 2H^{+} + A^{3}  K_{2}K_{3}  
HA^{2} = H^{+} + A^{3}  K_{3} 
with equilibrium constants constructed from K_{1}, K_{2}, and K_{3}. In fact, this procedure can be extended to any Nprotic acid with N dissociation steps.
Ranking. Protons are released sequentially one after the other, with the first proton being the fastest and most easily lost, then the second, and then the third (which is most strongly bound). This yields the following ranking of acidity constants of a polyprotic acid:^{1}
(10)  K_{1} > K_{2} > K_{3}  or  pK_{1} < pK_{2} < pK_{3} 
For example, phosphoric acid has pK_{1} = 2.147, pK_{2} = 7.207, and pK_{3} = 12.346.
In the following we focus on diprotic acids (including carbonic acid as a case of exceptional interest). An alternative description, based on the tableaux method,^{2} is presented as PowerPoint.
Diprotic Acids
When a diprotic acid H_{2}A is added to pure water the equilibrium system is characterized by five dissolved species: H^{+}, OH^{}, H_{2}A, HA^{}, and A^{2}.
Thus, five equations are required for a rigor mathematical description:
(11a)  K_{1}  = {H^{+}} {HA^{}} / {H_{2}A}  (1^{st} diss. step) 
(11b)  K_{2}  = {H^{+}} {A^{2}} / {HA^{}}  (2^{nd} diss. step) 
(11c)  K_{w}  = {H^{+}} {OH^{}}  (selfionization of water) 
(11d)  C_{T}  = [H_{2}A] + [HA^{}] + [A^{2}]  (mass balance) 
(11e)  0  = [H^{+}] – [HA^{}] – 2 [A^{2}] – [OH^{}]  (charge balance) 
The first three equations are massaction laws; the last two equations represent the mass balance and the charge balance. While the massaction laws are based on activities (denoted by curly braces), the massbalance and chargebalance equations rely on molar concentrations (denoted by square brackets).
An exact solution in closed form (i.e. analytical formula) is only possible, when the activities in the first three equations are replaced by molar concentrations. This can be done either in a very dilute system or by switching to conditional equilibrium constants ^{c}K. In the following we assume that this has been done (without explicitly introducing the notation ^{c}K).
Ionization Fractions. The simplest description of the species distribution as a function of pH can be obtained just from a subset of three equations: 11a, (11b) and (11d). From the first two equations one gets (with the abbreviation x = [H^{+}] = 10^{pH}):
(12)  [H_{2}A] = (x/K_{1}) [HA^{}] and [A^{2}] = (K_{2}/x) [HA^{}] 
Entering it into 11d yields
(13)  C_{T} = (x/K_{1} + 1 + K_{2}/x) [HA^{}] 
This allow us to write for the three dissolved species the following simple formulas:
(14)  [H_{2}A] = C_{T} a_{0}  [HA^{}] = C_{T} a_{1}  [A^{2}] = C_{T} a_{2} 
based on three ionization fractions:
(15a)  a_{0} = [ 1 + K_{1}/x + K_{1}K_{2}/x^{2} ]^{1}  =  (x/K_{1}) a_{1}  
(15b)  a_{1} = [ x/K_{1} + 1 + K_{2}/x ]^{1}  
(15c)  a_{2} = [ x^{2}/(K_{1}K_{2}) + x/K_{2} + 1 ]^{1}  =  (K_{2}/x) a_{1} 
It’s easy to check that all three coefficients add up to 1:
(16)  a_{0} + a_{1} + a_{2} = 1  (mass balance) 
Due to their elegance and simplicity, diagrams of ionization fractions appear in almost any textbook on hydrochemistry. Below is an example for the carbonic acid system (with pK_{1} = 6.35, pK_{2} = 10.33):
The formulas in 14 which predict the pH dependence of the three dissolved species can also be put into a more compact form:
(17)  [H_{2i }A^{i}] = C_{T} a_{i}(x)  for i = 0, 1, 2 
Be careful though, these equations suggest that the amount of each species is determined by both pH (or x) and C_{T}. But this is not true. C_{T} cannot be chosen freely; its value is completely determined by pH too, but until now, we ignored charge balance and the selfionization of water, i.e. 11e and (11c). Thus, for very small concentrations when C_{T} < 10^{7} M the simple ionizationfractions approach fails.
Exact Analytical Solution. The problem of the simple ionizationfractions approach is that C_{T} is not a free parameter. This problem is solved by incorporating charge balance and the selfionization of water. Setting 11d into 11e and using 17, together with the abbreviation y_{i} = [H_{2i }A^{i}], yields:
0  = x – y_{1} – 2 y_{2} – K_{w}/x  
= x – K_{w}/x – (y_{1} + 2 y_{2})  
= x – K_{w}/x – C_{T} (a_{1} + 2 a_{2}) 
This gives us the exact relation between the total amount of acid and pH (= –log x):
(18) 
In fact, 18 represents the analytical solution of the complete set of five equations defined in 11. Instead of C_{T}(x) we can “reverse” this closedform expression into the inverse function x(C_{T}). In doing so we obtain a polynomial of 4^{th} order in x, i.e. a quartic equation:
(19)  x^{4} + K_{1} x^{3} + (K_{1}K_{2} – C_{T }K_{1} – K_{w}) x^{2} – K_{1} (2C_{T }K_{2} + K_{w}) x – K_{1}K_{2}K_{w} = 0 
To recapitulate: Either 18 or 19 or the set of five equations defined in 11 represent one and the same thing: the complete mathematical description of a diprotic acid. Surely, calculating C_{T} for a given x (or pH) by 18 is much easier than to solve a 4^{th} order equation to get x (or pH) for a given value of C_{T}. [To provide an example, the equations above were applied for the description of the closed and open CO_{2} systems.]
Based on 18 we are now able to replace the approximations in 17 by an exact formula for the three dissolved species:
(20)  [H_{2i }A^{i}] =  for i = 0, 1, 2 
Diprotic Acids including Ampholytes and Conjugate Bases
Any diprotic acid is tightknit with its conjugate base(s), H_{2}A ⇔ BHA ⇔ B_{2}A, where B refers to a monoacidic base (B^{+} = Na^{+}, K^{+}, or NH_{4}^{+}). For example: the triple H_{2}CO_{3}, NaHCO_{3}, and Na_{2}CO_{3} represent such an acidampholytebase system.
Let’s denote the (stoichiometric) number of B^{+} by n, then we get the compact notation:
(21)  B_{n}H_{2n }A  (or H_{2n }A^{n})  with  n = 0  for acid  (H_{2}A) 
n = 1  for ampholyte  (BHA)  
n = 2  for base  (B_{2}A) 
The set of equations to describe such a system is
(22a)  K_{1}  = {H^{+}} {HA^{}} / {H_{2}A}  (1^{st} diss. step) 
(22b)  K_{2}  = {H^{+}} {A^{2}} / {HA^{}}  (2^{nd} diss. step) 
(22c)  K_{w}  = {H^{+}} {OH^{}}  (selfionization) 
(22d)  C_{T}  = [H_{2}A] + [HA^{}] + [A^{2}]  (mass balance) 
(22e)  0  = [H^{+}] + n [H_{2}A] + (n1) [HA^{}] + (n2) [A^{2}] – [OH^{}]  (proton balance) 
It differs from the set of equations (11) only by one equation, namely the last equation, where “charge balance” is replaced by the more general concept of proton balance. For n=0, and only for this case, proton balance and charge balance coincide.
Remarkably enough, the last equation (22e) is the sole equation that explicitly depends on n. The other four equations are independent on the type of reactant we add to water (acid, ampholyte or base). In particular, the ionization fractions derived in 15a to (15c) for the diprotic acid, H_{2}A, are independent of n; they remain exactly the same in our general approach.
What is so great about the set of equations (11) is that it also represents the mathematical heart of buffer systems.
Exact Relation between pH and C_{T}
The extended system of diprotic acids, that includes the conjugate ampholytes and bases, is defined in the set of 22. These five equations can be converted into a single closedform expression, quite similar as it was done above in 18:
(23)  C_{T}(n,x) = 
For n=0 it falls back to 18. Again, the function C_{T}(n,x) can be converted into the inverse function x(n,C_{T}). In doing so we obtain a polynomial of 4^{th} order in x, i.e. a quartic equation:
(24)  x^{4} + {K_{1} + nC_{T}} x^{3} + {K_{1}K_{2} + (n–1)C_{T }K_{1} – K_{w}} x^{2} + K_{1} {(n–2)C_{T }K_{2} – K_{w}} x – K_{1}K_{2}K_{w} = 0 
In fact, each formula, 23 and 24, comprise three equations in compact form: one for an acid (n=0) – already presented in 18 and 19, one for an ampholyte (n=1), and one for a base (n=2).
Based on 23 we get – in place of 20 – the generalized expression for the three dissolved species:
(25)  [H_{2i }A^{i}] =  for i = 0, 1, 2 
Plots. The diagram below displays C_{T} as a function of pH. The solid lines represent 23 for n = 0, 1, and 2. The dots are exact results calculated with aqion (or PhreeqC), where activity corrections are considered. [Activity corrections are relevant for high concentrations of Na_{2}CO_{3}.]
Irrespective of the type of acid, the first factor in parenthesis in 23, x – K_{w}/x, becomes exactly zero at pH = 7.0, i.e. when x = 10^{7}. Thus, we always have C_{T} = 0 at pH = 7.0.
Proton Balance Equation (Proton Condition)
The proton balance is of great significance in acidbase systems, and it was already used in 22e above. It is a balance between the species that have excess protons versus those that are deficient in protons relative to a defined proton reference level (PRL).
Example 1. The simplest case is pure water with its three species H^{+}, OH^{}, and H_{2}O. Choosing H_{2}O as the reference level, the species H^{+} (or H_{3}O^{+}) is richer in 1 proton (excess proton), while OH^{} is 1 proton poorer (deficient proton). The proton balance equation becomes:^{3}
PRL  excess protons  =  deficient protons  

(26)  H_{2}O  [H^{+}]  =  [OH^{}] 
Because water is everpresent in any acidbase system, H^{+} and OH^{} always enter the proton balance, one on the left and the other on the righthand site of the equation.
Example 2. The carbonic acid system has three distinct reference levels:^{4}
PRL  excess protons  =  deficient protons  

(27a)  H_{2}CO_{3}  [H^{+}]  =  [HCO_{3}^{}] + 2 [CO_{3}^{2}] + [OH^{}] 
(27b)  HCO_{3}^{}  [H^{+}] + [H_{2}CO_{3}]  =  [CO_{3}^{2}] + [OH^{}] 
(27c)  CO_{3}^{2}  [H^{+}] + 2 [H_{2}CO_{3}] + [HCO_{3}^{}]  =  [OH^{}] 
How to write down these equations? First, the two species H^{+} and OH^{} that appear in each equation trace back from the H_{2}Oreference level in 26.^{5} They have their permanent place on opposite sides in any proton balance. Thus, all we have to do is to add the carbonicacid species (H_{2}CO_{3}, HCO_{3}^{}, CO_{3}^{2}) to the correct side of the equation.
In 27a, H_{2}CO_{3} is the reference level. There are no carbonate species that have more protons than H_{2}CO_{3}, hence, there is nothing to add to the lefthand side. Conversely, HCO_{3}^{} is deficient by 1 proton and CO_{3}^{2} by 2 protons; therefore, both species enter the righthand side.^{6}
In 27b, HCO_{3}^{} is the reference level. From this perspective, H_{2}CO_{3} has 1 excess proton (species enters the lefthand side), while CO_{3}^{2} is deficient by 1 proton (species enters the righthand side).
In 27c, CO_{3}^{2} is the reference level. Now, H_{2}CO_{3} has 2 excess protons and HCO_{3}^{} has 1 excess proton (both species enter the lefthand side); but there are no species that have less protons than CO_{3}^{2} (i.e. no carbonate species enters the righthand side).
General Case. Given the protonreference level by H_{2n }A^{n}, the proton balance equation becomes (for n = 0, 1, 2):
PRL  0  =  excess protons – deficient protons  

(28)  H_{2n }A^{n}  0  =  [H^{+}] + n [H_{2}A] + (n1) [HA^{}] + (n2) [A^{2}] – [OH^{}] 
This oneliner comprises all three equations of Example 2. Equation (28) was adopted in 22e above.
The proton reference level (PRL) is closely related to the concept of alkalinity and equivalence points (often both terms used as synonyms).
Remarks & Footnotes

In organic acids, the second and third acidity constant may be similar. ↩

The best introduction to the tableaux method is given in the classical textbook of F.M.M. Morel and J.G. Hering (Principles and Applications of Aquatic Chemistry, John Wiley, 1993). ↩

Square brackets denote molar concentrations. ↩

In hydrochemistry, instead of H_{2}CO_{3} the composite carbonic acid H_{2}CO_{3}^{*} is used. [In the program, H_{2}CO_{3}^{*} is abbreviated by CO_{2}, because almost all of H_{2}CO_{3}^{*} is just dissolved CO_{2}.] ↩

The reference level “H_{2}O” is not extra indicated in the table’s PRL column. But keep in mind that it is always present (in addition to H_{2}CO_{3}, HCO_{3}^{} or CO_{3}^{2}). ↩

If a species has lost 2 protons relative to PRL, its concentration is multiplied by 2. ↩