划 分

Author

李 辉

Published

April 2, 2026

组成

A composition of an integer n is a way of writing n as the sum of a sequence of (strictly) positive integers. Two sequences that differ in the order of their terms.

Example 1 Suppose I want to distribute 20 chocolates to 4 children, Steven, Alice, Charlie, and Denise. The chocolates are identical. Each child gets at least one chocolate. What’s the number of ways we can distribute these chocolates?


Theorem 1 (\mathbf{k}-composition) The number of compositions of n into exactly k parts is given by the binomial coefficient {n-1\choose k-1}.

Example 2 n=5,k=3,

3 + 1 + 1, 2 + 2 + 1, 2 + 1 + 2,

1 + 3 + 1, 1 + 2 + 2, 1 + 1 + 3,

{5-1\choose 3-1}={4\choose 2}=6


Proof. Placing either a plus sign or a comma in each of the n − 1 boxes (\mathbf{k}-composition) of the array

\big(\, \overbrace{1\, \Box\, 1\, \Box\, \ldots\, \Box\, 1\, \Box\, 1}^n\, \big)

produces a unique composition of n. \square

Example 3 For n=5, 1+1,1,1+1 \rightarrow 2,1,2.


A weak composition of an integer n is similar to a composition of n, but allowing terms of the sequence to be zero: it is a way of writing n as the sum of a sequence of non-negative integers.

Again, suppose I want to distribute 20 chocolates to 4 children, Steven, Alice, Charlie, and Denise. This time, some child may get none. What is the number of ways?


Theorem 2 The number of weak k-composition is given by {n+k-1\choose k-1}.

Example 4 n=5, k=3,

3 + 1 + 1, 2 + 2 + 1, 2 + 1 + 2, 1 + 3 + 1, 1 + 2 + 2, 1 + 1 + 3,

4 + 1 + 0, 0 + 4 + 1, 4 + 0 + 1, 1 + 4 + 0, 0 + 1 + 4, 1 + 0 + 4,

3 + 2 + 0, 0 + 3 + 2, 3 + 0 + 2, 2 + 3 + 0, 0 + 2 + 3, 2 + 0 + 3,

5 + 0 + 0, 0 + 5 + 0, 0 + 0 + 5,

{5+3-1\choose 3-1}={7\choose 2}=21


Proof. Watch \mathbf{k}-composition of {n + k} corresponds to a weak compositions of n by the rule

[a + b + \cdots + c = n + k]

\Leftrightarrow [(a − 1) + (b − 1) + \cdots + (c − 1) = n].\square


Theorem 3 Each positive integer n has 2^{n−1} distinct compositions.

Example 5 n=5

5, 1 + 1 + 1 + 1 + 1, 4 + 1, 3 + 2, 2 + 3, 1 + 4,

3 + 1 + 1, 2 + 2 + 1, 2 + 1 + 2, 1 + 3 + 1, 1 + 2 + 2, 1 + 1 + 3,

2 + 1 + 1 + 1, 1 + 2 + 1 + 1, 1 + 1 + 2 + 1, 1 + 1 + 1 + 2,

Proof. \sum_{k=1}^n {n-1 \choose k-1} = 2^{n-1},\qquad\sum_{k=1}^n {n-1 \choose k-1} = \sum_{k=0}^{n-1} {n-1 \choose k}.\square

集合划分

A partition of a set is a grouping of the set’s elements into non-empty subsets, in such a way that every element is included in one and only one of the subsets.

Example 6 The set { 1, 2, 3 } has 5 partitions:

{ {1}, {2}, {3} }, or 1|2|3.

{ {1, 2}, {3} }, or 12|3.

{ {1, 3}, {2} }, or 13|2.

{ {1}, {2, 3} }, or 1|23.

{ {1, 2, 3} }, or 123.


Definition 1 The number of partitions of an n-element set into exactly k nonempty parts is the Stirling number of the second kind S(n, k).

Example 7 Let n=4, k=2, the set partitions are

