Figure 1 shows pH as a function of concentration, for various pK_{a} values, including weak acids and strong acids, as well as intermediate-strength acids, which are particularly interesting.
The pK_{a} values for some common acids and bases are tabulated in reference 1. In this document, we consider only monoprotic acids.
These curves have a number of interesting properties:
| (1) |
For an explanation of the notation used here, see reference 2 or reference 3.
If we express same relationship in terms of concentration (rather than log concentration) we get:
| (2) |
| (3) |
To say the same thing in other words: It is interesting that over the whole range from pK_{a} = 0 to pK_{a} = 5 or 6, the acid follows the weak-acid rule at high concentration, but then follows the strong-acid rule at moderately low concentration.
The meaning of equation 3 is clear: it just says that all the acid molecules are ionized (and that auto-ionization of the water molecules is negligible). This is what we expect for a reasonably concentrated strong acid ... and it also makes sense for a moderately-dilute moderately-weak acid. Simple entropy considerations suggest that greater dilution favors greater ionization.
| (4) |
The curves in figure 1 were computed by solving the following equation. It is a cubic polynomial, with one positive root and two negative roots. The positive root is the only one that makes sense as a concentration.
| (5) |
This can be considered a simplified version of equation 28, applicable when there are no other acids or bases in the system.
As a check on the algebra, you can set K_{a}=0 in equation 5, in which case [H^{+}] = √K_{w} as it should.
It is easy to solve equation 5 with an iterative root-finding algorithm. I’ve had good luck with the Brent algorithm (reference 4).
In contrast, beware that standard “algebraic” formulas for solving the cubic can give wrong answers in some cases. Depending on details of the implementation, the formulas can be numerically unstable. That is to say, the result gets trashed by roundoff errors. Specifically: I tried using the standard library routine gsl_poly_complex_solve_cubic() and it failed spectacularly for certain values of pK_{a} and pC_{ha}. Some of the alleged results were off by multiple orders of magnitude. Some of the alleged results were complex numbers, even though the right answers were real numbers. It might be possible to rewrite the code to make it behave better, but that’s not a job I’m eager to do.
Lesson #1: Something that looks like an “exact” closed-form solution might not be at all suitable for real-world numerical calculation ... whereas an approximate, iterative solution might be highly accurate in practice.
Lesson #2: The failure of the algebraic method serves as a reminder of the difference between uncertainty and significance. The inputs to the method might or might not be uncertain; it doesn’t actually matter. The output (i.e. the root as plotted in figure 1) has a tolerance of a few percent. The internal calculations use IEEE double-precision floating point, which is good to about 16 decimal digits ... which is not enough for the task at hand. Even though the tolerance allows uncertainty in the second digit, there is significance in the 16th digit and beyond. So, if you see a number of the form:
| (6) |
you should not assume it is safe to round things off. In this case, such a number already has too few digits. For more on this, see reference 5.
The C++ code to calculate the pH as a function of concentration can be found in reference 6.
For an explanation of the notation used here, see reference 2 or reference 3.
Equation 5 can be derived from the definition of the acid dissociation constant:
| (7) |
and the water dissociation constant:
| (8) |
and the conservation laws, namely conservation of A-groups in our weak acid:
| (9) |
| (10) |
as well as conservation of charge:
| (11) |
That gives us four equations in four unknowns. Turning the crank on the algebra gives us
| (12) |
which is the same as equation 5. The details of the derivation are given in section 4.2, leading to a fancier version of this equation, namely equation 28.
Let’s create something that might serve as a buffer solution. We start with the weak acid considered in section 4.1, and also add a certain amount of very strong base (EOH!). The buffer doesn’t require it, but let’s also add a certain amount of very strong acid (H@!).
As in equation 7 the acid dissociation constant is:
| (13) |
As in equation 8 the water dissociation constant is:
| (14) |
As a slight generalization of equation 9, the A-groups coming from our weak acid are conserved:
| (15) |
At this point, we add a new equation, stating that the E-groups coming from the strong base are conserved:
| (16) |
Similarly the @-groups coming from the strong acid are conserved:
| (17) |
Since we are assuming the strong base and strong acid are very strong, we can immediately simplify the three previous equations to:
| (18) |
and
| (19) |
and
| (20) |
Charge is conserved. This is like equation 11, except that now we have to include the weak acid and the optional strong acid:
| (21) |
Now we turn the crank. We start by plugging into equation 13, using equation 18 to eliminate the unknown [HA] from the system of equations.
That gives us
| (22) |
hence:
| (23) |
hence:
| (24) |
We now plug into the charge-conservation expression, equation 21, using equation 19, equation 24, and equation 14 to get rid of all the unknowns. That gives us
| (25) |
Multiplying through by [H^{+}] gives us
| (26) |
Multiplying through by the remaining denominator gives us
| (27) |
Note that this introduces a spurious root at [H^{+}] = − K_{a}. Knowing this will be useful in a moment.
The equation can be rearranged to give the “usual” result:
| (28) |
The product of the roots is positive, and we know one root is negative, so the other two must have opposite signs. Therefore overall there is one positive root and two negative roots.
By setting (C_{eoh!} − C_{h@!}) to zero we obtain equation 5, so you can see why we didn’t bother deriving it directly; it is easier to do the more-general case and specialize to (C_{eoh!}−C_{h@!})=0 later.
As a check on the algebra, you can set K_{a}=0, in which case equation 28 simplifies to:
| (29) |
Let’s check what this says about a strongly acidic solution. That means (C_{eoh!} − C_{h@!}) is large and negative. Therefore [H^{+}] is large. The first two terms in equation 29 dominate, and [H^{+}] converges to C_{h@!}, as it should.
Let’s also check what this says about a strongly basic solution. That means (C_{eoh!} − C_{h@!}) is large and positive. Therefore [H^{+}] is small. The last two terms in equation 29 dominate, and [H^{+}] converges to K_{w}/C_{eoh!}, as it should.
As an even more incisive check on the equations, we should consider the case where half of the weak acid is ionized. This is discussed near the end of section 4.3.
It is sometimes convenient to restrict attention to the parts of figure 1 that are not too near the top. That is, we focus attention on solutions that are definitely acidic, with a pH well below the pH of water. In this case, equation 5 simplifies to:
| (30) |
as you can see by starting with equation 5 and setting K_{w} to zero. Equation 30 can also be easily derived directly from equation 7, equation 9, and the simplified charge-conservation law:
| (31) |
Equation 30 is a quadratic polynomial. It has one positive root and one negative root. We care about the positive root, namely
| (32) |
For a strong acid (large K_{a}), equation 32 simplifies to
| (33) |
as expected.
For a suffciently high concentration of weak acid, equation 32 simplifies to
| (34) |
In other words, the pH is the geometric mean between the concentration and the acid dissociation constant. For example, acetic acid has a pKa of 4.75. Now 1.78 millimolar acetic acid has a pC of 2.75, so it should have a pH of 3.77 according to equation 32, or approximately 3.75 according to equation 34, so the latter is off by less then one percent.
Within the regime where equation 34 is valid, as you increase the concentration, the pH drops, but only slowly. For each factor of 10 in the concentration, the pH drops by only half a unit, not a full unit, because of the square root in equation 34.
Beware that the range of validity does not extend to the point where the two factors on the RHS of equation 34 are equal. That is, at the point where the concentration is equal to the K_{a}, equation 34 might suggest that the pH would be equal to the pKa, but the reality is otherwise. You need at the concentration to be at least two orders of magnitude larger than K_{a} before the equation is reliably valid.
As another amusing corollary, when pH equals pKa, exactly half of the substance is ionized. That is, the ionized [A^{−}] is equal to the unionized [HA] in accordance with the fundamental definition, equation 7.
If you want to achieve pH equal to pKa, the concentration needs to be very nearly twice the Ka, as you can see from equation 30. This is nice to know. Also it tells you that equation 34 is off by a factor of 2 in this regime. See figure 2.
As yet another corollary, when designing a pH buffer system, it makes sense to operate near pH = pKa. Typically this means adding rather a lot of weak acid (concentration more than Ka) and then raising the pH back to pKa by adding some strong base.
In the figure, the blue line is the more-accurate prediction, equation 32, while the red dashed line is the less-accurate prediction, equation 34. The height of the black tie-line corresponds to pH = pKa. The length of the line is 0.301 common-logarithmic units, which corresponds to a factor of two in concentration.
It must be emphasized that all the results in this section, including figure 2, assume that the acid is not unduly weak. It needs to be strong enough so that the H^{+} ions it contributes are the dominant contribution (dominating over the water contribution), even when it is only half ioinized. For more about the range of validity, see section 4.4.
Let’s investigate the range of validity of the approximations used in section 4.3. In this section we don’t assume low pH; we use the more general equations to see what happens at low and not-so-low pH.
We define x to represent the situation where [H^{+}] = K_{a} = x and C_{ha} = 2x. We plug this into the RHS of equation 35, and see how close it comes to being a root. We rewrite equation 5 as:
| (35) |
Taking the derivative we find:
| (36) |
Plugging in the definition of x we get:
| (37) |
From this we conclude that at pH 6 or below, the approximation leading to equation 30 should get the concentration right within a percent or so. At higher pH you have to use the full cubic.
Let’s consider a system that is the same as in section 4.2, except that we consider a weak base (rather than a weak acid) plus a strong base (EOH!). The buffer doesn’t require it, but we also include a certain amount of strong acid (H@!).
The weak base dissociation constant is:
| (38) |
As always, the water dissociation constant is:
| (39) |
The B-groups are conserved in our weak base:
| (40) |
Similarly, the @-groups are conserved:
| (41) |
And the E-groups are conserved:
| (42) |
Since we are assuming the acid and strong base are very strong, we can immediately simplify this to
| (43) |
and
| (44) |
and
| (45) |
As always, charge is conserved:
| (46) |
Now we turn the crank. We start by plugging into equation 38, using equation 43 to eliminate the unknown [BOH] from the system of equations.
That gives us
| (47) |
hence:
| (48) |
hence:
| (49) |
We now plug into the charge-conservation expression, equation 46, using equation 49, equation 44, and equation 39 to get rid of all the unknowns. That gives us
| (50) |
Multiplying through by [H^{+}] gives us
| (51) |
Multiplying through by the remaining denominator gives us
| (52) |
If you want a monic polynomial, it is probably better to use equation 56, but if K_{b} is nonzero you could consider rewriting equation 52 as a monic polynomial:
| (53) |
Notice that the results are not sensitive to the concentration of strong base and strong acid separately, but only to the net difference between the two.
By setting (C_{eoh!} − C_{h@!}) to zero we obtain the simpler expression:
| (54) |
As a check on the algebra, you can set K_{b} to zero in equation 54, in which case [H^{+}] = √K_{w} as it should.
As an even more incisive check on the algebra, solve for [OH] instead. The first step is:
| (55) |
which simplifies to:
| (56) |
which is the mirror image of equation 28.