L13 – Stirling Numbers, Integer Partitions, and Generating Functions

Discrete Mathematics2026年4月16日发布 芮和
47.4K 1120
6,806字
29–43 分钟

Type 3

Problem: distributing nn labeled objects into kk unlabeled boxes

Classifications
n1+n2++nk=nn_1 + n_2 + \dots + n_k = n
n1,n2,,nkn_1, n_2, \dots, n_k \in \mathbb{N}
n1n2nkn_1 \geq n_2 \geq\dots\geq n_k

EXAMPLE: Assigning 4 employees {a,b,c,d}\{a, b, c, d\} into 3 unlabeled offices. Each office can contain any number of employees.

  • 4 0 04\ 0\ 0: [abcd  ][abcd\ -\ -]
  • 3 1 03\ 1\ 0: [abc d ] [abd c ] [acd b ] [bcd a ][abc\ d\ -]\ [abd\ c\ -]\ [acd\ b\ -]\ [bcd\ a\ -]
  • 2 2 02\ 2\ 0: [ab cd ] [ac bd ] [ad bc ][ab\ cd\ -]\ [ac\ bd\ -]\ [ad\ bc\ -]
  • 2 1 12\ 1\ 1: [ab c d][ac b d][ad b c][bc a d][bd a c][cd a b][ab\ c\ d][ac\ b\ d][ad\ b\ c][bc\ a\ d][bd\ a\ c][cd\ a\ b]

S2(n,j)S_2(n,j)

1730, Stirling (1692-1770)

DEFINITION: S2(n,j)S_2(n,j), the Stirling number of the second kind, is defined as the # of ways of distributing nn labeled objects into jj unlabeled boxes s.t. no box is empty.

  • The number of ways of distributing nn labeled objects into kk unlabeled boxes is j=1kS2(n,j)\sum_{j=1}^k S_2(n,j).

THEOREM: S2(n,j)=1j!i=0j1(1)i(ji)(ji)nS_2(n,j) = \frac{1}{j!} \sum_{i=0}^{j-1} (-1)^i \binom{j}{i} (j-i)^n when nj1n \geq j \geq 1.

  • T(n,j)T(n,j): the # of ways of distributing nn labeled objects into jj labeled boxes such that no box is empty
    • T(n,j)=j!S2(n,j)T(n,j) = j! \cdot S_2(n,j)
  • XX: the set of ways of distributing nn labeled objects into jj labeled boxes.
    • By the product rule, |X|=jn|X| = j^n
  • XiXX_i \subseteq X: the set of ways where exactly ii boxes are used, i=1,2,,ji = 1,2, \dots, j
    • {X1,X2,,Xj}\{X_1, X_2, \dots, X_j\} is a partition of XX and |Xi|=(ji)T(n,i)|X_i| = \binom{j}{i} T(n,i)
    • jn=|X|=i=1j|Xi|=i=1j(ji)T(n,i)j^n = |X| = \sum_{i=1}^j |X_i| = \sum_{i=1}^j \binom{j}{i} T(n,i) // aj=jn,bj=T(n,j),aj=i=1j(ji)bia_j = j^n, b_j = T(n,j), a_j = \sum_{i=1}^j \binom{j}{i} b_i
    • T(n,j)=i=1j(1)ji(ji)in=i=0j1(1)i(ji)(ji)nT(n,j) = \sum_{i=1}^j (-1)^{j-i} \binom{j}{i} i^n = \sum_{i=0}^{j-1} (-1)^i \binom{j}{i} (j-i)^n // inverse binomial transform
  • S2(n,j)=1j!T(n,j)=1j!i=0j1(1)i(ji)(ji)nS_2(n,j) = \frac{1}{j!} \cdot T(n,j) = \frac{1}{j!} \sum_{i=0}^{j-1} (-1)^i \binom{j}{i} (j-i)^n

Type 4

Problem: distributing nn unlabeled objects into kk unlabeled boxes

Classifications
n1+n2++nk=nn_1 + n_2 + \dots + n_k = n
n1,n2,,nkn_1, n_2, \dots, n_k \in \mathbb{N}
n1n2nkn_1 \geq n_2 \geq \dots \geq n_k

EXAMPLE: # of ways of distributing 4 identical books into 3 identical boxes.

  • 4 0 04\ 0\ 0
  • 3 1 03\ 1\ 0
  • 2 2 02\ 2\ 0
  • 2 1 12\ 1\ 1

REMARK: The schemes are determined by {n1,,nk}\{n_1, \dots, n_k\}


Partitions of Integers