123|4, 124|3, 134|2, 234|1,

12|34, 13|24, 14|23.


S(n, k) = 0 if n<k. S(0,0) = 1 by convention.

If n > 1, we have S(n, 1) = S(n, n) = 1.

The equality S(n, n-1) = \binom{n}{2} holds as a partition of [n] into n-1 subset must consist of one doubleton and n-2 singletons.

There exists no closed formula for S(n,k).

Exercise 1 S(6,4) and S(7,2), which one is larger?


Theorem 4 For all positive integers k<n, S(n, k) = S(n-1,k-1) + k\cdot S(n-1, k).

Proof. Taking a close look at the maximum element n.

  • If this element forms a singleton subset, then the remaining n-1 elements have S(n-1, k-1) ways to complete the partition.

  • Otherwise, the remaining n-1 elements must form a partition with k subsets in one of S(n-1, k) ways. Then we can put n into any of the k subset formed by this partition, multiplying the number by k. \square


Corollary 1 The number of all surjective functions f : [n] \rightarrow [k] is k!\cdot S(n,k).

Proof. Such a function defines a partition of [n].

We maps each subset into a element i\in[k].

Therefore, there are exactly k subsets, and k! different ways to label the subsets. \square


The Bell number B_n is the number of partitions of a set of size n.

B_n=\sum_{k=0}^n S(n,k)

From the previous example, B_3=5.

B_1 = 1. We define B_0=0.


Theorem 5 Bell numbers satisfy the recursion

B_{n+1}=\sum_{i=0}^n {n\choose i} B_i.

Proof. Assume the element n + 1 is in a subset of size n-i+1.

Then there are \binom{n}{n-i}=\binom{n}{i} ways to choose the elements being in the same block.

And there are B(i) ways to partition the remaining i elements of [n + 1]. \square

整数划分

A partition of a positive intege n, also called an integer partition, is a way of writing n as a sum of positive integers.

A partition is denoted by (a_1,a_2,\cdots,a_k), where \sum_{k=1}^n {a_i}=n and (a_1\geq a_2\geq\cdots\geq a_k).

Example 8 n=5

5, 4 + 1, 3 + 2, 3 + 1 + 1, 2 + 2 + 1

2 + 1 + 1 + 1, 1 + 1 + 1 + 1 + 1.


Two sums that differ only in the order of their summands are considered the same partition.

For example, 1 + 3 + 1 and 3 + 1 + 1 are the same partition.

The number of all partitions of n is denoted by p(n). e.g. p(5)=7.

The number of partitions of n into exactly k parts is denoted by p_k(n). e.g. p_2(5)=2.


No closed formula for p(n) too. An asymptotic expression for p(n) is given by G. H. Hardy and Ramanujan in 1918.

p(n) \sim \frac {1} {4n\sqrt3} \exp\left({\pi \sqrt {\frac{2n}{3}}}\right) \mbox { as } n\rightarrow \infty.

There is a common diagrammatic methods to represent partitions: Ferrers diagrams, named after Norman Macleod Ferrers,


The partition 6 + 4 + 3 + 1 of the positive number 14 can be represented by the following Ferrers diagram:

\begin{align*} &\boxdot\boxdot\boxdot\boxdot\boxdot\boxdot\\ &\boxdot\boxdot\boxdot\boxdot\quad\,\,\,\,\,\,\\ &\boxdot\boxdot\boxdot\qquad\,\,\,\,\,\,\\ &\boxdot\qquad\qquad\,\,\,\,\,\,\\ \end{align*}

If we reflect a Ferrers shape of a partition p with respect to its main diagonal, we get another shape: conjugate partition of p.


\begin{align*} &\boxdot\boxdot\boxdot\boxdot\\ &\boxdot\boxdot\boxdot\quad\\ &\boxdot\boxdot\boxdot\quad\\ &\boxdot\boxdot\qquad\\ &\boxdot\qquad\quad\\ &\boxdot\qquad\quad\\ \end{align*} The partition is (4,3,3,2,1,1).

