In order to calculate the pH of a medium, you need to know the concentration of the hydronium ion in every mole per litre. pH is calculated using the formula pH = Â – log [H3O+].