A weak acid is one that partially ionizes in water. A typical example is acetic acid.

$CH_3COOH + H_2O \rightleftharpoons CH_3COO^- + H_3O^+$

The ionization reaction does not shift completely to the right as in the case of strong acids, establishing an equilibrium between the dissociated species and the undissociated species that is given by the acidity constant.

\begin{equation}K_a=\frac{[CH_3COO^-][H_3O^+]}{[CH_3COOH]}\end{equation}

From an initial concentration of acid, and using the acidity constant, we will be able to determine the concentration of protons in the medium and consequently the pH of the solution.

Let's see an example: Calculate the pH of a 0.1 M solution in acetic acid $K_a=1.8x10^{-5}$.

$CH_3COOH + H_2O \rightleftharpoons CH_3COO^- + H_3O^+$

Initial                    0.1                           -------          -------

Equilibrium         0.1-x                                x               x

Initially we have 0.1 M in acetic acid none of its ionization products. If we let the system reach equilibrium, we will find that the acid has dissociated in an amount x M, remaining in the middle (0.1-x)M. This dissociation generates concentrations of acetates and protons equal to x M.

Once we have the equilibrium concentrations we take them to the constant to obtain the value of x.

\begin{equation}K_a=\frac{[CH_3COO^-][H_3O^+]}{[CH_3COOH]}=\frac{x^2}{0.1-x}\end{equation}

\begin{equation}1.8x10^{-5}=\frac{x^2}{0.1-x}\end{equation}

Solving the quadratic equation yields $x=[H_3O^+]=1.3x10^{-3}\;M$

We get the pH from its definition: $pH=-log[H_3O^+]=2.86$