To calculate pH after adding an acid or base to a buffer, calculate the number of moles of acid or base added. The moles of A - or H + for an acid or base respectively also decreases by this much. Using the new mole numbers, calculate [HA] and [A -] and use to calculate pH.