[Contents]

pH versus Concentration
John Denker

## 1  Overview

### 1.1  pH

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 and reference 2. 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 concentrated-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 3 or reference 4.

If we express same relationship in terms of concentration (rather than log concentration) we get:

[H+] =
 Ka Cha
(2)

2. Next, consider an acid that is not super-weak but also not what we would call strong (such as the one represented by the brown curve). The pH follows the concentrated-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)

### 1.2  pA

It is also interesting to see how much of the acid is ionized. This is shown in figure 2. Figure 2: pA versus Concentration for Various pKa Values

If we know [H+], we can find [A] relatively easily. (Hint: combine equation 12 and equation 14.)

[A] =
 Cha 1+[H+]/Ka
(5)

so the ionization percentage is:

 [A−] Cha
=
 1 1+[H+]/Ka
(6a)
<
 Ka [H+]
(6b)

Equation 6b is a tight bound for a dilute solution of a very weak acid (pKa = 7 or higher). The pH of the solution will never be less than the pH of water, so it’s clear the acid will never be 100% ionized, even when it very dilute. For example, if the pKa is 9, it will approach 1% ionization when it is very dilute.

Remark: This can be nicely explained as a common-ion effect.

It is easy to find references that assert that any acid, no matter how weak, will be 100% ionized if it’s dilute enough. And it’s easy to see why people would make that mistake. In a vacuum, anything will dissociate if it’s dilute enough. As a famous example, hydrogen atoms in thermal equilibrium at 4 kelvin in outer space are ionized, simply because there is so much phase space for the particles to wander around in. Saha equation.

In contrast, our beaker of acid is not a vacuum. The presence of water guarantees that the H+ concentration never drops below 10−7 no matter how dilute the acid is. Those H+ ions push the equilibrium to favor the unionized HA molecule.

The common-ion effect is commonly expressed as a “solubility” issue, but really it’s an ionization issue. The distinction is important if the unionized species is reasonably soluble. A good example is boric acid, pKa = 9.5.

Equation 6b is also a tight bound for a sufficiently concentrated solution of a weak acid, even if it’s not very weak. In such cases we have:

[A] = [H+]
=
 Ka Cha
(7)

The amount of unionized acid is:

[HA] =
 Cha 1+Ka/[H+]
(8)

so the percentage is:

 [HA] Cha
=
 1 1+Ka/[H+]
(9)

### 1.3  pHA

We can do the same for the amount of unionized acid: Figure 3: pHA versus Concentration for Various pKa Values

## 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 have a computer, you can 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
(10)

This can be considered a simplified version of equation 34, 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 10, in which case [H+] = √Kw as it should.

It is easy to solve equation 10 with an iterative root-finding algorithm. I’ve had good luck with the Brent algorithm (reference 5).

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

(11)

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

The C++ code to calculate the pH as a function of concentration can be found in reference 7.

## 4  Derivation

### 4.1  Cubic : Overview

Here is a quick summary of the starting point and the ending point. We postpone to section 4.2 the details of the intermediate steps. For an explanation of the notation used here, see reference 3 or reference 4.

For starters, we need the definition of the acid dissociation constant:

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

and similarly the water dissociation constant:

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

We also need the conservation laws, including conservation of A-groups in our weak acid:

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

as well as conservation of charge:

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

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
(16)

which is the same as equation 10.

### 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 12 the acid dissociation constant is:

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

As in equation 13 the water dissociation constant is:

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

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

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

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

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

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

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

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
(22)

and

 [E+] = Ceoh!
(23)

and

 [@−] = Ch@!
(24)

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

 [H+] + ([E+] − [@−]) − [A−] − [OH−] = 0
(25)

or, simpler:

 [H+] + σ − [A−] − [OH−] = 0
(26)

where σ is the net charge floating around from the strong base and/or acid:

 σ := [E+] − [@−] = Ceoh! − Ch@!
(27)

