1 Introduction

Diprotic acids are of central importance in biochemistry, physiology, and industrial and environmental chemistry. In biochemistry, several amino acids behave as diprotic acids with two dissociated protons: one proton on the \(\alpha \) amino group and one on the \(\alpha \) carboxyl group [1]. In physiology, the regulation of blood pH cannot be understood without considering the buffer made by carbonic acid, \({\hbox {H}_{2}\hbox {CO}_{3}}\), and the bicarbonate ion, \({\hbox {HCO}_{3}^{-}}\) [2]. In environmental chemistry, the current model for understanding ocean acidification is based on the aqueous chemical equilibrium between \({\hbox {CO}_{2}}\), \({\hbox {H}_{2}\hbox {CO}_{3}}\), \({\hbox {HCO}_{3}^{-}}\), and \({\hbox {CO}_{3}^{-}}\) [3].

A Brønsted diprotic acid is a chemical substance \({\hbox {H}_{2}\hbox {B}}\) that partially dissolves in water producing hydronium ion, \({\hbox {H}_{3}\hbox {O}^{+}}\), and the conjugate base, \({\hbox {HB}^{-}}\). This conjugate base further dissociates partially producing the second conjugate base, \({\hbox {B}^{2-}}\). In the state of equilibrium, the concentrations of the chemical species are constant [4, 5]. The equilibrium concentrations of the chemical species are given by the equations of chemical equilibrium, and the chemical and electric balance [6]. The aqueous dissociation of a diprotic acid and, its soluble salts, involves five chemical species and five mathematical relations between these species, therefore, in principle is possible to obtain the equilibrium concentrations of all the chemical species by solving this system of equations. In practice, the system of equations involves nonlinear terms making difficult to obtain exact mathematical expression for the equilibrium concentrations. For the dissociation of a diprotic acid and its soluble salts, the algebraic manipulation of the system of equations gives a quartic equation for the concentration of \({\hbox {H}_{3}\hbox {O}^{+}}\), \({\hbox {H}_{3}\hbox {O}^{+}}\). The equilibrium concentration of the hydronium ion is obtained by finding the roots of its quartic equation. Although there is a quartic formula that gives the explicit roots of a quartic equation, it is not practical to use due to its complexity. The use of the quartic formulas gives four roots, each of them implies the execution of at least 57 mathematical operations. Although these type of calculation is a simple task for modern computers, the formulas obtained from the quartic equation are not simplified which causes accumulation of computational error. On the other hand, graphical and numerical solutions are easily obtained using numerical calculators and computer software [7]. Although the graphical-numerical approach is fast and efficient to calculate concentrations as function of the pH, it has some disadvantages against an analytical closed form solution. The analytical solution can be differentiated to study buffers and buffer stability, or can be easily function-composed to study titrations of acids and buffers by strong bases [8]. Another advantage of an analytical closed form is the possibility to analyze mathematically the effect on the pH of parameters such as the concentrations and the acid dissociation constants. In this work it has been found that that the constrain p\(K_2-\)p\(K_1 \ge \log _{10}{4}\), on the pKs of the acid, has an important effect on the nature of the roots of the quartic polynomial for \({\hbox {H}_{3}\hbox {O}^{+}}\). This constrain has been previously obtained by considering isomerization of the ionization products and a detailed equilibrium scheme in which the micro-equilibrium constants correspond to partial equilibria [9,10,11]. Direct observation of the experimental values of p\(K_1\) and p\(K_2\) of a large set of diprotic acids allowed to find that several compounds, in particular the nitrogenous organics, follow the constrain p\(K_2-\)p\(K_1 \le -\log _{10}{4}\).

The main result of this paper is a closed form analytical solutions for \({\hbox {H}_{3}\hbox {O}^{+}}\) for the full chemical equilibrium of the aqueous dissociation of a diprotic acid, and its monobasic and dibasic salts. The use of effective acid and base concentrations allow to have only one mathematical expression for aqueous dissolutions of diprotic acids, and buffer dissolutions of diprotic acids and its soluble salts. In this work it is shown how this unified approach to diprotic acids and its buffers allows to study the pH stability of buffer solutions in relation with the equivalent acid dissolution.

This article is organized as follows: In the Theory and Methods section, the first subsection is dedicated to establishing the notation and fundamental equation of chemical equilibrium and physical constraints. In this subsection a unified notation is introduced, allowing the same equations to be used for: aqueous solutions of diprotic acids, buffers of diprotic acids, and titrations with strong bases. In the second subsection of Theory and Methods, a mathematical expression for \({\hbox {H}_{3}\hbox {O}^{+}}\) is obtained and analyzed, showing the complete expression for \({\hbox {H}_{3}\hbox {O}^{+}}\). The final expressions of \({\hbox {H}_{3}\hbox {O}^{+}}\) are written in algebraic terms using basic arithmetic operations and radicals (square and cube roots). These expressions can be used with the help of computer algebra software to obtain the pH without approximations. The reader interested in the mathematical details and the procedures used to obtain these equations is referred to the Appendix. The third and final subsection introduces exact expressions for the titration functions of the aqueous solution and the buffer solution of diprotic acids. The Results and Discussion section shows the results obtained using the expressions obtained previously. The first section shows that although most diprotic acids obey the condition \(\textrm{p}K_2-\textrm{p}K_1\ge \log _{10}4\), there are some acids that follow the condition \( \textrm{p}K_2-\textrm{p}K_1\le -\log _{10}{4}\). In the next subsection, the physical constraints of diprotic acids are used to obtain two approximations for \({\hbox {H}_{3}\hbox {O}^{+}}\), these approximations are used to obtain analytical expressions for the upper and lower limits of pH. In the next subsection, we discuss the common approach of monitoring the second dissociation constant and show that in the case of micromolar concentrations this approach fails. The following subsection shows the use of exact closed forms of pH and titration functions to analyze the neutralization of aqueous solutions of diprotic acids and their buffer mixtures. The differences between the exact expressions of this work and the approximate results of recent works for two cases are shown in detail: maleic acid and 1,8-Octanediamine. Finally, the last subsection of Results and Discussion shows an analysis of the pH stability of diprotic acid buffer solutions. In this subsection, the pH stability is analyzed as a parametric curve in the plane formed by the pH of the acid and the pH of the corresponding buffer solution.

2 Theory and methods

2.1 Aqueous solutions of weak diprotic acids and their salts

The aqueous dissociation equilibrium of a diprotic weak acid \({\hbox {H}_2\hbox {B}}\) is given by the chemical equations

(1)
(2)
(3)

Relevant chemical species are \({\hbox {H}_{3}\hbox {O}^{+}}\), \({\hbox {OH}^{-}}\), \({\hbox {H}_2\hbox {B}}\), \({\hbox {HB}^{-}}\), and \({\hbox {B}^{2-}}\) with equilibrium molar concentrations \({[\hbox {H}_{3}\hbox {O}^{+}]}\), \({[\hbox {OH}^{-}]}\), \({[\hbox {H}_2\hbox {B}]}\), \({[\hbox {HB}^{-}]}\), and \({[\hbox {B}^{2-}]}\), respectively. The equilibria displayed in Eqs. (1)–(2) are effective equilibria since the two protons of \({\hbox {H}_2\hbox {B}}\) can dissociate separately and not necessarily consecutively [1, 9, 11].

A solution of the acid \({\hbox {H}_2\hbox {B}}\) is prepared in water at analytical molar concentration \(C_\textrm{a}\). Once the system reaches chemical equilibrium, the concentrations of the chemical species are given by five physical conditions: two weak acid dissociation constant \(K_\textrm{1}\) and \(K_\textrm{2}\), the water auto-ionization constant \(K_\textrm{w}\), the electric neutrality, and the mass balance,