DEFINITION: n=a1+a2++ajn = a_1 + a_2 + \dots + a_j is called an nn-partition with exactly jj parts if a1a2aja_1 \geq a_2 \geq \dots \geq a_j are all positive integers.

  • pj(n)=|{(a1,,aj):a1++aj=n,a1a2aj1 are integers}|p_j(n) = \left|\left\{\left(a_1, \dots, a_j\right): a_1 + \dots + a_j = n, a_1 \geq a_2 \geq \dots \geq a_j \geq 1 \text{ are integers}\right\}\right|
    • pj(n)p_j(n): the # of ways of writing nn as the sum of jj positive integers.
    • p1(n)=1p_1(n) = 1, pn(n)=1p_n(n) = 1

EXAMPLE: The integer 4 has 4 different partitions into 3\leq 3 parts

  • 4=44 = 4
  • 4=3+14 = 3 + 1
  • 4=2+24 = 2 + 2
  • 4=2+1+14 = 2 + 1 + 1

REMARK: solution to the type 4 problem =j=1kpj(n)= \sum_{j=1}^k p_j(n)

THEOREM: For n+n \in \mathbb{Z}^+, j[n]j \in [n], pj(n+j)=i=1jpi(n)p_j(n + j) = \sum_{i=1}^j p_i(n)

  • Let Si=S_i = the set of nn-partitions with exactly ii parts, i[j]i \in [j]
  • Let S=i=1jSiS = \bigcup_{i=1}^j S_i. Then |S|=|S1|++|Sj|=p1(n)++pj(n)|S| = |S_1| + \dots + |S_j| = p_1(n) + \dots + p_j(n). // right-hand side
  • Let T=T = the set of (n+j)(n+j)-partitions with exactly jj parts. Then |T|=pj(n+j)|T| = p_j(n+j). // left-hand side
  • f:ST(n1,,ni)(n1+1,,ni+1,1,,1)f: S \to T\quad (n_1, \dots, n_i) \mapsto (n_1 + 1, \dots, n_i + 1, 1, \dots, 1)
    • ff is bijective
    • |T|=|S||T| = |S|

EXAMPLE: determine p3(6)p_3(6) and p4(6)p_4(6) with the above theorem

  • p3(6)=p3(3+3)=p1(3)+p2(3)+p3(3)=1+1+1=3p_3(6) = p_3(3+3) = p_1(3) + p_2(3) + p_3(3) = 1 + 1 + 1 = 3
  • p4(6)=p4(2+4)=p1(2)+p2(2)+p3(2)+p4(2)=1+1+0+0=2p_4(6) = p_4(2+4) = p_1(2) + p_2(2) + p_3(2) + p_4(2) = 1 + 1 + 0 + 0 = 2

Computing pj(n)p_j(n) Recursively


Generating Functions

Catalan number: Cn+1=k=0nCkCnkC_{n+1} = \sum_{k=0}^n C_k C_{n-k}, C0=1C_0 = 1// there is a new tool to solve it

DEFINITION: The generating function of a sequence {ar}r=0\{a_r\}_{r=0}^\infty is G(x)=r=0arxrG(x) = \sum_{r=0}^\infty a_r x^r.

  • Generating functions are formal power series; we do not discuss their convergence.

EXAMPLE: generating functions of sequences

  • ar=3a_r = 3, G(x)=3(1+x++xr+)G(x) = 3(1 + x + \dots + x^r + \dots)
  • ar=2ra_r = 2^r, G(x)=1+2x++(2x)r+G(x) = 1 + 2x + \dots + (2x)^r + \dots
  • ar=(nr)a_r = \binom{n}{r}, G(x)=(n0)+(n1)x++(nn)xnG(x) = \binom{n}{0} + \binom{n}{1}x + \dots + \binom{n}{n}x^n

DEFINITION: Let A(x)=r=0arxrA(x) = \sum_{r=0}^\infty a_r x^r, B(x)=r=0brxrB(x) = \sum_{r=0}^\infty b_r x^r.

  • A(x)=B(x)A(x) = B(x) if ar=bra_r = b_r for all r=0,1,2,r = 0,1,2, \dots

Operations

DEFINITION: Let A(x)=r=0arxrA(x) = \sum_{r=0}^\infty a_r x^r, B(x)=r=0brxrB(x) = \sum_{r=0}^\infty b_r x^r.

  • A(x)+B(x)=r=0(ar+br)xrA(x) + B(x) = \sum_{r=0}^\infty (a_r + b_r) x^r
  • A(x)B(x)=r=0(arbr)xrA(x) – B(x) = \sum_{r=0}^\infty (a_r – b_r) x^r
  • A(x)B(x)=r=0(j=0rajbrj)xrA(x) \cdot B(x) = \sum_{r=0}^\infty \left(\sum_{j=0}^r a_j b_{r-j}\right) x^r
  • λA(x)=r=0λarxr\lambda \cdot A(x) = \sum_{r=0}^\infty \lambda a_r x^r for any constant λ\lambda \in \mathbb{R}
  • We say that B(x)B(x) is an inverse of A(x)A(x) if A(x)B(x)=1A(x)B(x) = 1.
    • The inverse of A(x)A(x) is denoted as A1(x)A^{-1}(x)
    • When A(x)A(x) has an inverse, define C(x)A(x)=A1(x)C(x)\frac{C(x)}{A(x)} = A^{-1}(x) \cdot C(x)

