detailed steps for the derivation