$$\begin{aligned} K_\textrm{1}&=\frac{{[\hbox {H}_{3}\hbox {O}^{+}]}}{C^\circ }\frac{{[\hbox {HB}^{-}]}}{C^\circ } \left( \frac{{[\hbox {H}_2\hbox {B}]}}{C^\circ }\right) ^{-1}, \end{aligned}$$
(4)
$$\begin{aligned} K_\textrm{2}&=\frac{{[\hbox {H}_{3}\hbox {O}^{+}]}}{C^\circ }\frac{{[\hbox {B}^{2-}]}}{C^\circ } \left( \frac{{[\hbox {HB}^{-}]}}{C^\circ }\right) ^{-1},\end{aligned}$$
(5)
$$\begin{aligned} K_\textrm{w}&=\frac{{[\hbox {H}_{3}\hbox {O}^{+}]}}{C^\circ }\frac{{[\hbox {OH}^{-}]}}{C^\circ },\end{aligned}$$
(6)
$$\begin{aligned} {[\hbox {H}_{3}\hbox {O}^{+}]}&={[\hbox {OH}^{-}]}+{[\hbox {HB}^{-}]}+2{[\hbox {B}^{2-}]},\end{aligned}$$
(7)
$$\begin{aligned} C_\textrm{a}&={[\hbox {HB}]}+{[\hbox {HB}^{-}]}+{[\hbox {B}^{2-}]}, \end{aligned}$$
(8)

respectively. The standard molar concentration is \({C^\circ =1\,\textrm{M}}\). The acid constants \(K_\textrm{1}\) and \(K_\textrm{2}\) are dimensionless, and their value range typically between \(10^{-10}\) and \(10^{-1}\). In this work, the biochemical standard state is used to define the dimensionless variables: , and the parameter . These definitions make the equilibrium constants \({k_1=K_\textrm{1}/\sqrt{K_\textrm{w}}}\), \({k_2=K_\textrm{2}/\sqrt{K_\textrm{w}}}\), and \({k_\textrm{w}=1}\). In terms of the new variables and constants, Eqs. (4)–(8) are replaced by

$$\begin{aligned} k_\textrm{1}&=\frac{xz_1}{z_0},\end{aligned}$$
(9)
$$\begin{aligned} k_\textrm{2}&=\frac{xz_2}{z_1},\end{aligned}$$
(10)
$$\begin{aligned} k_\textrm{w}&=xy=1,\end{aligned}$$
(11)
$$\begin{aligned} x&=y+z_1+2z_2,\end{aligned}$$
(12)
$$\begin{aligned} c_\textrm{a}&=z_0+z_1+z_2. \end{aligned}$$
(13)

The equations for electric neutrality (12) and mass balance (13) are explicitly affected by the presence of a strong base and salts of the conjugate bases \({\hbox {HB}^{-}}\) and \({\hbox {B}^{2-}}\), e.g. \({\hbox {NaOH}}\), \({\hbox {NaHB}}\) and \({\hbox {Na}_{2}\hbox {B}}\) respectively. If the dimensionless concentrations of the strong base and salts are , and , the charge and mass balance equations are modified to

$$\begin{aligned} x+\bar{c}_\textrm{b}&=y+z_1+2z_2,\end{aligned}$$
(14)
$$\begin{aligned} \bar{c}_\textrm{a}&=z_0+z_1+z_2, \end{aligned}$$
(15)

with effective concentrations \(\bar{c}_\textrm{a}=c_\textrm{a}+s_\textrm{1}+s_\textrm{2}\) and \(\bar{c}_\textrm{b}=c_\textrm{b}+s_\textrm{1}+2s_\textrm{2}\). These effective dimensionless variables are related to the effective molar concentrations by , and .

The use of \(y=1/x\), obtained from Eq. (11), in the Eqs. (9), (10), (14) and (15), gives a non-linear system of four equation \(\mathcal {S}_4\) with four unknowns x, \(z_0\), \(z_1\) and \(z_2\).

2.2 Mathematical expression for \({[\hbox {H}_{3}\hbox {O}^{+}]}\)

Before obtaining the full solution of the non-linear system \(\mathcal {S}_4\) is useful to analyze the linear subsystem \(\mathcal {S}_3\) made by Eqs. (9), (10) and (15). This subsystem can be easily solved to obtain the concentrations \(z_0\), \(z_1\), \(z_2\), in terms of x. The linear system \(\mathcal {S}_3\) can be expressed as \(\textsf{K}\varvec{z}=\varvec{c}\) with \(\textsf{K}=\textsf{K}(x)\) given by

$$\begin{aligned} \textsf{K}=\begin{pmatrix} k_1 &{} -x &{} 0 \\ 0 &{} k_2 &{} -x \\ 1 &{} 1 &{} 1 \end{pmatrix}, \end{aligned}$$
(16)

\(\varvec{z}=\left( z_0,z_1,z_2\right) ^\intercal \), and \(\varvec{c}=\left( 0,0,\bar{c}_\textrm{a}\right) ^\intercal \). Solving for \(\varvec{z}\) gives

$$\begin{aligned} \varvec{z}=\frac{\bar{c}_\textrm{a}}{\det {\textsf{K}}}\begin{pmatrix} x^2 \\ k_1 x \\ k_1 k_2 \end{pmatrix}, \end{aligned}$$
(17)

with \(\det {\textsf{K}}=x^2 + k_1 x + k_1 k_2\) as the determinant of \(\textsf{K}\). It is convenient to write this determinant as \({\det {\textsf{K}}=(x-\kappa _1)(x-\kappa _2)}\) with

$$\begin{aligned} \kappa _{1,2}=\tfrac{k_1}{2}\left( -1\pm \sqrt{1-4\kappa }\right) , \end{aligned}$$
(18)

and \(\kappa =k_2/k_1\) as the ratio of the diprotic dissociation constants. These \(\kappa _{1,2}\) are related to the Simms constants [7, 12], \(g_{1,2}\), by \(g_{1,2}=-\kappa _{1,2}\).

Given the condition \(\kappa \le 1/4\), i.e. \(k_1\ge 4k_2\), the roots \(\kappa _{1,2}\) are both no positive real numbers, \(\kappa _{1,2}\le 0\), otherwise these roots are a pair of complex conjugate numbers with negative real part, i.e. \(\kappa _1=\kappa _2^*\) and \(\textrm{re}{(\kappa _1)}=\textrm{re}{(\kappa _2)}<0\). The inequality \(k_1\ge 4k_2\) have been obtained previously by Adams in his analysis of polyprotic acid dissociations [9].

The solution of \(\mathcal {S}_3\) gives the concentrations \(\varvec{z}=\left( z_0,z_1,z_2\right) ^\intercal \) as functions of x, \(k_1\), \(k_2\) and \(\bar{c}_\textrm{a}\). Although \(\varvec{z}\) does not depend explicitly on \(\bar{c}_\textrm{b}\), it depends implicitly through x. This dependency is specified by using \(y=1/x\) in Eq. (14), which gives

$$\begin{aligned} x-\tfrac{1}{x}+\bar{c}_\textrm{b}=-\varvec{q}\cdot \varvec{z}, \end{aligned}$$
(19)

with \(\varvec{q}=\left( 0,-1,-2\right) ^\intercal \) as the vector of electric charges of \(z_0\), \(z_1\), and \(z_2\). This equation keeps some similarity with Eq. (41) used in the work of Kalka [7]. However, unlike that article, in this paper closed analytic solutions for x are obtained instead of graphical or numerical solutions.

Multiplying Eq. (19) by \(x\det {\textsf{K}}\), and expanding the scalar product, produces

$$\begin{aligned} \left( x-\kappa _1\right) \left( x-\kappa _2\right) \left( x^2+\bar{c}_\textrm{b}x-1\right) =\bar{c}_\textrm{a} k_1 x \left( x+2 k_2\right) , \end{aligned}$$
(20)

which can be written

$$\begin{aligned} \left( x-\kappa _1\right) \left( x-\kappa _2\right) \left( x-\sigma _1\right) \left( x-\sigma _2\right) =\bar{c}_\textrm{a} k_1 x \left( x+2 k_2\right) , \end{aligned}$$
(21)

with \(\sigma _{1,2}=\tfrac{1}{2}\left( -\bar{c}_\textrm{b}\pm \sqrt{\bar{c}_\textrm{b}^2+4}\right) \). The roots \(\sigma _{1,2}\) are both real numbers with \(0<\sigma _1\le 1\) and \(\sigma _2\le -1\). The case of \(\bar{c}_\textrm{b}=0\) gives \(\sigma _{1,2}=\pm 1\).

Expansion of Eq. (21) gives \(P=0\) with

$$\begin{aligned} P=x^4 + c_3 x^3 + c_2 x^2+ c_1 x+c_0, \end{aligned}$$
(22)

