[Contents]

pH versus Concentration
John Denker

## 1  Overview

Figure 1 shows pH as a function of concentration, for various pKa values, including weak acids and strong acids, as well as intermediate-strength acids, which are particularly interesting.

The pKa values for some common acids and bases are tabulated in reference 1. In this document, we consider only monoprotic acids.

Figure 1: pH versus Concentration for Various pKa Values

These curves have a number of interesting properties:

1. For a very weak acid (such as the one represented by the red curve), there is a large range of concentrations (many decades) where the pH closely follows the weak-acid rule of thumb, namely the following straight-line approximation:

pH =
 pKa + pCha 2
(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:

[H+] =
 Ka Cha
(2)

2. For an acid that is not very weak but also not what we would call a “strong” acid (such as the one represented by the brown curve), the pH follows the weak-acid rule of thumb for a while, but then bends up to follow the strong-acid rule, namely the following straight-line approximation:

 pH = pCha
(3)

To say the same thing in other words: It is interesting that over the whole range from pKa = 0 to pKa = 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.

3. Eventually all the curves bend over to join the ultra-dilute asymptote (virtually pure water), namely the following horizontal straight-line approximation:

pH =
 pKw 2
(4)

## 2  Handy Estimates

1. You can get a good estimate by reading the curves in figure 1 and interpolating.
2. If you want to calculate an estimate, the three straight-line approximations mentioned in section 1 can be combined via a two-step process, namely:
• First compute the weak-acid approximation and the strong-acid approximation. If the weak-acid rule claims your acid is stronger than a strong acid, it’s obviously wrong. Use the strong acid rule instead. More specifically, use whichever predicts the higher pH (either the strong-acid rule or the weak-acid rule).
• Secondly, compute the pure-water approximation. If the result of the previous step predicts a higher pH than pure water, it’s obviously wrong; use the water pH instead. More specifically, use whichever predicts the lower pH (either the result from the previous step or the water pH).
3. If you are anywhere near a computer, it is easy to compute the exact answer, as discussed in section 3.

## 3  Numerical Evaluation

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.

 [H+]3 + Ka [H+]2 − (Kw + Ka Cha) [H+] − Ka Kw = 0
(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 Ka=0 in equation 5, in which case [H+] = √Kw 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 pKa and pCha. 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:

X =

 1.497925297894696 ... ± 0.01

(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.

## 4  Derivation

### 4.1  Cubic

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:

Ka :=
 [H+] [A−] [HA]
(7)

and the water dissociation constant:

 Kw := [H+] [OH−]
(8)

and the conservation laws, namely conservation of A-groups in our weak acid:

 [A−] + [HA] = Cha
(9)

 [E−] + [EOH] = Ceoh!
(10)

as well as conservation of charge:

 [H+] − [A−] − [OH−] = 0
(11)

That gives us four equations in four unknowns. Turning the crank on the algebra gives us

 [H+]3 + Ka [H+]2 − (Kw + Ka Cha) [H+] − Ka Kw = 0
(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.

### 4.2  Cubic : Buffer : Weak Acid plus Base

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:

Ka :=
 [H+] [A−] [HA]
(13)

As in equation 8 the water dissociation constant is:

 Kw := [H+] [OH−]
(14)

As a slight generalization of equation 9, the A-groups coming from our weak acid are conserved:

 [A−] + [HA] + [EA] = Cha
(15)

At this point, we add a new equation, stating that the E-groups coming from the strong base are conserved:

 [E+] + [EOH] + [EA] = Ceoh!
(16)

Similarly the @-groups coming from the strong acid are conserved:

 [@−] + [H@] + [E@] = Ch@!
(17)

Since we are assuming the strong base and strong acid are very strong, we can immediately simplify the three previous equations to:

 [A−] + [HA] = Cha
(18)

and

 [E+] = Ceoh!
(19)

and

 [@+] = Ch@!
(20)

Charge is conserved. This is like equation 11, except that now we have to include the weak acid and the optional strong acid:

 [H+] + ([E+] − [@−]) − [A−] − [OH−] = 0
(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

Ka =
 [H+] [A−] Cha −   [A−]
(22)

hence:

 KaCha − Ka[A−] = [H+] [A−]
(23)

hence:

[A] =
 KaCha [H+] +  Ka
(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

[H+] + (Ceoh! − Ch@!) −
 KaCha [H+] +  Ka
−
 Kw [H+]
= 0
(25)

Multiplying through by [H+] gives us

[H+]2 + [H+](Ceoh! − Ch@!) [H+]
 KaCha [H+] +  Ka
− Kw
= 0
(26)

Multiplying through by the remaining denominator gives us

 [H+]3 + [H+]2 Ka + [H+]2(Ceoh! − Ch@!) +  [H+] Ka(Ceoh! − Ch@!) − [H+]KaCha − [H+] Kw  − Ka Kw = 0
(27)

Note that this introduces a spurious root at [H+] = − Ka. Knowing this will be useful in a moment.

The equation can be rearranged to give the “usual” result:

 [H+]3 + (Ka + (Ceoh! − Ch@!)) [H+]2 + (Ka(Ceoh! − Ch@!) − KaCha − Kw) [H+] − Ka Kw = 0
(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 (Ceoh!Ch@!) 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 (Ceoh!Ch@!)=0 later.

As a check on the algebra, you can set Ka=0, in which case equation 28 simplifies to:

 [H+]2 + (Ceoh! − Ch@!)[H+]  − Kw = 0
(29)

Let’s check what this says about a strongly acidic solution. That means (Ceoh!Ch@!) is large and negative. Therefore [H+] is large. The first two terms in equation 29 dominate, and [H+] converges to Ch@!, as it should.

Let’s also check what this says about a strongly basic solution. That means (Ceoh!Ch@!) is large and positive. Therefore [H+] is small. The last two terms in equation 29 dominate, and [H+] converges to Kw/Ceoh!, 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:

 [H+]2 + Ka [H+] − Ka Cha = 0
(30)

as you can see by starting with equation 5 and setting Kw to zero. Equation 30 can also be easily derived directly from equation 7, equation 9, and the simplified charge-conservation law:

 [H+] − [A−] = 0
(31)

Equation 30 is a quadratic polynomial. It has one positive root and one negative root. We care about the positive root, namely

[H+] =
Cha
1 +
 1 + 4 Cha/Ka
(32)

For a strong acid (large Ka), equation 32 simplifies to

 [H+] = Cha
(33)

as expected.

For a suffciently high concentration of weak acid, equation 32 simplifies to

[H+] =
 Ka Cha
(for a concentrated solution of weak acid)
(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 Ka, 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 Ka 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.

Figure 2: Acetic Acid pH versus Concentration

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.

### 4.4  Validity of the Low-pH Approximation

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+] = Ka = x and Cha = 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:

 y = [H+]3 + Ka [H+]2 − (Kw + Ka Cha) [H+] − Ka Kw y = 0 (if it’s a root)
(35)

Taking the derivative we find:

 dy/d[H+] = 3[H+]2 + 2 Ka [H+] − (Kw + Ka Cha)
(36)

Plugging in the definition of x we get:

y = x3 + x3 − x Kw − 2 x3 − x Kw
= −2 x Kw
dy/d[H+] = 3x2 + 2x2 − (Kw + 2x2)
= 3x2 − Kw
Δ[H+] =
 y dy/d[H+]

(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.

### 4.5  Cubic : Buffer : Weak Base plus Strong Acid

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:

Kb :=
 [B+] [OH−] [BOH]
(38)

As always, the water dissociation constant is:

 Kw := [H+] [OH−]
(39)

The B-groups are conserved in our weak base:

 [B+] + [BOH] + [B@] = Cboh
(40)

Similarly, the @-groups are conserved:

 [@−] + [H@] + [B@] + [E@] = Ch@!
(41)

And the E-groups are conserved:

 [E+] + [EOH] + [E@] = Ceoh!
(42)

Since we are assuming the acid and strong base are very strong, we can immediately simplify this to

 [B+] + [BOH] = Cboh
(43)

and

 [@−] = Ch@!
(44)

and

 [E+] = Ceoh!
(45)

As always, charge is conserved:

 [H+] + [B+] + ([E+] − [@−]) − [OH−] = 0
(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

Kb =
 [B+] [OH−] Cboh −   [B+]
(47)

hence:

 KbCboh − Kb[B+] = [B+] [OH−]
(48)

hence:

[B+] =
 KbCboh [OH−] +  Kb
(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

[H+] +
 KbCboh Kw/[H+] +  Kb
+ (Ceoh! − Ch@!) −
 Kw [H+]
= 0
(50)

Multiplying through by [H+] gives us

[H+]2 + [H+](Ceoh! − Ch@!) + [H+]2
 KbCboh Kw +  Kb[H+]
− Kw
= 0
(51)

Multiplying through by the remaining denominator gives us

 Kb[H+]3 + [H+]2 (Kw + Kb(Ceoh! − Ch@!) + KbCboh) + [H+] (Kw(Ceoh! − Ch@!) − Kw Kb) − Kw2 = 0
(52)

If you want a monic polynomial, it is probably better to use equation 56, but if Kb is nonzero you could consider rewriting equation 52 as a monic polynomial:

 [H+]3 + (Cboh + (Ceoh! − Ch@!) + Kw/Kb) [H+]2 + (Kw(Ceoh! − Ch@!)/Kb − Kw)[H+] − Kw2/Kb = 0
(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 (Ceoh!Ch@!) to zero we obtain the simpler expression:

 Kb[H+]3 + (KbCboh  + Kw) [H+]2 − Kb Kw[H+] − Kw2 = 0
(54)

As a check on the algebra, you can set Kb to zero in equation 54, in which case [H+] = √Kw as it should.

As an even more incisive check on the algebra, solve for [OH] instead. The first step is:

 KbKw3 + (Kb(Ceoh! − Ch@!) + KbCboh + Kw) Kw2[OH−] + (Kw(Ceoh! − Ch@!) − Kb Kw)Kw[OH−]2 − Kw2[OH−]3 = 0
(55)

which simplifies to:

 [OH−]3 + (Kb + (Ch@! − Ceoh!))[OH−]2 + (Kb(Ch@! − Ceoh!) − KbCboh − Kw) [OH−] − KbKw = 0
(56)

which is the mirror image of equation 28.

## 5  References

1.
Oliver Seely,
“Dissociation Constants for Common Acids and Bases”
http://www.csudh.edu/oliver/chemdata/data-ka.htm

2.
Stephen K. Lower,
“Acid-base Equilibria and Calculations”

3.
David Laude,
“Complex Equilibria– What to do when assumptions aren’t okay”
http://laude.cm.utexas.edu/courses/ch302/lecture/ln15s09.pdf

4.
Richard Brent,
“Algorithms for Minimization Without Derivatives”
http://people.sc.fsu.edu/~jburkardt/cpp_src/brent/brent.html

5.
John Denker,
“Measurements and Uncertainties”
www.av8n.com/physics/uncertainty.htm

6.
John Denker,
“plot pH as a function of concentration, for various pKa values”
./acid-ph-scan.c
[Contents]