Skip to main content
2 of 2
deleted 18 characters in body
Ira Gessel
  • 17k
  • 1
  • 58
  • 80

This is an easy exercise in the application of exponential generating functions. (See, for example, Richard Stanley's Enumerative Combinatorics, Vol. 2, chapter 5, for an exposition of the theory of exponential generating functions.)

A permutation can be viewed as a set of fixed points together with a derangement. The exponential generating function for sets of fixed points is $e^x$. If we weight each fixed point by $f$ then the generating function for weighted sets of fixed points is $e^{fx}$. The exponential generating function for derangements is $D(x)=e^{-x}/(1-x)$. Since each derangement is a set of cycles of length at least 2, if we weight each cycle of length at least 2 by $c$ then the exponential generating function for weighted derangements is $D(x)^c$. Thus the number of permutations in $S_n$ with $i$ fixed points (and therefore $n-i$ changed points) and $N$ cycles of length at least 2 is the coefficient of $\displaystyle f^ic^N\frac{x^n}{n!}$ in $$ e^{fx}D(x)^c = \frac{e^{(f-c)x}}{(1-x)^c}.$$ From this generating function you can easily get an explicit formula.

Ira Gessel
  • 17k
  • 1
  • 58
  • 80