The ionization constant expression for a weak acid HA is:
Taking the negative logarithm of both sides, we have:
It is much more convenient to do calculations with the initial concentrations of the weak acid and weak base used to prepare a buffer solution. (The initial concentration is the amount of weak acid and weak base added to the solution mixture divide by the volume.) Using the initial concentrations give us:
Here, “x” is the change in [H3O+] as the solution reaches equilibrium and [HA]0 and [A−]0 are the initial concentrations of weak acid and weak base used to prepare the buffer solution.
When the approximation that x is at least 100 times smaller than [HA]0 and [A−]0 is valid, we have the Henderson-Hasselbalch equation:
Note that when [A−]0 = [HA]0, pH = pKa + log(1) = pKa.
The Henderson-Hasselbalch equation can be used to calculate the pH of a buffer solution, given the Ka and the initial concentrations, or it can be used to determine the ratio of initial concentrations of weak acid and weak base needed to achieve a desired pH.
The Henderson-Hasselbalch equation applies only to buffer solutions in which the ratio is between 0.1 and 10. If enough strong acid or strong base is added to the buffer solution so that the weak-base-to-weak-acid ratio falls outside of this range, the the solution is no longer a buffer solution and its pH will begin to change significantly. The approximation that x is at least 100 times smaller than [HA]0 and [A−]0 is no longer valid, and hence you cannot use the Henderson-Hasselbalch equation anymore.