A partition of n is called self-conjugate if it is equal to its conjugate. e.g. (4,3,2,1) and (5,1,1,1,1) are self-conjugate.


Theorem 6 The number of partitions of n into at most k parts is equal to that of partitions of n into parts not larger than k.

\begin{align*} &\boxdot\boxdot\boxdot\boxdot\boxdot\boxdot\\ &\boxdot\boxdot\boxdot\boxdot\quad\,\,\,\,\,\,\\ &\boxdot\boxdot\boxdot\qquad\,\,\,\,\,\,\\ &\boxdot\qquad\qquad\,\,\,\,\,\,\\ \end{align*}

The first number is equal to that of Ferrers shapes at most k rows. The second number is equal to that at most k columns.

Equinumerous by taking conjugates.


Theorem 7 The number of partitions of n into distinct odd parts is equal to that of all self-conjugate partitions of n.

For example, let n=8.

(4,2,1,1) (3,3,2)

Exercise 2 Try to find all partitions of n=8 that have odd parts only.

\begin{align*} &\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\\ &\boxtimes\boxdot\boxdot\boxdot\boxdot\boxdot\\ &\boxtimes\boxdot\boxplus\boxplus\qquad\\ &\boxtimes\boxdot\boxplus\qquad\quad\\ &\boxtimes\boxdot\qquad\qquad\\ &\boxtimes\boxdot\qquad\qquad\\ \end{align*}

 

\begin{align*} &\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\boxtimes\\ &\boxdot\boxdot\boxdot\boxdot\boxdot\boxdot\boxdot\boxdot\boxdot\qquad\\ &\boxplus\boxplus\boxplus\qquad\qquad\qquad\quad\,\,\,\,\,\\ \end{align*}


There is a Connection between the number of partitions of the integer n, and that of partitions of the set [n].

The set partitions {1,2,3}, {5,4}, {6} and {1,2,4}, {6,5}, {3} have something in common.

The two partitions are of type (3,2,1).

Another example: {1,5,6}, {2,7}, {3,9}, {4,8}, {10} is of type (3,2,2,2,1).


Theorem 8 Theorem Let a=(a_1,a_2,\cdots,a_k) be a partition of the integer n, and let m_i be the multiplicity of a_i. Then the number of set partitions of [n] that are of type a is equal to P_a=\frac{\binom{n}{a_1,a_2,\cdots,a_k}}{\prod_{i\geq{1}}m_i!}

Proof. Take a_j balls of color j, for all j\in[k].

Order them linearly in \binom{n}{a_1,a_2,\cdots,a_k} ways.


However, the number of different set partitions constructed this way is not necessarily so much.

Because there are m_i! ways the m_i color classes having a_i balls each can be permuted among each other. \square

Example 9 For example, This procedure creates a set partition of type a. e.g. type (3,2,2,2,1). There are three 2 in (3,2,2,2,1). The multiplicity of 2 is 3.


3\rightarrow R,2\rightarrow G,2\rightarrow B,2\rightarrow W,1\rightarrow Y

 

\begin{align*} GRBYW GRWRB&\{2,7,9\}, \{1,6\}, \{3,10\}, \{5,8\},\{4\}\\ YGRGR WRBBW&\{3,5,7\}, \{2,4\}, \{8,9\}, \{5,10\},\{1\}\\ RBGWR WYRGB&\{1,5,8\}, \{3,9\}, \{2,10\}, \{4,6\},\{7\}\\ \end{align*}

\begin{align*} Y\overline{G}R\overline{G}R WR\widehat{B}\widehat{B}W&\{3,5,7\}, \{2,4\}, \{8,9\}, \{5,10\},\{1\}\\ Y\widehat{B}R\widehat{B}R WR\overline{G}\overline{G}W&\{3,5,7\}, \{8,9\}, \{2,4\}, \{5,10\},\{1\}\\ \end{align*}