master equation derivation