To derive the thin lens equation from basic geometric principles requires access to a detailed drawing showing the angles created by the rays of an object as they pass through a lens (or reflects from a mirror). If you go to the link below you can watch a simple animation that will demonstrate the steps necessary to derive the formula based on the geometry of angles.
Once you have the thin lens equation, one can manipulate it to solve for the focus, f, in the following manner:
1/f = 1/di + 1/do get a common denominator on the right side.
1/f = do/dido + di/dodi = (do + di)/(dido)
with 1/f = (do + di)/(dido) we can apply the principle of reciprocals and get
f = (dido)/(do + di)