and

$$\begin{aligned} c_3&= \bar{c}_\textrm{b}+k_1,\end{aligned}$$
(23)
$$\begin{aligned} c_2&= -\left( 1+k_1\left( \bar{c}_\textrm{a}- \bar{c}_\textrm{b}-k_2\right) \right) ,\end{aligned}$$
(24)
$$\begin{aligned} c_1&=-k_1\left( 1+k_2\left( 2\bar{c}_\textrm{a}-\bar{c}_\textrm{b}\right) \right) ,\end{aligned}$$
(25)
$$\begin{aligned} c_0&=-k_1 k_2, \end{aligned}$$
(26)

with \(c_4=1\).

Before finding the roots of the equation \(P=0\) it is helpful to analyze the nature of its roots, which is studied by considering the 5-tuple of its coefficients,

$$\begin{aligned} {{\,\textrm{coef}\,}}[P]=\left( c_4,c_3,c_2,c_1,c_0\right) , \end{aligned}$$
(27)

and its signs

$$\begin{aligned} {{\,\textrm{sgn}\,}}({{\,\textrm{coef}\,}}[P])=\left( {{\,\textrm{sgn}\,}}{c_4},{{\,\textrm{sgn}\,}}{c_3},{{\,\textrm{sgn}\,}}{c_2},{{\,\textrm{sgn}\,}}{c_1},{{\,\textrm{sgn}\,}}{c_0}\right) . \end{aligned}$$
(28)

It is straightforward to see that \({{\,\textrm{sgn}\,}}{c_4}=+\), \({{\,\textrm{sgn}\,}}{c_3}=+\), and \({{\,\textrm{sgn}\,}}{c_0}=-\). The sign of \(c_2\) and \(c_1\) requires a careful analysis. There are four possible cases: \(\left( {{\,\textrm{sgn}\,}}{c_2},{{\,\textrm{sgn}\,}}{c_1}\right) \): \(\left( +,+\right) \), \(\left( +,-\right) \), \(\left( -,+\right) \), and \(\left( -,-\right) \). The 5-tuple \({{\,\textrm{sgn}\,}}({{\,\textrm{coef}\,}}[P])\) can have four possible outcomes: \(\left( +,+,+,+,-\right) \), \(\left( +,+,+,-,-\right) \), \(\left( +,+,-,+,-\right) \), and \(\left( +,+,-,-,-\right) \). These 5-tuples display one or three changes of sign along the sequence of elements. Descartes’s rule of signs states that the number of positive roots of a polynomial, P, is either equal to the number of sign changes of \({{\,\textrm{sgn}\,}}({{\,\textrm{coef}\,}}[P])\), or is less than it by an even number. The application of Descartes’ rule to P gives either one or three positive roots. It can be proved that the polynomial P has only one positive real root by a careful analysis of Eq. (21). The left hand side of Eq. (21) is a fourth degree polynomial \(P_L(x)\) with only one positive root \(\sigma _1\), one negative root \(\sigma _2\) and two roots \(\kappa _{1,2}\) that could be either negative or a complex conjugate pair. The right hand side of Eq. (21) is an upward parabola \(P_R(x)\) with roots at zero and \(-2k_2\). The coefficients of the quartic term of \(P_L(x)\) and the quadratic term of \(P_R\) are both positive numbers, therefore \(P_L(x)\) and \(P_R(x)\) must tend to infinity as x goes to positive or negative infinity. Since the quartic function grows always faster than the quadratic function, and regarding that \(P_L(0)=-k_1 k_1<0\), the polynomials \(P_L(x)\) and \(P_R(x)\) must be equal at only one positive x.

In the Appendix is shown that using Ferrari’s method [13, 14], the quartic equation \(P=0\) can be written as an associated resolvent cubic equation \(R=0\) with

$$\begin{aligned} R=y^3-c_2 y^2+\left( c_1 c_3-4 c_0\right) y+\left( 4c_0c_2-c_0 c_3^2-c_1^2\right) . \end{aligned}$$
(29)

The cubic equation \(R=0\) can be solved by Cardano’s method [8], for which the change of variable \(y=\bar{y}+\frac{c_2}{3}\) is necessary to obtain a depressed cubic equation \(R_\textrm{dc}=0\) with

$$\begin{aligned} R_\textrm{dc}=\bar{y}^3+\bar{p}\bar{y}+\bar{q}, \end{aligned}$$
(30)

where

$$\begin{aligned} \bar{p}&=c_1 c_3-\frac{c_2^2}{3}-4c_0,\end{aligned}$$
(31)
$$\begin{aligned} \bar{q}&=\frac{8 c_0 c_2}{3}+\frac{c_1 c_2 c_3}{3}-\frac{2 c_2^3}{27}-c_1^2-c_0 c_3^2, \end{aligned}$$
(32)

and the discriminant of P is \(\Delta =-4\bar{p}^3-27\bar{q}^2\) [13, 14].

The positive root of \(P=0\) is given by three cases depending on the sign of the \(\Delta \), and the sign of the functions \(\xi _{1,2}\),

$$\begin{aligned} \xi _{1,2}=-\frac{\bar{q}}{2}\pm \frac{1}{2}\sqrt{-\frac{\Delta }{27}}. \end{aligned}$$
(33)

The quantities \(\Delta \), \(\xi _1\), and \(\xi _2\) are functions of the equilibrium constants, \(k_1\) and \(k_2\), and the effective concentrations, \(\bar{c}_\textrm{a}\) and \(\bar{c}_\textrm{b}\). Explicitly, the positive root of \(P=0\) is given by

