The Closed Carbonate System
In a closed carbonate system there is no CO_{2} exchange between the solution and the atmosphere. In contrast to the open carbonate system, the total amount of dissolved inorganic carbon (DIC) remains constant when pH is varied by addition of acids or bases:^{1}
(1)  C_{T} = DIC = [H_{2}CO_{3}^{*}] + [HCO_{3}^{}] + [CO_{3}^{2}] = const 
The closed CO_{2}H_{2}O system is characterized by five species:^{2}
(2)  H_{2}CO_{3}^{*}, HCO_{3}^{}, CO_{3}^{2}, H^{+} and OH^{} 
Therefore, five equations are required for an adequate mathematical description.^{3}
The Nonlinear System of Equations
The chemical equilibrium state is completely determined by five equations (with equilibrium constants valid for 25):^{4}
(3a)  K_{1}  = {H^{+}} {HCO_{3}^{}} / {H_{2}CO_{3}^{*}}  = 10^{6.35} 
(3b)  K_{2}  = {H^{+}} {CO_{3}^{2}} / {HCO_{3}^{}}  = 10^{10.33} 
(3c)  K_{w}  = {H^{+}} {OH^{}}  = 10^{14.0} 
(3d)  C_{T}  = [H_{2}CO_{3}^{*}] + [HCO_{3}^{}] + [CO_{3}^{2}]  (mole balance) 
(3e)  0  = [H^{+}] – [HCO_{3}^{}] – 2 [CO_{3}^{2}] – [OH^{}]  (charge balance) 
The first three equations are massaction laws; the last two equations represent the mole and charge balance. Note the “asymmetry”: While the massaction laws are based on activities (denoted by curly braces), the equations for the mole and charge balance are based on molar concentrations (denoted by square brackets).
It is the presence of the ion activities (in the curly braces) that makes the numerical solution so difficult and precludes any pencilandpaper calculation.^{5} The situation simplifies for socalled “ideal aqueous solutions” when activities collapse to concentrations. Another way out is to use conditional equilibrium constants ^{c}K (which is the standard approach in seawater studies).
Conditional Equilibrium Constants (Seawater)
In principle, it is legitimate to replace the activities by concentrations in 3a to (3c), that is, to substitute the curly braces by square brackets. The price we have to pay for this simplification is to switch from thermodynamic equilibrium constants K to conditional or apparent equilibrium constants ^{c}K:
(4a)  ^{c}K_{1}  = [H^{+}] [HCO_{3}^{}] / [H_{2}CO_{3}^{*}]  
(4b)  ^{c}K_{2}  = [H^{+}] [CO_{3}^{2}] / [HCO_{3}^{}]  
(4c)  ^{c}K_{w}  = [H^{+}] [OH^{}]  
(4d)  C_{T}  = [H_{2}CO_{3}^{*}] + [HCO_{3}^{}] + [CO_{3}^{2}]  (mole balance) 
(4e)  0  = [H^{+}] – [HCO_{3}^{}] – 2 [CO_{3}^{2}] – [OH^{}]  (charge balance) 
The disadvantage of ^{c}K is that it depends on the actual composition of the water, notably the ionic strength or salinity. For very dilute waters with negligibly small ionic strength, I ≈ 0, the thermodynamic and conditional equilibrium constants are the same: ^{c}K = K. The larger I, the more both values drift apart.
Seawater. Seawater has I ≈ 0.7 M, which is just on the upper bound of the validity range of common activity models. Thus, in oceanography, chemists prefer conditional equilibrium constants as an empirical function of temperature, pressure, and salinity: ^{c}K = f (T,P,salinity).
The following example shows the deviations of ^{c}K from the thermodynamic equilibrium constants K when the salinity is enhanced from 0 (pure water) to 35 g/L (seawater at 25, 1 atm):^{6}
thermodynamic K (pure water, I=0)  conditional ^{c}K (seawater)  

