Abstract
We present two
q-analogues of a hook length formula of Knuth for the number of linear extensions of a partially ordered set whose Hasse diagram is a rooted forest. These
q-analogues give formulas for the inversion index and the major index generating functions over permutations which correspond to linear extensions of a labeled forest. They generalize and unify several other
q-formulas appearing in the literature. For linear forests all of these formulas reduce to MacMahon's classical formula for “
q-counting” multiset permutations according to the major index and inversion index. We also extend MacMahon's formula in another direction by
q-counting all labelings of a fixed forest according to two very natural statistics on labeled forests which generalize the major index and inversion index on permutations.