$$\begin{aligned} x= {\left\{ \begin{array}{ll} x_1,&{} \Delta>0,\\ x_1&{} \Delta<0,\;\xi _1>0,\;\xi _2>0,\\ x_3,&{} \Delta<0,\;\xi _1<0,\;\xi _2<0,\\ x_3,&{} \Delta<0,\;\xi _1>0,\;\xi _2<0. \end{array}\right. } \end{aligned}$$
(34)

The roots \(x_1\) and \(x_3\) are:

$$\begin{aligned} x_1&=\tfrac{1}{2}\left( -\left( \tfrac{\bar{c}_\textrm{b}+k_1}{2}-t_1\right) +\sqrt{\left( \tfrac{\bar{c}_\textrm{b}+k_1}{2}-t_1\right) ^2-2y_1 +\tfrac{(\bar{c}_\textrm{b}+k_1)y_1+2k_1\left( 1+(2\bar{c}_\textrm{a} -\bar{c}_\textrm{b})k_2\right) }{t_1}}\right) ,\end{aligned}$$
(35)
$$\begin{aligned} x_3&=\tfrac{1}{2}\left( -\left( \tfrac{\bar{c}_\textrm{b}+k_1}{2}+t_1\right) +\sqrt{\left( \tfrac{\bar{c}_\textrm{b}+k_1}{2}+t_1\right) ^2-2y_1 -\tfrac{(\bar{c}_\textrm{b}+k_1)y_1+2k_1\left( 1+(2\bar{c}_\textrm{a} -\bar{c}_\textrm{b})k_2\right) }{t_1}}\right) , \end{aligned}$$
(36)

with \(y_1\) and \(t_1\):

$$\begin{aligned} t_1&=\sqrt{1+\tfrac{1}{4}(\bar{c}_\textrm{b}+k_1)^2+k_1\left( \bar{c}_\textrm{a}-\bar{c}_\textrm{b}-k_2\right) +y_1},\end{aligned}$$
(37)
$$\begin{aligned} y_1&=\bar{y}_1-\tfrac{1+k_1\left( \bar{c}_\textrm{a}-\bar{c}_\textrm{b}-k_2\right) }{3}, \end{aligned}$$
(38)

and \(\bar{y}_1\):

$$\begin{aligned} \bar{y}_1= {\left\{ \begin{array}{ll} \tfrac{2}{3}\sqrt{1+k_1 Q_1+k_1^2 Q_2}\cos {\left( \tfrac{\theta }{3}\right) },&{} \Delta>0,\\ \root 3 \of {|\xi _1|}+\root 3 \of {|\xi _2|},&{} \Delta<0,\;\xi _1>0,\;\xi _2>0,\\ -(\root 3 \of {|\xi _1|}+\root 3 \of {|\xi _2|}), &{} \Delta<0,\;\xi _1<0,\;\xi _2<0, \\ \root 3 \of {|\xi _1|}-\root 3 \of {|\xi _2|},&{} \Delta<0,\;\xi _1>0,\;\xi _2<0. \end{array}\right. } \end{aligned}$$
(39)

The functions \(\theta \), \(Q_1\), and \(Q_2\) are given in the Appendix. The concentration x for the most common case of diprotic acid, with \(k_1>4k_2\), obeys \(x=x_1\) for most of the concentrations.

2.3 Strong base titration of dissolutions of diprotic acids and its buffer mixtures

The titration by a strong base of an acid solution, or an acid buffer solution, can be analyzed by using the effective concentrations \(\bar{c}_\textrm{a}\) and \(\bar{c}_\textrm{b}\). Recall that the effective concentrations are related to the molar analytical concentrations by and . A buffer solution is made of a volume \(V_\textrm{a0}\) of an acid solution with analytical concentration \(C_\textrm{a0}\), and volumes \(V_{10}\) and \(V_{20}\) of salt solutions with analytical concentrations \(C_{10}\) and \(C_{20}\), respectively. The total volume of the buffer solution is \(V_\textrm{B0}=V_\textrm{a0}+V_\textrm{10}+V_\textrm{20}\). The case of and acid solution is obtained by using \(V_{10}=0\), and \(V_{20}=0\), in the volume of the buffer: \(V_\textrm{B0}=V_\textrm{a0}\). The buffer effective concentrations are given by

$$\begin{aligned} \bar{c}_\textrm{a0}&=\left( c_\textrm{a0}V_\textrm{a0}+s_\textrm{10}V_\textrm{10} +s_\textrm{20}V_\textrm{20}\right) /V_\textrm{B0},\text { and}\end{aligned}$$
(40)
$$\begin{aligned} \bar{c}_\textrm{b0}&=\left( s_\textrm{10}V_\textrm{10} +2s_\textrm{20}V_\textrm{20}\right) /V_\textrm{B0}. \end{aligned}$$
(41)

These expression for the effective concentrations are obtained from the analytical concentrations simply by using the scaling factor .

A volume \(V_\textrm{b}\) of a strong base with analytical concentration \(C_\textrm{b0}\) is added to the buffer of volume \(V_\textrm{B0}\) and effective concentrations \(\bar{c}_\textrm{a0}\) and \(\bar{c}_\textrm{b0}\). The addition of the strong base changes the volume of the buffer to \(V_\textrm{B}=V_\textrm{B0}+V_\textrm{b}\), and the effective concentrations to the titration effective concentrations

$$\begin{aligned} \bar{c}_\textrm{a}&=\left( c_\textrm{a0}V_\textrm{a0}+s_\textrm{10}V_\textrm{10} +s_\textrm{20}V_\textrm{20}\right) /V_\textrm{B},\text { and}\end{aligned}$$
(42)
$$\begin{aligned} \bar{c}_\textrm{b}&=\left( c_\textrm{b0}V_\textrm{b}+s_\textrm{10}V_\textrm{10} +2s_\textrm{20}V_\textrm{20}\right) /V_\textrm{B}. \end{aligned}$$
(43)

The use of the buffer effective concentrations, Eqs. (40) and (41), in the titration effective concentrations, Eqs. (42) and (43), gives

$$\begin{aligned} \frac{\bar{c}_\textrm{a0}}{\bar{c}_\textrm{a}}-1&=\frac{V_\textrm{b}}{V_\textrm{B0}},\text { and}\end{aligned}$$
(44)
$$\begin{aligned} \left( \frac{c_\textrm{b0}}{\bar{c}_\textrm{b}}-1\right) \frac{V_\textrm{b}}{V_\textrm{B0}}&=1-\frac{\bar{c}_\textrm{b0}}{\bar{c}_\textrm{b}}. \end{aligned}$$
(45)

The titration effective concentrations can be combined to obtain an equation for \(\bar{c}_\textrm{b}\) in terms of \(\bar{c}_\textrm{a}\), \(c_\textrm{b0}\) and the buffer effective concentrations,

$$\begin{aligned} \bar{c}_\textrm{b}=\frac{\bar{c}_\textrm{a}}{\bar{c}_\textrm{a0}} \left( \bar{c}_\textrm{b0}-c_\textrm{b0}\right) +c_\textrm{b0}. \end{aligned}$$
(46)

This is the equation of a straight line with slope \(\left( \bar{c}_\textrm{b0}-c_\textrm{b0}\right) /\bar{c}_\textrm{a0}\) and ordinate intercept \(c_\textrm{b0}\). The slope of this straight line could be be negative, zero, or positive, depending on the concentrations of the buffer, \(\bar{c}_\textrm{b0}=s_\textrm{10}+2s_\textrm{20}\), and the titrating base, \(c_\textrm{b0}\).

In addition to the case of the titration of buffer solutions, this equation can be used for the titration of acid solutions. The case of an acid solution is obtained by taking \(\bar{c}_\textrm{b0}=0\) and \(\bar{c}_\textrm{a0}=c_\textrm{a0}\), to obtain

$$\begin{aligned} \bar{c}_\textrm{b}=c_\textrm{b0} -\left( \frac{c_\textrm{b0}}{c_\textrm{a0}}\right) \bar{c}_\textrm{a}, \end{aligned}$$
(47)

where \(\bar{c}_\textrm{a}=c_\textrm{a}\) and \({\bar{c}_\textrm{b}=c_\textrm{b}}\). This is the equation of a straight line with slope \({-c_\textrm{b0}/c_\textrm{a0}}\) and ordinate intercept \(c_\textrm{b0}\).

Eqs. (46) and (47) describe the titrations as straight line paths on the \((\bar{c}_\textrm{a},\bar{c}_\textrm{b})\) plane. The addition of the base, with concentration \(c_\textrm{b0}\), increases \(\bar{c}_\textrm{b}\) along a straight line, from \(\bar{c}_\textrm{b0}\) to \(c_\textrm{b0}\), meanwhile decreases \(\bar{c}_\textrm{a}\), from \(\bar{c}_\textrm{a0}\) to zero. The use of the contours of constant pH on the \((\bar{c}_\textrm{a},\bar{c}_\textrm{b})\) plane and the trajectory described by Eq. (46), or (47), give the full description of the titration experiments. However, it is more practical to describe the titration experiment as function of the pH, instead of the added strong base. For this, Eq. (19) is used, which relates x, the pH, with the effective concentrations \(\bar{c}_\textrm{a}\) and \(\bar{c}_\textrm{b}\). After some rearrangement, Eq. (19) gives

$$\begin{aligned} x-\tfrac{1}{x}+\bar{c}_\textrm{b} =\frac{\bar{c}_\textrm{a}k_1\left( x + 2 k_2\right) }{x^2+k_1 x + k_1 k_2}. \end{aligned}$$
(48)

The use of the ratio between the effective dimensionless concentrations, \(\bar{n}={\bar{c}_\textrm{b}}/{\bar{c}_\textrm{a}}\), in Eq. (48) gives

$$\begin{aligned} \bar{n}=\frac{k_1\left( x + 2 k_2\right) }{x^2+k_1 x + k_1 k_2}+\frac{1-x^2}{x \bar{c}_\textrm{a}}. \end{aligned}$$
(49)

This equation has been reported by Kalka previously [7], and works well in the case of \(\bar{c}_\textrm{a}\) constant. However, in the titration experiment the concentrations \(\bar{c}_\textrm{a}\) and \(\bar{c}_\textrm{b}\) are not constants. The last term of the right hand side of this equation depends on \(\bar{c}_\textrm{a}\). This dependence can be eliminated using Eq. (46). For this purpose, Eq. (46) must be written in terms of \(\bar{n}\),

$$\begin{aligned} \bar{n}=\bar{n}_0+c_\textrm{b0}\left( \frac{1}{\bar{c}_\textrm{a}}-\frac{1}{\bar{c}_\textrm{a0}}\right) , \end{aligned}$$
(50)

with \(\bar{n}_0={\bar{c}_\textrm{b0}}/{\bar{c}_\textrm{a0}}\). Algebraic manipulation of Eq. (50) gives

$$\begin{aligned} \frac{1}{\bar{c}_\textrm{a}}=\frac{\bar{n} -\bar{n}_0}{c_\textrm{b0}}+\frac{1}{\bar{c}_\textrm{a0}}, \end{aligned}$$
(51)

which can be used in the last term of Eq. (49) to obtain an expression for \(\bar{n}\) in terms of the pH

$$\begin{aligned} \bar{n}=\left( \bar{n}_0-\frac{c_\textrm{b0}}{\bar{c}_\textrm{a0}}\right) \frac{P_{\textrm{a0}}}{P_\textrm{b0}}, \end{aligned}$$
(52)

where \(\bar{n}\ge \bar{n}_0\) and

$$\begin{aligned} P_\textrm{a0}&=P\left( x=10^{7-\textrm{pH}},\bar{c}_\textrm{a} =\frac{\bar{c}_\textrm{a0} c_\textrm{b0}}{c_\textrm{b0} -\bar{c}_\textrm{b0}},\bar{c}_\textrm{b}=0\right) ,\end{aligned}$$
(53)
$$\begin{aligned} P_\textrm{b0}&=P\left( x=10^{7-\textrm{pH}}, \bar{c}_\textrm{a}=0,\bar{c}_\textrm{b}=c_\textrm{b0}\right) , \end{aligned}$$
(54)

with P the polynomial given by Eq. (22). The case of the acid titration is given by considering \(\bar{c}_\textrm{b0}=0\) in Eqs. (52)–(54).

The equivalence points for a diprotic acid occur at \(\bar{n}=1,2\) in Eq. (52). The first equivalence point is given when the acid and base concentrations are equal, \(\bar{n}=1\), the second equivalence point happens when the base concentration doubles the acid concentration, \(\bar{n}=2\). Since \(\bar{n}(\textrm{pH})\) must be a monotonically growing function of the pH, it must fulfill the condition \(n'(\textrm{pH})>0\).

3 Results and discussion

The validity of Eqs. (34)–(39) has been tested by calculating the pH, at different effective concentrations \(\bar{c}_\textrm{a}\) and \(\bar{c}_\textrm{b}\), of diprotic acids with reported values of p\(K_1\) and p\(K_2\) for 180 diprotic acids [10] and comparing them with the numerical solution. The average absolute error in the pH, \(\epsilon _\textrm{pH}\), at millimolar concentrations \(\bar{c}_\textrm{a}\) and \(\bar{c}_\textrm{b}\), is \(\epsilon _\textrm{pH}\lesssim 10^{-5}\) pH units with a standard deviation \(\lesssim 10^{-4}\) pH units. The small error in the calculated pH is caused mainly by the diprotic acids with \(\textrm{p}K_2-\textrm{p}K_1<-\log _{10}4\).

3.1 Aqueous dissolution of a diprotic acid

The case of a diprotic acid is given by using the conditions \(\bar{c}_\textrm{b}=0\) and \(\bar{c}_\textrm{a}=c_\textrm{a}\) in Eqs. (34)–(39). The condition \(k_1\ge 4 k_2\), i.e.,

$$\begin{aligned} \textrm{p}K_2-\textrm{p}K_1\ge {\textrm{log}}_{10}4\approx 0.602, \end{aligned}$$
(55)

makes the discriminant of P a positive number, \(\Delta >0\). This is the condition for a quartic equation with four distinct real roots. An inspection of the values of \(\textrm{p}K_1\) and \(\textrm{p}K_2\) of tabulated diprotic weak acids indicates that the condition (55) is fulfilled by many diprotic weak acids [9,10,11]. Figure 1 displays, on the p\(K_1\)–p\(K_2\) plane, the region given by the condition (55) as the light blue region above the blue line. It is clear in the Figure that most of the diprotic weak acids (open black circles) fulfill this condition, however a simple visual inspection of Fig. 1 shows that there are weak diprotic acids that fulfill the condition \({\textrm{p}K_2-\textrm{p}K_1\le -\log _{10}4}\) (light red region). This condition can be expressed in terms of the acid constants as \(k_2/k_1\ge 4\), i.e. \(K_2/K_1\ge 4\). Diprotic acids in the light red region have \(\textrm{p}K_1>\textrm{p}K_2\), examples of these are several nitrogenous organic compounds as Piperazine, Quinine, Phenylbiguanide, L-Nicotine, p-Benzidine, Sulfamethazine, m-Phenylenediamine, p-Phenylenediamine, 1,2-Propanediamine, 1,3-Propanediamine, 1,4-Butanediamine, 1,6-Hexanediamine, 1,8-Octanediamine, cis-2,5-Dimethylpiperazine, trans-1,2-Cyclohexanediamine, cis-1,2-Cyclohexanediamine, and the alcohol 1,3-Diamino-2-propanol [10].

Fig. 1
figure 1

p\(K_1\)–p\(K_2\) plane for a set of diprotic acids in aqueous solution [10]. The light blue region is given by the condition \(\textrm{p}K_2-\textrm{p}K_1\ge \log _{10}4\), the light red region is given by the condition \(\textrm{p}K_2-\textrm{p}K_1\le -\log _{10}4\) (Color figure online)

3.2 Concentrations \({[\hbox {H}_2\hbox {B}]}\), \({[\hbox {HB}^{-}]}\), and \({[\hbox {B}^{2-}]}\) in terms of \({[\hbox {H}_{3}\hbox {O}^{+}]}\)

Eq. (21) can be written to give an expression for \(\det {\textsf{K}}\),

$$\begin{aligned} \det {\textsf{K}}=\frac{\bar{c}_\textrm{a} k_1 x \left( x+2 k_2\right) }{\left( x-\sigma _1\right) \left( x-\sigma _2\right) }. \end{aligned}$$
(56)

This equation can be used in Eq. (17), to obtain

$$\begin{aligned} z_0&=\frac{x \left( x-\sigma _1\right) \left( x-\sigma _2\right) }{k_1(x+2k_2)},\end{aligned}$$
(57)
$$\begin{aligned} z_1&=\frac{\left( x-\sigma _1\right) \left( x-\sigma _2\right) }{x+2k_2},\end{aligned}$$
(58)
$$\begin{aligned} z_2&=\frac{k_2\left( x-\sigma _1\right) \left( x-\sigma _2\right) }{x\left( x+2k_2\right) }. \end{aligned}$$
(59)

These concentrations are constrained to be positive numbers. Since \(0<\sigma _1\le 1\) and \(\sigma _2\le -1\), it is necessary to have \(x>\sigma _1\).

It is also possible to have parametric dependence on \(\bar{c}_\textrm{a}\), \(\bar{c}_\textrm{b}\) and \(k_2\) by using Eq. (15), which gives as result Eqs. (58), (59), and

$$\begin{aligned} z_0=\bar{c}_\textrm{a}-\frac{\left( x+k_2\right) \left( x-\sigma _1\right) \left( x-\sigma _2\right) }{x\left( x+2k_2\right) } \end{aligned}$$
(60)

instead of (57). The case of a dissolution of the diprotic acid gives \(\sigma _1=1\) and \(\sigma _2=-1\), with \(\bar{c}_\textrm{b}=0\) and \(\bar{c}_\textrm{a}=c_\textrm{a}\).

It is convenient to employ logarithmic scaling to describe concentrations and equilibrium constants of highly diluted solutions and weak acids. The p-function of \(\textrm{Q}\) is defined as

$$\begin{aligned} \begin{aligned} \textrm{pQ}&=-\log _{10}a_\textrm{Q}\\&=-\log _{10}\frac{\gamma _\textrm{Q}{[\hbox {Q}]}}{C^\circ }, \end{aligned} \end{aligned}$$
(61)

with \(a_\textrm{Q}\) and \(\gamma _\textrm{Q}\) as the activity and the activity coefficient of \(\textrm{Q}\) respectively [4]. Since equilibrium constants are dimensionless, it is possible to define the p-function of K as \(\textrm{p}K=-\log _{10}K\) [6].

The case of weak acids, and low concentrations, allows to use the ideal solution approximation, \(\gamma _\textrm{Q}\approx 1\), hence the pH is given by

(62)

The p-functions for \({[\hbox {H}_2\hbox {B}]}\), \({[\hbox {HB}^{-}]}\) and \({[\hbox {B}^{2-}]}\) are given by \(\mathrm {pH_2B}\approx 7-\log _{10}z_0\), \(\mathrm {pHB^{-}}\approx 7-\log _{10}z_1\), and \(\mathrm {pB^{2-}}\approx 7-\log _{10}z_2\), respectively. The p-function \(\mathrm {pH_2B}\) can be expressed in two ways, either using \(z_0\) from Eq. (57) to obtain \(\mathrm {pH_2B}(k_1,k_2)\), or using \(z_0\) from Eq. (60) to get \(\mathrm {pH_2B}(c_\textrm{a},k_2)\).

Figure 2 displays the behaviour of pH\(_2\)B, pHB\(^-\) and pB\(^{2-}\) as functions of the pH for different concentrations \(c_\textrm{a}=2^n\) (\(n=0,1,\dots ,23\)) of oxalic acid, \({\hbox {H}_{2}\hbox {C}_{2}\hbox {O}_{4}}\), which has \(K_1=5.62\times 10^{-2}\) and \(K_2=1.54\times 10^{-4}\) [10]. In this Figure the intersections between the \(\mathrm {pH_2B}(k_1,k_2)\) curve (red) and the \(\mathrm {pH_2B}(c_\textrm{a}, k_2)\) curves (pink) are shown as labeled black points. These intersections give the pH for the different concentrations \(c_\textrm{a}\).

Fig. 2
figure 2

Behaviour of pH\(_2\)B (red and pink), pHB\(^-\) (green) and pB\(^{2-}\) (blue) as functions of the pH for oxalic acid, \({\hbox {H}_{2}\hbox {C}_{2}\hbox {O}_{4}}\). Labeled black dots indicate the intersection between pH\(_2\)B\((k_1,k_2)\) (red) and pH\(_2\)B\((c_\textrm{a},k_2)\) (pink) at different concentrations, \(c_\textrm{a}=2^n\), \(n=0,1,2, \dots , 23\). Recall that that , hence for \(n=0\), \(C_\textrm{a}=10^{-7}\,\textrm{M}\), and for \(n=23\), \(C_\textrm{a}\approx 0.84\,\textrm{M}\) (Color figure online)

3.3 Use of physical constraints of the system to obtain approximate expressions for \({[\hbox {H}_{3}\hbox {O}^{+}]}\)

For the diprotic acid, the combined use of Eq. (60) and the condition \(z_0>0\), gives the inequality \(P_{z_0}<0\) with \(P_{z_0}\) given by the monic cubic polynomial

$$\begin{aligned} P_{z_0}=x^3+\left( k_2-c_\textrm{a}\right) x^2-\left( 1+2c_\textrm{a}k_2\right) x-k_2. \end{aligned}$$
(63)

Although this polynomial goes to infinity as x goes to infinity, there are values of x for which the inequality \(P_{z_0}<0\) is satisfied. This can be seen by analyzing the 4-tuple of \(P_{z_0}\) coefficients,

$$\begin{aligned} \begin{aligned} {{\,\textrm{coef}\,}}[P_{z_0}]&=\left( a_3,a_2,a_1,a_0\right) \\&=\left( 1,k_2-c_\textrm{a}, -(1+2c_\textrm{a}k_2),-k_2\right) . \end{aligned} \end{aligned}$$
(64)

The signs of (64) are given by

$$\begin{aligned} \begin{aligned} {{\,\textrm{sgn}\,}}[P_{z_0}]&=\left( {{\,\textrm{sgn}\,}}a_3,{{\,\textrm{sgn}\,}}a_2,{{\,\textrm{sgn}\,}}a_1,{{\,\textrm{sgn}\,}}a_0\right) \\&=\left( +,\pm ,-,-\right) , \end{aligned} \end{aligned}$$
(65)

Regardless of the value of \({{\,\textrm{sgn}\,}}a_2\), there is only one change of sign in (65), from positive to negative, for this case Descartes rule of signs gives that \(P_{z_0}\) must have only one positive root. This positive root is a function of \(k_2\) and \(c_\textrm{a}\), and gives the upper bound of x. Using the method of Caicedo, et al. the upper bound of x is given by

$$\begin{aligned} x_{\textrm{ub}}=\tfrac{2}{3}\sqrt{(k_2-c_\textrm{a})^2+6 c_\textrm{a}k_2+3}\cos {\left( {\theta _{z_0}}/{3}\right) }-\frac{k_2-c_\textrm{a}}{3}, \end{aligned}$$
(66)

with

$$\begin{aligned} p_{z_0}&=-\tfrac{1}{3}(k_2-c_\textrm{a})^2-2c_\textrm{a}k_2-1,\end{aligned}$$
(67)
$$\begin{aligned} q_{z_0}&=\tfrac{2}{27}(k_2-c_\textrm{a})^3+\tfrac{1}{3}(k_2-c_\textrm{a})(1+2c_\textrm{a}k_2)-k_2,\end{aligned}$$
(68)
$$\begin{aligned} \Delta _{z_0}&=-4p_{z_0}^3-27q_{z_0}^2,\end{aligned}$$
(69)
$$\begin{aligned} \theta _{z_0}&=\arctan \left( -\frac{q_{z_0}}{2},\frac{\sqrt{\Delta _{z_0}}}{6\sqrt{3}}\right) . \end{aligned}$$
(70)

The use of Wolfram Mathematica allows to prove that \(\Delta _{z_0}>0\) for \(c_\textrm{a}>0\) and \(k_2>0\). Since \(\Delta _{z_0}>0\), Eq. (70) gives the \(0<\theta <\pi \), hence \(\cos {(\theta /3)}\ge 1/2\). Furthermore, the use of Wolfram Mathematica allows to find that \(\lim _{c_\textrm{a}\rightarrow 0}x_\textrm{ub}=1\).

It was shown above that the dissociation constants of many diprotic acids are constraint by the condition \({k_1\ge 4k_2}\). The use of Eqs. (9) and (10) in the inequality \({k_1\ge 4k_2}\) leads to the constraint \({z_1^2\ge 4z_0 z_2}\) between the concentrations of the acid and its conjugate bases. The use of Eqs. (58), (59) and (60) in the inequality \({z_1^2\ge 4z_0 z_2}\) gives the inequality \(P_z>0\) with

$$\begin{aligned} P_z=x^3 + 2k_2 x^2 - (1+4c_\textrm{a}k_2)x-2k_2. \end{aligned}$$
(71)
Fig. 3
figure 3

Upper (blue) and lower (green) bounds of the pH for oxalic acid (left) and 1,5-Pentanediamine (right) as functions of the molar concentration \(C_\textrm{a}\). The orange curve represents the exact pH (Color figure online)

This polynomial \(P_z\) is the same polynomial for a monoprotic weak acid with \(k_\textrm{a}=2k_2\). Since \({{\,\textrm{sgn}\,}}[P_z]=\left( +,+,-,-\right) \), Descartes rule of signs indicates that \(P_z=0\) has only one positive root. Using the method of Caicedo et al., this root is given by

$$\begin{aligned} x_\textrm{lb}=\tfrac{2}{3}\left( \sqrt{4k_2^2+3c_\textrm{a}k_2+3}\cos {(\theta _{z}/3)}-k_2\right) , \end{aligned}$$
(72)

with

$$\begin{aligned} p_{z}&=-\tfrac{4k_2^2}{3}-c_\textrm{a}k_2-1,\end{aligned}$$
(73)
$$\begin{aligned} q_{z}&=\tfrac{16k_2^3}{27}+\tfrac{2c_\textrm{a}k_2^2}{3}-\tfrac{k_2}{3},\end{aligned}$$
(74)
$$\begin{aligned} \Delta _{z}&=-4p_{z}^3-27q_{z}^2,\end{aligned}$$
(75)
$$\begin{aligned} \theta _{z}&=\arctan \left( -\frac{q_{z}}{2},\frac{\sqrt{\Delta _{z}}}{6\sqrt{3}}\right) . \end{aligned}$$
(76)

The discriminant \(\Delta _z\) is a positive quantity, in fact, by using Wolfram Mathematica it is shown that \(\Delta _z\ge 4\). Furthermore using the same software it is shown that \(\lim _{c_\textrm{a}\rightarrow 0,k_2\rightarrow 0}{x_{\textrm{lb}}}=1\), and that \(\lim _{c_\textrm{a}\rightarrow 0,k_2\rightarrow \infty }{x_{\textrm{lb}}}=1/\sqrt{2}\).

The lower and upper bounds to the pH are obtained by \({7-\log _{10}{x_{\textrm{ub}}}}\) and \({7-\log _{10}{x_{\textrm{lb}}}}\) respectively. Figure 3 displays the lower and upper bounds to the pH as a function of the molar concentration \(C_\textrm{a}\) for oxalic acid (left) and 1,5-pentanediamine (right). In the case of oxalic acid, the exact pH and the lower pH bound (green) are nearly identical for concentrations \(C_\textrm{a}<10^{-2}\,\textrm{M}\). On the other hand, for the compound 1,5-Pentanediamine the exact pH and the upper pH bound (blue) are nearly identical for concentrations \(C_\textrm{a}<10^{-4}\,\textrm{M}\). It is interesting to notice from both panels of Fig. 3 that the upper bound pH curve (blue) overstimate the pH for a constant difference for concentrations greater than \(10^{-2}\,\textrm{M}\).

3.4 Analysis of the dependence of the \(\textrm{pH}\) on p\(K_2\)

Fig. 4
figure 4

Contours of constant pH (red lines) for different concentrations \(C_\textrm{a}\): (a) \(0.1\,\textrm{M}\); (b) \(0.01\,\textrm{M}\); (c) \(10^{-3}\,\textrm{M}\); (d) \(10^{-6}\,\textrm{M}\). Contours of \(\delta \textrm{pH}_2\) are shown in shading colors from blue to yellow: dark blue 0.01, grey 0.02, dark orange 0.06, orange 0.1, light orange 0.14, dark yellow 0.15, and yellow 0.16. The light blue region has \(\delta \textrm{pH}_2<0.01\). The open circle markers are the values of \(\left( \textrm{p}K_1, \textrm{p}K_2\right) \) for different weak diprotic acids [10] (Color figure online)

The pH is calculated by \(\textrm{pH}=7-\log _{10}x\) with x given by Eq. (34). The partial derivatives

$$\begin{aligned} \delta \textrm{pH}_1&=\left( \frac{\partial \textrm{pH}}{\partial \textrm{p}K_1}\right) _{C_\textrm{a},\textrm{p}K_2},\end{aligned}$$
(77)
$$\begin{aligned} \delta \textrm{pH}_2&=\left( \frac{\partial \textrm{pH}}{\partial \textrm{p}K_2}\right) _{C_\textrm{a},\textrm{p}K_1}, \end{aligned}$$
(78)

measure how much the pH depends on p\(K_1\) or p\(K_2\), respectively.

Figure 4 displays contours of constant \(\delta \textrm{pH}_2\) as function of p\(K_1\) and p\(K_2\) for different acid concentrations, \(C_\textrm{a}\): (a) \(0.1\,\textrm{M}\); (b) \(0.01\,\textrm{M}\); (c) \(10^{-3}\,\textrm{M}\); (d) \(10^{-6}\,\textrm{M}\). Only the acids that fulfill the condition \(\textrm{p}K_2\ge \textrm{p}K_1+\log _{10}4\) are shown. This Figure also shows contours of constant pH as red curves with their respective call-outs indicating the value of the pH. In all the panels, the contours of the derivative \(\delta \textrm{pH}_2\) are shown with contour shading from blue to yellow; the dark blue has \(0.01<\delta \textrm{pH}_2<0.02\), the grey has \(0.02<\delta \textrm{pH}_2<0.06\), the dark orange \(0.06<\delta \textrm{pH}_2<0.1\), the orange \(0.1<\delta \textrm{pH}_2<0.14\), the light orange \(0.14<\delta \textrm{pH}_2<0.15\), the dark yellow \(0.14<\delta \textrm{pH}_2<0.15\), and the yellow \(0.16<\delta \textrm{pH}_2\). The open circle markers in all the panels of Fig. 4 are the values of \(\left( \textrm{p}K_1, \textrm{p}K_2\right) \) for different diprotic weak acids [10]. The maximum value of \(\delta \textrm{pH}_2\) is obtained by evaluating \(\delta \textrm{pH}_2\) along the line \({\textrm{p}K_2=\textrm{p}K_1+\log _{10}4}\). By doing this a function \(\delta \textrm{p}K_2(\textrm{p}K_1,C_\textrm{a})\) is obtained. The use of the function \(\textsf{NMaximize}\) of Wolfram Mathematica gives that \({\max {\left( \delta \textrm{p}K_2(\textrm{p}K_1,C_\textrm{a})\right) }\approx 0.17153}\) regardless the values of p\(K_1\) and \(C_\textrm{a}\).

Panel (a) of Fig. 4 shows that, for \(C_\textrm{a}=0.1\,\textrm{M}\), p\(K_2\) has weak influence on the pH for p\(K_1>4\). This is evident by observing that the contours of constant pH are practically vertical lines for \(\textrm{pH}>2.5\) and also by the fact that \(\delta \textrm{pH}_2<0.01\) for the same values of the pH. In the same panel can be observed that the strongest influence of p\(K_2\) on the pH, i.e. \(0.1<\delta \textrm{p}K_2\lesssim 0.17153\), is seen in the regions with orange and yellow contour shading, and pH\(<1.5\). The pH contours in this region are curved instead of straight vertical lines. Panel (a) shows that the approximation of considering the pH independent p\(K_2\) is very good for all the acids at a concentration \(C_\textrm{a}=0.1\,\textrm{M}\). The highest observed value of \(\delta \textrm{pH}_2\) is about 0.17153 units of pH by 1 unit of p\(K_2\). This value of \(\delta \textrm{pH}_2\) indicates that a change on 0.5 units of p\(K_2\) would produce at most a change of 0.08 units on the pH. This change in the pH is sufficiently small to be within the experimental error, hence, the heuristic approximation of considering the pH dependent only on p\(K_1\) is an good approximation at relatively high concentrations of the acid.

Panels (b) and (c) of Fig. 4 show similarities in shape with panel (a). It can be seen that for these concentrations the pH is insensitive to the value of p\(K_2\) for p\(K_1>5\) and p\(K_1>6\), for concentrations \(C_\textrm{a}=10^{-2}\) (b) and \(C_\textrm{a}=10^{-3}\) (c) respectively. Regarding the pH contours, they are insensitive to the p\(K_2\) value for pH\(>3.5\) and pH\(>4.5\) for concentrations \(C_\textrm{a}=10^{-2}\) (b) and \(C_\textrm{a}=10^{-3}\) (c) respectively. Panel (d), \(C_\textrm{a}=10^{-6}\,\textrm{M}\), shows evident differences with respect to panels (a) to (c). At this low acid concentration the region with \(5.73<\textrm{pH}<6.5\) displays strong sensitivity to the value of p\(K_2\), with the strongest effect for pH\(\approx 5.9\) and p\(K_1\approx 6\).

Panels (a) to (c) of Fig. 4 show that the pH contour with \(\textrm{pH}=-\log _{10}C_\textrm{a}\) is a straight line with negative slope. This line is a boundary between two regions: one with pH contours that are asymptotically independent of p\(K_2\) (vertical lines) and other region with pH contours that are asymptotically independent of p\(K_1\) (horizontal lines). Although panel (d) does not display this straight line with negative slope, it is clear that there are also regions with asymptotic independence on p\(K_1\) and p\(K_2\).

3.5 Strong base titration of diprotic acids and its buffer mixtures

Fig. 5
figure 5

Contours of constant pH on the concentrations plane \((C_\textrm{a},C_\textrm{b})\) for diprotic acids. Left: maleic acid, p\(K_1=1.92\), p\(K_2=6.23\); Right: 1,8-Octanediamine p\(K_1=11\), p\(K_2=10.1\). The red region is given for \(\Delta _\textrm{dc}>0\), the green region for \(\xi _1<0\) and \(\xi _2<0\), and the blue \(\xi _1>0\) and \(\xi _2<0\). The titration line is shown in dashed on both figures. The equivalence points \(n=1,2\) are shown as cyan open circles. The half equivalence points \(n=1/2,3/2,5/2\) are shown as magenta open circles (Color figure online)

Figure 5 displays the contours of constant pH for maleic acid (left panel) and 1,8-Octanediamine (right panel). Maleic acid has p\(K_1=1.92\) and p\(K_2=6.23\), that is p\(K_2-\)p\(K_1\ge \log _{10}4\), meanwhile the compound 1,8-Octanediamine has p\(K_1=11\) and p\(K_2=10.1\), and p\(K_2-\)p\(K_1\le -\log _{10}4\). Maleic acid is an example of a pH given uniquely by Eq. (35) with \(\bar{y}_1\) given by the first case of Eq. (39), therefore maleic acid displays only one region in the \((C_\textrm{a},C_\textrm{b})\) plane. On the other hand the compound 1,8-Octanediamine displays three regions on the \((C_\textrm{a},C_\textrm{b})\) plane: the red region is given by using Eq. (35) with \(\bar{y}_1\) given by the first case of (39), the green region given by Eq. (36) with \(\bar{y}_1\) given by the second case of Eq. (39), and the blue region is given by (36) with \(\bar{y}_1\) given by the third case of Eq. (39).

Fig. 6
figure 6

Titration curves for 10\(\,\textrm{ml}\) of diprotic acids at concentration \(C_\textrm{a}=1\,\textrm{mM}\) using a volume \(V_\textrm{b}\) of strong base with concentration \(C_\textrm{b}=1\,\textrm{mM}\). (Left) Maleic acid, p\(K_1=1.92\), p\(K_2=6.23\); (Right) 1,8-Octanediamine p\(K_1=11\), p\(K_2=10.1\). The red, green and blue curves are calculated using the first, third, and fourth case of Eq. (39), respectively (Color figure online)

Figure 6 shows the titrations curves obtained by adding a volume \(V_\textrm{b}\) of a strong base with concentration \(C_\textrm{b0}=1\,\textrm{mM}\) to a volume \(V_\textrm{a0}=10\,\textrm{ml}\) of solution \(C_\textrm{a0}=1\,\textrm{mM}\) of maleic acid (left) and 1,8-Octanediamine (right). These titration curves are given by the pH along the dashed lines of Fig. 5 for the case \(C_\textrm{a0}=1\,\textrm{mM}\) and \(C_\textrm{b0}=1\,\textrm{mM}\).

The left panel of Fig. 6 displays the typical equivalence points for diprotic acids with two equivalence points. The first equivalence point occurs at \(V_\textrm{b}\approx 10\,\textrm{ml}\) with \(\textrm{pH}\approx 5\), the second equivalence point occurs at \(V_\textrm{b}\approx 20\,\textrm{ml}\) with \(\textrm{pH}\approx 8\). In contrast, the right panel of Fig. 6 does not display equivalence points. The titration curve for 1,8-Octanediamine is made by joining three different titration curves: red, green and blue (from left to right). The initial solution of 1,8-Octanediamine has pH slightly below 7, as the base is added the pH grows rapidly reaching a pH above 10. This behaviour is described by the red curve of Fig. 6 (right). As the volume of added base increases, the pH grows from 10 to approximately 10.5, following the green curve. Finally, for \(V_\textrm{b}>25\,\textrm{ml}\) the titration experiment follows the blue curve reaching a final pH slightly above 10.5 at \(V_\textrm{b}=40\,\textrm{ml}\).

Fig. 7
figure 7

Titration functions \(\bar{n}(\textrm{pH})\), and \(\bar{n}_\textrm{K}\), obtained from Eqs. (52) (green and red) and (49) (cyan and magenta), respectively. The first and second equivalence points occur at \(\bar{n},\bar{n}_K=1,2\), the half-equivalence points occur at \(\bar{n},\bar{n}_\textrm{K}=1/2, 3/2, 5/2\). Maleic acid (red and magenta) displays the typical titration curve of a diprotic acid, 1,8-Octanediamine (green and cyan) does not diaplay equivalence points (Color figure online)

The use of Eq. (52) allows to obtain the pH at the equivalence points for acid and buffer solutions. The equivalence points \(\bar{n}=1, 2\), and the half-equivalence points \({\bar{n}=1/2, 3/2}\), as functions of the pH, are displayed in Fig. 7 for maleic acid, p\(K_1=1.92\), p\(K_2=6.23\), and for 1,8-Octanediamine, p\(K_1=11\), p\(K_2=10.1\). It is seen in this Figure that the equivalence point for \(\bar{n},\bar{n}_\textrm{K}=3/2\) are the same for maleic acid, but not for 1,8-Octanediamine. This Figure also shows that the use of Eq. (49) gives a wrong pH at the equivalence points \(\bar{n}=1, 2\). The first equivalence point is shifted to more acid pHs meanwhile the second equivalence point is shifted to basic pHs.

3.6 pH stability of buffer solutions

In the titration experiment a volume \(V_\textrm{b}\) of a base solution, with concentration \(c_\textrm{b0}\), is added to a volume \(V_{\textrm{B0}}\) of a buffer solution with concentrations \(\bar{c}_{\textrm{a0}}\) and \(\bar{c}_{\textrm{b0}}\). The concentrations \(\bar{c}_{\textrm{a}}\) and \(\bar{c}_{\textrm{b}}\) as functions of \(V_\textrm{b}\) are given by Eqs. (42) and (43). Although Eq. (52) can be used to analyze the stability of a buffer solution, it is more convenient to use the parametric curve

$$\begin{aligned} \beta (V_\textrm{b})=\left\{ \textrm{pH}_\textrm{acid}\left( V_\textrm{b}\right) , \textrm{pH}_\textrm{buffer}\left( V_\textrm{b}\right) \right\} , \end{aligned}$$
(79)

where \(\textrm{pH}_\textrm{acid}\left( V_\textrm{b}\right) \) is the pH of the acid as function of added base, and \(\textrm{pH}_\textrm{buffer}\left( V_\textrm{b}\right) \) is the pH of the buffer as function of added base. Figure 8 displays \(\beta (V_\textrm{b})\) for acid and buffer solutions prepared with the same number of moles of the acid, \(C_\textrm{a}V_\textrm{a0}=7.5\times 10^{-3}\) moles, and titrated with the same strong base, \(C_\textrm{b0}=7.5\,\textrm{mM}\). The buffer solutions of panel (a) are prepared by adding \(C_\textrm{10}V_{10}=2.5\times 10^{-3}\) moles of the monobasic salt only; The buffer solutions of panel (b) are prepared by adding \(C_\textrm{20}V_{20}=2.5\times 10^{-3}\) moles of the dibasic salt only; The buffer solutions of panel (c) are prepared by adding \(C_\textrm{10}V_{10}=2.5\times 10^{-3}\) moles of the monobasic salt, and \(C_\textrm{20}V_{20}=2.5\times 10^{-3}\) moles of the dibasic salt. The three panels show four curves for different acids all with p\(K_1=1\) and p\(K_2=1\) (red), p\(K_2=4\) (green), p\(K_2=6\) (blue), and p\(K_2=8\) (cyan).

Fig. 8
figure 8

\(\beta (V_\textrm{b})\) curves for buffer solutions of different acids prepared with: (a) only monobasic salt, (b) only dibasic salt, and (c) both monobasic and dibasic salts. All the acids have p\(K_1=1\) and: p\(K_2=1\) (red), p\(K_2=4\) (green), p\(K_2=6\) (blue), and p\(K_2=8\) (cyan) (Color figure online)

The pH stability of a buffer solution is given when the \(\beta (V_\textrm{b})\) curve is horizontal, i.e. regardless the change in the pH of the acid solution, the pH of the buffer remains stable. The red curve of panels (a) and (c) of Fig. 8 display the best pH stability. These red curves are produced by acids with p\(K_1=1\) and p\(K_2=1\). The red \(\beta (V_\textrm{b})\) curves of panels (a) and (c) display buffer stability at \(\textrm{pH}_\textrm{buffer}\approx 3\) and \(\textrm{pH}_\textrm{acid}> 4\). The green \(\beta (V_\textrm{b})\) curves of panels (a) and (c) display buffer stability at \(\textrm{pH}_\textrm{buffer}\approx 4.7\) and \(\textrm{pH}_\textrm{acid}> 6\), for and acid with p\(K_1=1\) and p\(K_2=4\). The cyan curves of panels (b) and (c) of Fig. 8 show that the dibasic salt produces basic pH stability for acids with higher p\(K_2\).