【笔记】组合恒等式和二项式定理

组合恒等式和二项式定理

0 定义

\(\begin{aligned}{n\choose m}=\dfrac {n!}{m!(n-m)!}\end{aligned}\)


1 常规

  1. \(\begin{aligned}{n\choose m}={n\choose n-m}\end{aligned}\)

    还是有用的,比如:

    \[\begin{aligned}\sum\limits_{i=0}^n{x\choose i}{y\choose i}=\sum\limits_{i=0}^n{x\choose i}{y\choose y-i}={x+y\choose y}\text{【范德蒙德卷积】}\end{aligned} \]

  2. \(\begin{aligned}{n\choose m}={n-1\choose m-1}\times \frac nm\end{aligned}\)

    定义带入

  3. \(\begin{aligned}{n\choose m}={n-1\choose m}+{n-1\choose m-1}\end{aligned}\)

  4. \(\begin{aligned}{n\choose r}{r\choose k}={n\choose k}{n-k\choose r-k}\end{aligned}\)


1.2 二项式定理

\[\begin{aligned}(a+b)^n=\sum\limits_{i=\color{red}0}^n{n\choose i}a^ib^{n-i}\end{aligned} \]


2 求和

2.1 单个组合数

2.1.1 变下项求和

  1. \(\begin{aligned}\sum\limits_{i=0}^n{n\choose i} = 2^n\end{aligned}\)

  2. \(\begin{aligned}\sum\limits_{i=0}^ni{n\choose i} = n2^{n-1}\end{aligned}\)

  3. \(\begin{aligned}\sum\limits_{i=0}^ni^2{n\choose i} = n(n+1)2^{n-2}\end{aligned}\)

  4. \(\begin{aligned}\sum\limits_{i=0}^n(-1)^i{n\choose i} = 0\end{aligned}\)

    证明???


2.1.2 变上项求和

  1. \(\begin{aligned}\sum\limits_{i=0}^n{i\choose k} = {n+1\choose k+1}\end{aligned}\)

  2. \(\begin{aligned}\sum\limits_{i=0}^ni{i\choose k} = {}\end{aligned}\)

    \(i\) 换成常数


2.2 两个组合数(卷积)

2.2.1 变下项求和

  1. 【范德蒙德卷积】

    \(\begin{aligned}\sum\limits_{i=0}^k{n\choose i}{m\choose k-i} = {n+m\choose k}\end{aligned}\)

2.2.2 变上项求和

  1. \(\begin{aligned}\sum\limits_{i=0}^k{i\choose n}{k-i\choose m} = {k+1\choose n+m+1}\end{aligned}\)

2.3 其她

  1. \(\begin{aligned}\sum\limits_{i=0}^N(-1)^i{n\choose i} = (-1)^N{n-1\choose N}\end{aligned}\)

    证明???


3 例题

「CF1332E」 Height All the Same

结论:可行的方案一定是高度中的奇数/偶数的个数有一个为偶数。

令,\(N=n\times m\)\(x\)\([L,R]\) 中偶数的个数,\(y\)\([L,R]\) 中奇数的个数。

\[\begin{aligned}Ans&=\sum\limits_{i=0}^{N}{N \choose i}x^iy^{N-i}[2\mid i\ \text{or}\ 2\mid(N-i)]\end{aligned} \]

如果不考虑后面的条件,那么根据二项式定理,\(Ans=(x+y)^N\)

考虑这个条件,只有在 \(N\) 为偶 \(i\) 为奇的时候不成立。我们需要构造一些具有加减交叉的东西,来抵消这写不必要的答案。然后构造了半天没构造出来

于是 \(T=(-x+y)^N\),这样在 \(i\) 为奇数的时候她就是负值了,然后跟之前的答案相加再除以二,即可。


「HDU3483」 A Very Simple Problem

Tag: 矩阵加速。

考虑从 \(i\) 转移到 \(i+1\)

\[\begin{aligned}(i+1)^xx^{i+1}=x\sum\limits_{j=0}^{x}{x\choose j}i^jx^{i}\end{aligned} \]

这样的话,我们只需维护 \(i^jx^i(j\in[0,x]\cap\mathbb{Z})\) 和 sum,即可。

具体的,初始矩阵,即 \(k=1\)​ 时:

\[\begin{bmatrix} x & x & x & \cdots & x & 0 \end{bmatrix}\]

转移矩阵:

\[\begin{bmatrix} 1x & 1x & 1x & \cdots & \begin{aligned}{x\choose 0}\end{aligned}x & 0\\ 0 & 1x & 2x & \cdots & \begin{aligned}{x\choose 1}\end{aligned}x & 0\\ 0 & 0 & 1x & \cdots & \begin{aligned}{x\choose 2}\end{aligned}x & 0\\ \vdots & \vdots & \vdots & \ddots & \vdots & 0\\ 0 & 0 & 0 & 0 & \begin{aligned}{x\choose x}\end{aligned}x & 1\\ 0 & 0 & 0 & 0 & 0 & 1 \end{bmatrix}\]

posted @ 2024-03-06 13:46  CloudWings  阅读(16)  评论(0编辑  收藏  举报