# 「BZOJ 3028」食物-生成函数

BZOJ 3028

### 题解

$f(x) = \frac {x} {(1 - x) ^ 4} = x(1 - x) ^ {-4}$

#### 暴力展开法

$f(x)=\sum_{n = 0} ^ {\infty}f ^ {(n)} (0) \frac{x ^ n}{n!}$

$f ^ {(n)}(x) = [x(1 - x) ^ {-4}] ^ {(n)}$

$(u \cdot v) ^ {(n)} = \sum_{k = 0} ^ n \binom {k} {n} u ^ {(n)}v ^ {(n - k)}$

$f ^ {(n)}(x) = \sum_{k = 0} ^ n \binom {n} {k} x ^ {(k)} [(1 - x) ^ {-4}] ^ {(n - k)}$

$\prod_{i = 1} ^ n(\alpha - i + 1)x ^ {\alpha - n}$

\begin{aligned}f ^ {(n)} &= \binom {n} {0} x ^ {(0)}[(1 - x) ^ {-4}] ^ {(n)} + \binom {n} {1} x ^ {(1)} [(1 - x) ^ {-4}] ^ {(n - 1)} \\ &= x[(1 - x) ^ {-4}] ^ {(n)} + n[(1 - x) ^ {-4}] ^ {(n - 1)} \\ &= x \prod_{i = 1} ^ n(-4 - i + 1)(1 - x) ^ {-4 - n} + n \prod_{i = 1} ^ {n - 1}(-4 - i + 1)(1 - x) ^ {-4 - n + 1} \\ &= x \prod_{i = -4} ^ {-n - 3}i(1 - x) ^ {-4 - n} + n \prod_{i = -4} ^ {-n - 2}i (1 - x) ^ {-3 - n} \\ &= \frac {(n + 3)!} {3!}x(1 - x) ^ {-4 - n} + \frac {n(n + 2)!}{3!}(1 - x) ^ {-3 - n} \end{aligned}

$x ^ n$ 的系数

\begin{aligned}\frac {f ^ {(n)}(0)} {n!} &= \frac {n(n + 2)!} {3!n!}(-1) ^ {-3 - n} \\ &= \frac {n(n + 1)(n + 2)} {6} \end{aligned}

#### 广义二项式定理

$f(x)$ 的右半部分用广义二项式定理展开，可得

$f(x) = x\sum_{k = 0} ^ {\infty}\binom {-4} {k}x ^ k$

\begin{aligned}\binom {-4} {n - 1} &= \frac {\prod\limits_{i = -4} ^ {- 4 - n + 2}i} {(n - 1)!} \\ &= \frac {(n + 2)!} {(n - 1)!3!} \\ &= \frac {n(n + 1)(n + 2)} {6} \end{aligned}