vivianimbriotis | March 9, 2025, 9:46 p.m.
Let's derive the Henderson-Hasselbalch equation from first principles. You know you want to.
Particles move around space randomly, with random Brownian motion. If we take a picture of a set of particles at some instant in time, it will look similar to sampling randomly from a uniform distribution across the volume they occupy.
Let's think of two hypothetical kinds of molecule, which we'll call A and B.
A can react with B! Let's think about all the As first. These are floating around randomly. Let's pick a point in time T, and for now just discuss what is happening at that fixed time.
Given that with have N_A particles of S in our total volume V, draw a tiny circle (or ball, in 3d) around each of the As. This is the 'critical volume'; if a particle of B is within this volume, then it's close enough to a particle of A to react.
Let's just restrict ourselves to thinking about ONE of these tiny volumes:
How many Bs are in this volume?
For each particle of B, check if it's in this volume by drawing a random sample from a uniform distribtion (i.e. each particle is equally likely to be anywhere in the total volume). Then the chance of each particle being in this critical volume is
$$P(x \text{ in } V_{crit}) = \frac{V_{crit}}{V_{total}}$$
Since we're working with a unit volume this is just
$$P(x \text{ in } V_{crit}) = V_{crit}$$
And since these are bernoilli trials, the expected number is
$$E(\text{number of particles of B in }V_{crit}) = N_B \cdot V_{crit}$$
If we have n particles of B around a single particle of A, what's the overall chance that A reacts with one of them?
If there's one particle of B near A, then let's say it has a fixed probability of reacting, \(p\). Then, up to a first-order approximation, the chance of a reaction with \(B_n\) particles of B around A is just
$$P(Reaction|B_n\text{ in } V_{crit}) = np$$
So combining what we know,
$$P(\text{reaction in this critical volume}) = N_B \cdot V_{critical} \cdot p$$
But there are many critical volumes - as many as there are particles of A in our total volume! This is just Bernoulli trials again, and the total expected number of reactions is
$$E(\text{Number of reactions in whole volume in small time interval}) = N_A \cdot N_B \cdot V_{critical} \cdot p$$
Or...
$$\text{Reaction rate} = N_A \cdot N_B \cdot V_{critical} \cdot p$$
Collecting all the constants together, we have
$$\text{Reaction rate} = k \cdot N_A \cdot N_B$$
Assuming volume is constant and letting k absorb the volume terms, we get
$$\text{Reaction rate} = k \cdot [A] \cdot [B]$$
(Bear in mind, this is for a reaction where ONE particle of A reacts with ONE particle of B. If we need TWO particles of B to have a reaction (for example, if we are looking at this equation where we need two protons near a zinc):
$$Zn + 2H^+ \rightarrow Zn^{2+} + H_2$$
then, we would need to get the first particle of H+ in the critical volume, followed by the second, with probability \(p^2\). This gives the intuition behind the generalized form of the rate equation:
For a reaction \(AX + BY \rightarrow \text{products}\), the rate is given by
$$k \cdot [X]^{A} \cdot [Y]^B$$
Back to regular programming...)
Let's turn to our friend bicarbonate. This is an equilibrium reaction, with the left hand side reacting to form the right hand side, and the right hand side reacting to form the left hand side.
$$CO_2 + H_2O \rightleftharpoons H^+ + HCO_3^-$$
Here the rate of the forward reaction is given by:
$$\text{Rate}_{\text{forward}} = k_{\text{forward}} \cdot [CO_2] \cdot [H_20]$$
But since this is all happening in an aqueous solution, we can assume that the concentration of water is constant and absorb that term into the constant (even Peter Stewart does this so it must be okay!)
$$\text{Rate}_{\text{forward}} = k_{\text{forward}} \cdot [CO_2]$$
Righto, and the backward reaction rate?
$$\text{Rate}_{\text{backward}} = k_{\text{backward}} \cdot [H^+] \cdot [HCO_3^-]$$
Now, at steady state, the rates must be equal.
Hold on a sec. Read that again. Think about it. At steady state, the forward and backward rates MUST be equal. If they weren't - say, if the forward rate was higher than the backward rate - then we would eat up CO2 making bicarbonate until the levels of CO2 fell, and the levels of bicarbonate rose, reducing the forwards rate and increasing the backwards rate. Eventually, the rates have to end up equal - this is the only way that the TOTAL amount of each substance can be constant in time.
The rates are equal. So fuckin' what?
$$\text{Rate}_{\text{forward}} = \text{Rate}_{\text{backward}}$$
$$k_{\text{forward}} \cdot [CO_2] = k_{\text{backward}} \cdot [H^+] \cdot [HCO_3^-]$$
$$\frac{k_{\text{forward}}}{k_{\text{backward}}} = \frac{[H^+] \cdot [HCO_3^-]}{[CO_2]}$$
Let's name this constant term on the left...maybe some kind of "acid constant"...
$$K_a = \frac{[H^+] \cdot [HCO_3^-]}{[CO_2]}$$
And now, we go where many chemists have gone before, and take the negative log.
$$-\log(K_a) = -\log{\frac{[H^+] \cdot [HCO_3^-]}{[CO_2]}}$$
Let's name that thing on the left again.
$$pK_a = -\log{\frac{[H^+] \cdot [HCO_3^-]}{[CO_2]}}$$
$$pK_a = -(\log[H^+] + \log[HCO_3^-] - \log[CO_2])$$
$$pK_a = \log[CO_2]-\log[H^+]-\log[HCO_3^-]$$
Wait I think I recall something about the negative log of hydrogen concentration...oh yeah!
$$pK_a = \log[CO_2]+pH-\log[HCO_3^-]$$
Doing some rearranging:
$$pH = pK_a + \log[HCO_3^-] - \log[CO_2]$$
Or, if you prefer:
$$pH = pK_a + \log\frac{[HCO_3^-]}{[CO_2]}$$
And baby, that's acid-base.
Mid-twenties lost cause.
Trapped in a shrinking cube.
Bounded on the whimsy on the left and analysis on the right.
Bounded by mathematics behind me and medicine in front of me.
Bounded by words above me and raw logic below.
Will be satisfied when I have a fairytale romance, literally save the entire world, and write the perfect koan.