pK_{1}  6.35  6.00  
pK_{2}  10.33  9.10  
pK_{H}  1.47  1.53  
pK_{W}  14.0  13.9 
[The thermodynamic equilibrium constants in the left column refer to 3a to (3c), and the Henry’s constant K_{H}, whereby pK = –log K.]
ClosedForm Expression & Ionization Fractions
Once all the activities in the formulas are expressed in terms of concentrations (which can be done either for a dilute system or for conditional equilibrium constants), we can convert the system of equations into a single analytical formula.
To do this, insert 4a to (4c) into 4d and 4e, and then merge the last two equations into one. In this way we get rid of all concentrations except [H^{+}]. Replacing [H^{+}] simply by x, the entire equation system coalesces into one single line:^{7}
(5)  x^{4} + K_{1} x^{3} + (K_{1}K_{2} – K_{w} – C_{T }K_{1}) x^{2} – K_{1} (K_{w} + 2C_{T }K_{2}) x – K_{w }K_{1}K_{2} = 0 
This is an equation of 4^{th} degree in x. All other quantities are either physicochemical constants (K_{1}, K_{2}, K_{W}) or the total concentration C_{T} (i.e. DIC). Thus, for any given value of DIC the equation predicts x, and via pH = –log x, the exact pH value of the water.
Besides: 5 is valid for any diprotic acid, H_{2}A, with two equilibrium constants K_{1} and K_{2}.
Ionization Fractions. 5 predicts the pH value for a given DIC. Now we ask the question: What are the concentrations of all carbonate species as a function of pH?
For this purpose we insert 4a and (4b) into the mole balance (4d), which yields:
(6)  [H_{2}CO_{3}^{*}] = C_{T} α_{0}  [HCO_{3}^{}] = C_{T} α_{1}  [CO_{3}^{2}] = C_{T} α_{2} 
based on three ionization fractions (and x = [H^{+}] = 10^{pH}):
(7a)  α_{0} = ( 1 + K_{1}/x + K_{1}K_{2}/x^{2} )^{1}  =  (x/K_{1}) α_{1}  
(7b)  α_{1} = ( x/K_{1} + 1 + K_{2}/x )^{1}  
(7c)  α_{2} = ( x^{2}/(K_{1}K_{2}) + x/K_{2} + 1 )^{1}  =  (K_{2}/x) α_{1} 
It is easy to check that all three coefficients add up to 1:
(8)  α_{0} + α_{1} + α_{2} = 1 
The pH dependence of the ionization fractions are plotted in the second diagram below (for the special case C_{T} = DIC = 1 mM):
green curve:  C_{T} α_{0} = α_{0} in mM 
blue curve:  C_{T} α_{1} = α_{1} in mM 
orange curve:  C_{T} α_{2} = α_{2} in mM 
As the equation above suggest, the shape of the curves does not alter when C_{T} changes.
Example: Equilibrium Speciation of 1 mM DIC
The closed H_{2}OCO_{2} system, which is uniquely determined by the set of equations (3a) to (3e), yields the following speciation for pure water with 1 mM DIC (at 25 °C):
pH  4.68  
CO_{2}  0.979  mM  ( = H_{2}CO_{3}^{*} )  
HCO_{3}^{}  0.021  mM  
CO_{3}^{2}  4.8·10^{8}  mM  
DIC  1.00  mM  ( = CO_{2} + HCO_{3}^{} + CO_{3}^{2} ) 
The program provides three ways to obtain this result. All three calculations start with pure water (button H2O), but differ afterward as follows
Way 1. Switch to molar units (checkbox mol) and enter 1 mM DIC, then button Start and perform charge balance with parameter pH. The carbonate speciation is displayed in table Ions — see here.
Way 2. Add 1 mM CO2 to pure water by the reaction module (button Reac).
Way 3. Add 1 mM H2CO3 to pure water by the reaction module (button Reac).
Example: Titration Calculation
Given is a closed carbonate system with DIC = C_{T} = 10^{3} M. The results of a titration calculation (based on successive addition of HCl and NaOH) are presented in the two diagrams below.
Example: Equivalence Points (EP)
Equivalence points are pH values at which the amount of two molar concentrations coincide.^{8} Let’s consider two equivalence points defined by:
EP H_{2}CO_{3}:  [H^{+}] = [HCO_{3}^{}] 
EP Na_{2}CO_{3}:  [HCO_{3}^{}] = [OH^{}] 
The corresponding pH values depend on the total concentration C_{T} as shown below in the top diagram. Thus, what we call an EP is one curve or trajectory in the pHC_{T}diagram. (The top diagram contains three curves, but at this moment, we ignore the middle curve that belongs to the EP of NaHCO_{3}.)
In the top diagram, two points on the left and two points on the right EPcurve are selected:
EP H_{2}CO_{3}:  pH = 5.16  (for C_{T} = 10^{4} M)  and  pH = 4.68  (for C_{T} = 10^{3} M) 
EP Na_{2}CO_{3}:  pH = 9.86  (for C_{T} = 10^{4} M)  and  pH = 10.52  (for C_{T} = 10^{3} M) 
The selected points refer to the species distribution in the two lower diagrams (one for C_{T} = 10^{3} M and one for C_{T} = 10^{3} M). They are just points of intersection, that is, points where two concentrations coincide.
Calculations of equivalence points are done here and here.
Remarks & References

The addition of carbonic acid is excluded. ↩

H_{2}CO_{3}^{*} symbolizes the composite carbonic acid. In the program it is also abbreviated by CO_{2} (which is in full accord with the terminology of the thermodynamic database wateq4f — see here). ↩

More about the openvsclosed CO_{2} system are presented here. ↩

A detailed mathematical description is provided in the review article (2021) and lecture (2023). ↩

Hydrochemistry programs (including PhreeqC and aqion) solve the nonlinear system — in tandem with activity corrections — by the NewtonRaphson algorithm. ↩

FJ Millero: The thermodynamics of the carbonic acid system in the oceans. Geochimica et Cosmochimica Acta 59, 661–667 (1995) ↩

To keep the notation simple, we skip the superscript c on ^{c}K. ↩

Equivalence points are tightly related to the concept of proton reference level (PRL). ↩