Formulae for the derivatives of degenerate diffusion semigroups