Now we turn the crank. We start by plugging into equation 17, using equation 22 to eliminate the unknown [HA] from the system of equations.

That gives us

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

hence:

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

hence:

[A] =
 KaCha [H+] +  Ka
(30)

We now plug into the charge-conservation expression, equation 26, using equation 23, equation 30, and equation 18 to get rid of all the unknowns. That gives us

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

Multiplying through by [H+] gives us

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

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
(33)

Note that this introduces a spurious root at [H+] = − Ka whenever Ka and/or Cha is zero. 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
(34)

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 10, 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 34 simplifies to:

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

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 35 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 35 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 10 simplifies to:

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

as you can see by starting with equation 10 and setting Kw to zero. Equation 36 can also be easily derived directly from equation 12, equation 14, and the simplified charge-conservation law:

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

Equation 36 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
(38)

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

 [H+] = Cha
(39)

as expected.

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

[H+] =
 Ka Cha
(for a concentrated solution of weak acid)
(40)

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 38, or approximately 3.75 according to equation 40, so the latter is off by less then one percent.

Within the regime where equation 40 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 40.

Beware that the range of validity does not extend to the point where the two factors on the RHS of equation 40 are equal. That is, at the point where the concentration is equal to the Ka, equation 40 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 12.

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 36. This is nice to know. Also it tells you that equation 40 is off by a factor of 2 in this regime. See figure 4.

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 4: Acetic Acid pH versus Concentration

In the figure, the blue line is the more-accurate prediction, equation 38, while the red dashed line is the less-accurate prediction, equation 40. 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 4, 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 41, and see how close it comes to being a root. We rewrite equation 10 as:

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

Taking the derivative we find:

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

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+]
(43)

From this we conclude that at pH 6 or below, the approximation leading to equation 36 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]
(44)

As always, the water dissociation constant is:

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

The B-groups are conserved in our weak base:

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

Similarly, the @-groups are conserved:

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

And the E-groups are conserved:

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

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

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

and

 [@−] = Ch@!
(50)

and

 [E+] = Ceoh!
(51)

As always, charge is conserved:

 [H+] + [B+] + σ − [OH−] = 0
(52)

Now we turn the crank. We start by plugging into equation 44, using equation 49 to eliminate the unknown [BOH] from the system of equations.

That gives us

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

hence:

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

hence:

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

We now plug into the charge-conservation expression, equation 52, using equation 55, equation 50, and equation 45 to get rid of all the unknowns. That gives us

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

Multiplying through by [H+] gives us

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

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
(58)

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

 [H+]3 + (Cboh + (Ceoh! − Ch@!) + Kw/Kb) [H+]2 + (Kw(Ceoh! − Ch@!)/Kb − Kw)[H+] − Kw2/Kb = 0
(59)

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
(60)

As a check on the algebra, you can set Kb to zero in equation 60, 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
(61)

which simplifies to:

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

which is the mirror image of equation 34.

## 5  References

1.
Oliver Seely,
“Dissociation Constants for Common Acids and Bases”
http://www2.csudh.edu/oliver/chemdata/data-ka.htm
2.
“Table of Acids with Ka and pKa Values”
https://clas.sa.ucsb.edu/staff/Resource%20Folder/Chem109ABC/Acid,%20Base%20Strength/Table%20of%20Acids%20w%20Kas%20and%20pKas.pdf
3.
Stephen K. Lower,
“Acid-base Equilibria and Calculations”
4.
David Laude,
“Complex Equilibria– What to do when assumptions aren’t okay”
http://laude.cm.utexas.edu/courses/ch302/lecture/ln15s09.pdf
5.
Richard Brent,
“Algorithms for Minimization Without Derivatives”
http://people.sc.fsu.edu/~jburkardt/cpp_src/brent/brent.html
6.
John Denker,
“Measurements and Uncertainties”
www.av8n.com/physics/uncertainty.htm
7.
John Denker,
“plot pH as a function of concentration, for various pKa values”
./acid-ph-scan.c
[Contents]