According to the law of dissociation, the acid dissociation constantKacan be defined by the equation:
Ka= [H+][A–]/[HA]
where [H+] and [A–] are the concentrations of the ionized form of the acid, while [HA] is the concentration of the unionized form.
Taking log on both sides you get:
log Ka= log ([H+][A–]/[HA])
Splitting the log terms into separate components gives you:
log Ka= log [H+] + log ([A–]/[HA])
Since pKa= -log10Kaand pH = -log10[H+], therefore:
-pKa= – pH + log ([A–]/[HA]
Rearranging the terms we get the Henderson-Hasselbalch equation for acids as:
pH = pKa+ log ([A–]/[HA])
This equation can also be written as:
pH = pKa+ log [(salt)/(acid)]
or
pH = pKa+ log ([ionized]/[unionized])
Similarly, you can do for base.