求方程$x+y+z=24$的整数解的个数,要求$1le xle 5,12le yle 18,-1le zle12$
解:设$a_r$是方程$X+Y+Z=r$的满足上述要求的整数解的个数,那么$a_r$的母函数是
$f(x)=(x+x^2+x^3+x^4+x^4+x^5)(x^{12}+x^{13}+cdots+x^{18})(x^{-1}+1+x+x^2+cdots+x^{12})$
易知$f(x)=x^{12}dfrac{(1-x^5)(1-x^7)(1-x^{14})}{(1-x)^3}$
$=x^{12}(1-x^5-x^7+x^{12}-x^{14}+x^{19}+x^{21}-x^{26})sumlimits_{k=0}^{+infty}{C_{k+2}^2x^k}$
故$x^{24}$前的系数$a_{24}=C_{14}^2-C_9^2-C_7^2+C_2^2=35$
注:
$C_alpha^k=dfrac{alpha(alpha-1)cdots(alpha-k+1)}{k!}$
取$alpha=-n$得$C_{-n}^k=dfrac{-n(-n-1)cdots(-n-k+1)}{k!}=(-1)^kC_{n+k-1}^k$
故$dfrac{1}{(1-x)^n}=sumlimits_{k=0}^{+infty}{C_{-n}^k(-x)^k}=sumlimits_{k=0}^{+infty}{C_{n+k-1}^{n-1}x^k}$