redone derivation of equation 7, now very long and detailed