THEOREM: A(x)=r=0arxrA(x) = \sum_{r=0}^\infty a_r x^r has an inverse if and only if a00a_0 \neq 0.

EXAMPLE: Let A(x)=r=0xrA(x) = \sum_{r=0}^\infty x^r. Find A1(x)A^{-1}(x).

  • a0=10a_0 = 1 \neq 0: A1(x)A^{-1}(x) exists
  • Denote A1(x)=r=0brxrA^{-1}(x) = \sum_{r=0}^\infty b_r x^r; b0,b1,b_0, b_1, \dots are undetermined coefficients
  • A(x)A1(x)=1A(x)A^{-1}(x) = 1:
    • (1+x+x2+)(b0+b1x+b2x2+)=1+0x+0x2+(1 + x + x^2 + \dots)(b_0 + b_1 x + b_2 x^2 + \dots) = 1 + 0 \cdot x + 0 \cdot x^2 + \dots
      • Coefficient of x0x^0: b0=1b_0 = 1
      • Coefficient of x1x^1: b1+b0=0b_1 + b_0 = 0
      • Coefficient of x2x^2: b2+b1+b0=0b_2 + b_1 + b_0 = 0
      • Coefficient of xrx^r: br+br1++b0=0b_r + b_{r-1} + \dots + b_0 = 0
        • b1=1b_1 = -1, b2=0b_2 = 0, …, br=0b_r = 0
        • A1(x)=1xA^{-1}(x) = 1 – x

DEFINITION: A(x)=n=0anxnA(x) = \sum_{n=0}^\infty a_n x^n

  • A(x)=n=1nanxn1A'(x) = \sum_{n=1}^\infty n a_n x^{n-1}
    • A(0)(x)=A(x)A^{(0)}(x) = A(x)
    • A(k)(x)=(A(k1)(x))A^{(k)}(x) = (A^{(k-1)}(x))’ for all integers k1k \geq 1
  • A(x)dx=n=01n+1anxn+1+C\int A(x) dx = \sum_{n=0}^\infty \frac{1}{n+1} a_n x^{n+1} + C, where CC is a constant

THEOREM: Let A(x)=n=0anxnA(x) = \sum_{n=0}^\infty a_n x^n and B(x)=n=0bnxnB(x) = \sum_{n=0}^\infty b_n x^n.

  • (αA(x)+βB(x))=αA(x)+βB(x)(\alpha A(x) + \beta B(x))’ = \alpha A'(x) + \beta B'(x)
  • (A(x)B(x))=A(x)B(x)+A(x)B(x)(A(x)B(x))’ = A'(x)B(x) + A(x)B'(x)
  • (Ak(x))=kAk1(x)A(x)\left(A^k(x)\right)’ = k A^{k-1}(x) A'(x)

(1+αx)u(1+\alpha x)^u

DEFINITION: Let uu \in \mathbb{R} and nn \in \mathbb{N}. The extended binomial coefficient

