how do we derive mirror formula
It's difficult to show you how we derive mirror formula, because we need a properly labelled diagram of ray images, which is not possible to draw here.
However, you can check for the derivation in NCERT textbooks and also some reference books such as S.L ARORA, H.C VERMA etc., For the detailed explanation of derivation.
Hope you understand.
Good luck!