(un)={u(u1)(un+1)n!n>01n=0\binom{u}{n} =\begin{cases}\frac{u(u-1)\cdots(u-n+1)}{n!} & n > 0 \\1 & n = 0\end{cases}

THEOREM: Let xx be a real number with |x|<1|x| < 1 and let uu be a real number. Then (1+x)u=n=0(un)xn(1 + x)^u = \sum_{n=0}^\infty \binom{u}{n} x^n.

EXAMPLE:

  • (1αx)1=n=0αnxn(1 – \alpha x)^{-1} = \sum_{n=0}^\infty \alpha^n x^n // (1n)=(1)(11)(1n+1)n!=(1)n\binom{-1}{n} = \frac{(-1)(-1-1)\cdots(-1-n+1)}{n!} = (-1)^n
  • (1αx)u=n=0(n+u1n)αnxn(1 – \alpha x)^{-u} = \sum_{n=0}^\infty \binom{n + u – 1}{n} \alpha^n x^n // (un)=(u)(u1)(un+1)n!=(1)n(n+u1n)\binom{-u}{n} = \frac{(-u)(-u-1)\cdots(-u-n+1)}{n!} = (-1)^n \binom{n + u – 1}{n}
© 版权声明

相关文章

112 条评论

  • 虚无吞噬者
    虚无吞噬者 游客

    看到S2(n,j)就想起被离散数学支配的恐惧😭

    日本
    回复
  • 月光下的兔子
    月光下的兔子 读者

    感觉把对象和盒子区分开就简单多了,容易混

    中国浙江
    回复
  • 赛博园丁
    赛博园丁 游客

    Catalan数倒是熟,括号匹配天天见,这个反而懵

    中国广西
    回复
  • 夜莺幻听
    夜莺幻听 游客

    形式幂级数这玩意儿,工程上真敢直接算?

    中国北京
    回复
  • 旅途伴侣
    旅途伴侣 游客

    当年期末考就是栽在Type 4上,现在看还怕

    中国甘肃
    回复
  • 白骨回声
    白骨回声 游客

    求问那个公式里的(-1)^i到底是咋来的?

    中国浙江
    回复
  • ShySpark
    ShySpark 读者

    分拆那块看着眼晕,n1>=n2这种顺序记不住啊

    中国河北
    回复
    • ArcaneVeil
      ArcaneVeil 游客

      生成函数这求逆操作,看例子才看懂点

      中国湖南@ ShySpark
      回复
    • 感恩火鸡
      感恩火鸡 游客

      p_j(n)递推的那个定理,拿具体数验算一遍就清楚了

      中国湖北@ ShySpark
      回复
  • 勤劳小蚂蚁
    勤劳小蚂蚁 游客

    Type 3和Type 4的区别真让人晕,有人总结下吗?

    中国辽宁
    回复
  • 桃花妖姬
    桃花妖姬 游客

    斯特林数公式背了八百遍还是记不住😭

    韩国
    回复
  • 野猪猪猪
    野猪猪猪 游客

    课上到生成函数那块直接懵了,符号一堆😵‍💫

    中国江苏
    回复
  • 末日狂飙
    末日狂飙 游客

    斯特林老哥要是知道现在学生背他公式得笑醒

    中国重庆
    回复
    • 墨流香
      墨流香 游客

      那个(-1)^i的符号变化,看半天才明白是二项式反演

      中国重庆@ 末日狂飙
      回复
  • 落叶知秋意
    落叶知秋意 游客

    形式幂级数不考虑收敛,工程上真敢这么用?

    澳大利亚
    回复
  • 雾影吟游
    雾影吟游 游客

    看到这些数学符号就想起被期末考试支配的恐惧😭

    中国江西
    回复
  • 水云
    水云 游客

    整数分拆在实际编程里有用过吗?

    中国广东
    回复
  • 蚀骨军团
    蚀骨军团 游客

    组合数学这东西,学的时候痛苦用的时候真香

    日本
    回复
  • 呆毛王
    呆毛王 游客

    p_j(n)递推用Ferrers图理解会清楚很多

    中国北京
    回复
  • 社牛伪装者
    社牛伪装者 游客

    生成函数求逆那部分,能不能举个简单例子?

    中国江苏
    回复
  • 极光幻想
    极光幻想 游客

    斯特林数在算法题里真遇到过,当时卡了好久

    日本
    回复
  • 期待的目光
    期待的目光 读者

    Type 3和4的区别不就是对象和盒子能不能区分嘛

    韩国
    回复
  • 血瞳望月
    血瞳望月 游客

    这公式看得我头大,符号太多了吧

    中国广东
    回复
  • 幻影姬
    幻影姬 游客

    当年也被这个坑过,做完题要检查三遍

    中国湖北
    回复
  • 星尘絮语
    星尘絮语 读者

    Type3和Type4主要区别在对象和盒子是否可区分

    中国山东
    回复
  • 微信已读不回
    微信已读不回 游客

    形式幂级数在密码学里也这么用,没问题

    日本
    回复
    • 虚空织网者
      虚空织网者 游客

      密码学里生成函数主要用在哪块?

      中国内蒙古@ 微信已读不回
      回复
  • 代码魅影
    代码魅影 游客

    p_j(n)递推用Ferrers图讲更直观

    中国广东
    回复
  • 冰镇可乐
    冰镇可乐 读者

    看到Catalan数就想起括号匹配的面试题😂

    中国贵州
    回复
  • 剑气如虹
    剑气如虹 读者

    斯特林数在数据库分桶优化里有用过

    中国湖南
    回复
  • 晨曦光
    晨曦光 读者

    生成函数求逆跟Z变换确实像,都是形式运算

    韩国
    回复
  • 长街旧梦
    长街旧梦 读者

    那个双射构造绝了

    中国上海
    回复
  • 猎户信使
    猎户信使 读者

    Type3和Type4对比着看,瞬间通透了

    中国广西
    回复
  • 厨房的香味
    厨房的香味 读者

    斯特林数公式怎么记啊,每次考试都现推

    德国
    回复
  • BloodMoonPhantom
    BloodMoonPhantom 读者

    斯特林数那个例子,代入数值才算明白

    中国新疆
    回复
  • 量子迷雾
    量子迷雾 读者

    生成函数不讨论收敛这事,挺有意思

    中国上海
    回复