Back to Combinatorics

Chapter 7: Partitions and Structure Types

October 10, 2026 Wasil Zafar 22 min read

Organize integers and sets into blocks, diagrams, and restricted families

Table of Contents

  1. Why do compositions and partitions have different counts?
  2. 7.1 Compositions of integers
  3. 7.2 Set partitions and Stirling numbers of the second kind
  4. 7.3 Integer partitions and Ferrers/Young diagrams
  5. 7.4 Bell numbers and restricted-growth strings
  6. 7.5 Partition identities, including Euler's identity
  7. 7.6 Durfee squares and conjugate partitions
  8. 7.7 Restricted partitions and partition generating functions
  9. 7.8 Introduction to Young tableaux
  10. Construct partition bijections and enumerate restricted families

Why do compositions and partitions have different counts?

Grouping four identical units into non-empty batches illustrates a fundamental combinatorics lesson: the exact counting model depends on whether order matters and whether elements are labeled.

Four identical units must be grouped into nonempty batches. If the batches are processed in sequence, a batch of three followed by a batch of one differs from a batch of one followed by a batch of three. If we care only about batch sizes, those descriptions represent the same grouping.

An ordered list of positive sizes summing to four is a composition of four. An unordered collection of positive sizes summing to four is an integer partition of four. We write an integer partition in decreasing order to give it a unique representation.

There is a third model. If the units are four distinct tasks, a grouping must record which tasks belong together. This is a set partition. Two groupings can have the same block sizes but different memberships.

Comparing Compositions, Integer Partitions, and Set Partitions for n = 4 Three visual cards comparing Compositions where sequence matters, Integer Partitions where only sizes matter, and Set Partitions where element labels matter. Three Fundamental Grouping Models for Four Units 1. Compositions (Ordered Sizes) Sequence matters! (3, 1) ≠ (1, 3) Identical items in fixed sequence 2⁴⁻¹ = 8 Compositions 2. Integer Partitions (Unordered Sizes) Only size multiset matters! 3 + 1 ≡ 1 + 3 Identical items, no part ordering p(4) = 5 Partitions 3. Set Partitions (Labeled Blocks) Item membership matters! {a,b}|{c,d} ≠ {a,c}|{b,d} Distinct items into unlabelled blocks B₄ = 15 Set Partitions Different object definitions ➔ Different count formulas! ✓
Figure 7.0: Comparing compositions, integer partitions, and set partitions for $n=4$.

The word “partition” therefore needs an object and a convention: are we partitioning an integer into sizes, or a labeled set into blocks? Are the parts ordered? Are empty parts permitted? Answering these questions determines the count.

Motivating Problem

Why do compositions and partitions have different counts?

Inputs. Four identical units; positive batch sizes; any number of batches.

Integer partitionCompositions with these sizesNumber
$4$$(4)$$1$
$3+1$$(3,1),(1,3)$$2$
$2+2$$(2,2)$$1$
$2+1+1$$(2,1,1),(1,2,1),(1,1,2)$$3$
$1+1+1+1$$(1,1,1,1)$$1$

There are five integer partitions and eight compositions. Sorting a composition produces a partition, but different partitions have different numbers of preimages. Consequently, we cannot recover the partition count by dividing the composition count by one fixed ordering factor.

If the units are distinct tasks $a,b,c,d$, groupings $\{a,b\}\mid\{c,d\}$ and $\{a,c\}\mid\{b,d\}$ both have size pattern $2+2$, but are different set partitions. The vertical separator here separates blocks; exchanging entire blocks does not change the grouping.

Questions to revisit. Why is the composition count $2^3$? How many set partitions do four tasks have? Can a diagram provide a reversible correspondence between restricted integer partitions?


7.1 Compositions of integers

A composition of a positive integer $n$ is an ordered tuple $(a_1,\ldots,a_k)$ of positive integers with sum $n$. Its length is the number of parts $k$. For example, $(1,3,2)$ is a length-three composition of six.

Place $n$ units in a row. There are $n-1$ gaps between consecutive units. Choose which gaps receive cuts; each resulting segment contributes its positive length. For $n=6$, cutting after units one and four produces $(1,3,2)$.

Stars and Bars / Gaps Model for Compositions of n = 6 Diagram showing 6 units with 5 gap choices. Placing cuts after unit 1 and unit 4 yields the composition (1, 3, 2). Bijection: Subsets of n - 1 Gaps ⟷ Compositions of n (n = 6) 1 2 3 4 5 6 CUT CUT Part 1 = 1 Part 2 = 3 Part 3 = 2 Cuts at Gaps {1, 4} produce Composition (1, 3, 2) ✓
Figure 7.1: Placing cuts at subset $\{1,4\}$ among 5 gaps of $n=6$ forms composition $(1,3,2)$.

Conversely, a composition determines its cuts through the partial sums $a_1,a_1+a_2,\ldots,a_1+\cdots+a_{k-1}$. These lie in $\{1,\ldots,n-1\}$ and recover the original segments. This proves a bijection between compositions of $n$ and subsets of the $n-1$ gaps.

Therefore, for $n\ge1$,

$$\#\{\text{compositions of }n\}=2^{n-1},$$

and, for $1\le k\le n$,

$$\#\{\text{length-}k\text{ compositions of }n\} =\binom{n-1}{k-1}.$$

Exactly $k-1$ cuts produce $k$ positive parts. Summing over lengths gives the row-sum identity for row $n-1$ of Pascal's triangle.

Worked example. The six length-three compositions of five are

$$(1,1,3),\ (1,2,2),\ (1,3,1),\ (2,1,2),\ (2,2,1),\ (3,1,1).$$

Their count is $\binom{4}{2}=6$. The cuts for $(2,1,2)$ occur after units two and three.

A weak composition permits zero parts, but its length must be fixed. For $n\ge0$ and $k\ge1$, Chapter 4's stars-and-bars bijection gives $\binom{n+k-1}{k-1}$ weak compositions of length $k$. Allowing arbitrary lengths would produce infinitely many descriptions by adding zeros.

We adopt one composition of zero: the empty tuple, of length zero. No positive-length composition with positive parts sums to zero. The formula $2^{n-1}$ is stated only for $n\ge1$.

Exercise. Count compositions of seven into exactly three positive parts. Hint: Choose two cuts from six gaps. Answer: $\binom{6}{2}=15$.


7.2 Set partitions and Stirling numbers of the second kind

A set partition of a finite set is a collection of nonempty, pairwise disjoint subsets called blocks, whose union is the entire set. The blocks have no order, and the elements within a block have no order. For example, $\{\{1,3\},\{2\}\}$ partitions $\{1,2,3\}$ into two blocks.

Write $S(n,k)$ for the Stirling number of the second kind, the number of partitions of an $n$-element labeled set into exactly $k$ blocks. The boundary values are

$$S(0,0)=1,\qquad S(n,0)=0\ (n\ge1),\qquad S(0,k)=0\ (k\ge1).$$

There are no partitions into more than $n$ nonempty blocks, so $S(n,k)=0$ for $k > n$.

Recurrence. For $n\ge1$ and $k\ge1$,

$$S(n,k) = S(n-1,k-1) + k S(n-1,k)$$

Distinguish element $n$. If it forms a singleton block, partition the other elements into $k-1$ blocks. Otherwise remove $n$ from its block; the remaining partition still has $k$ nonempty blocks, and there are $k$ choices of block into which to restore it. These cases are disjoint, and each construction has a unique inverse.

Stirling Numbers Recurrence Breakdown S(4,2) = 7 Visual tree showing element 4 creating its own block or joining one of 2 existing blocks, giving S(4,2) = 1 + 2(3) = 7. Stirling Recurrence: S(4, 2) = S(3, 1) + 2 × S(3, 2) = 1 + 2(3) = 7 Case 1: Element 4 in its own block {4} Partition remaining {1,2,3} into 2-1 = 1 block {1, 2, 3} | {4} Count = S(3, 1) = 1 way + Case 2: Element 4 joins one of 2 existing blocks Partition {1,2,3} into 2 blocks (S(3,2)=3), pick block for 4 {1,2,4}|{3}, {1,2}|{3,4}, {1,3,4}|{2}, ... Count = 2 × S(3, 2) = 2 × 3 = 6 ways Total S(4, 2) = 1 + 6 = 7 Set Partitions ✓
Figure 7.2: Decomposing set partitions of $\{1,2,3,4\}$ into 2 blocks via Stirling recurrence $S(4,2) = 7$.

This also connects partitions to functions. A surjection from an $n$-element set onto $k$ labeled outputs determines $k$ nonempty fibers. Forgetting the output labels gives a set partition. Each partition has exactly $k!$ assignments of its blocks to the outputs, so the surjection count is $k!S(n,k)$.

Proof Workshop

Set partitions and Stirling numbers of the second kind: a worked example

Problem. Partition $\{1,2,3,4\}$ into two nonempty unordered blocks.

There are two possible block-size patterns.

PatternPartitionsCount
$3+1$Singleton $\{1\}$, $\{2\}$, $\{3\}$, or $\{4\}$, with the complement as the other block$4$
$2+2$$\{1,2\}\mid\{3,4\}$; $\{1,3\}\mid\{2,4\}$; $\{1,4\}\mid\{2,3\}$$3$

Thus $S(4,2)=7$. In the equal-size case, choosing one pair gives $\binom{4}{2}=6$ choices, but each unordered partition is represented twice, once by each of its pairs. Division by two is justified by this constant multiplicity.

The recurrence gives the same result: $S(4,2)=S(3,1)+2S(3,2)=1+2\cdot3=7$. Alternatively, the $2^4-2=14$ surjections onto two labeled outputs correspond in pairs to the seven unlabeled-block partitions.

Exercise. Find $S(4,3)$. Hint: Exactly one block has two elements, and the other two are singletons. Answer: $\binom{4}{2}=6$.


7.3 Integer partitions and Ferrers/Young diagrams

An integer partition of $n\ge1$ is a sequence

$$\lambda=(\lambda_1,\ldots,\lambda_k),\qquad \lambda_1\ge\cdots\ge\lambda_k\ge1,\qquad \lambda_1+\cdots+\lambda_k=n.$$

The decreasing convention records an unordered multiset of positive sizes exactly once. Write $\lambda\vdash n$ to mean that $\lambda$ partitions $n$, and write $p(n)$ for the number of such partitions. Set $p(0)=1$, corresponding to the empty partition.

Worked example. The five partitions of four are $(4)$, $(3,1)$, $(2,2)$, $(2,1,1)$, and $(1,1,1,1)$. These are size patterns, rather than assignments of labeled objects to groups.

Their relationship to set partitions is visible in this table:

Size patternSet partitions of $\{1,2,3,4\}$ with that pattern
$(4)$$1$
$(3,1)$$4$
$(2,2)$$3$
$(2,1,1)$$6$
$(1,1,1,1)$$1$

The total is $15$, although there are only five integer partitions. Sorting the block sizes forgets memberships, and different patterns have different numbers of labeled realizations.

The 5 Integer Partitions of 4 represented as Young Diagrams Diagram showing the 5 Young diagrams for partitions of 4: (4), (3,1), (2,2), (2,1,1), and (1,1,1,1). The 5 Integer Partitions of n = 4 (p(4) = 5) (4) 1 set partition (3, 1) 4 set partitions (2, 2) 3 set partitions (2, 1, 1) 6 set partitions (1, 1, 1, 1) 1 set partition Total Set Partitions Sum = 1 + 4 + 3 + 6 + 1 = 15 = B₄ ✓
Figure 7.3: Young diagrams of all 5 integer partitions of 4, alongside their set partition counts.

A Ferrers diagram represents each part by a row of dots. A Young diagram uses square cells instead. We use the English convention: rows are left-justified, with the longest row at the top. Other drawing conventions exist, so the orientation should always be stated.

For $\lambda=(4,2,1)$, the rows contain four, two, and one units. The two diagrams below represent the same partition of seven. The orange region marks a square of side two; Section 7.6 will explain its role.

Ferrers and Young diagrams for the partition four, two, one The left diagram has rows of four, two, and one dots. The right diagram has rows of four, two, and one square cells. Both contain seven units and are left-justified with the longest row at the top. The first two units in each of the first two rows are orange, marking a two by two Durfee square. Partition (4, 2, 1) of 7 Ferrers diagram: dots Young diagram: cells 421 421 4 + 2 + 1 = 7 dots 4 + 2 + 1 = 7 cells The red region is the 2 by 2 Durfee square.

Drawing rows from the parts and reading their lengths back are inverse operations. This representation makes restrictions geometric: a bound on the largest part is a bound on width, and a bound on the number of parts is a bound on height.

Exercise. List all partitions of five into exactly two positive parts. Hint: The smaller part is at most two. Answer: $(4,1)$ and $(3,2)$.


7.4 Bell numbers and restricted-growth strings

The Bell number $B_n$ counts all set partitions of an $n$-element labeled set, regardless of their number of blocks. Thus

$$B_n=\sum_{k=0}^n S(n,k),\qquad B_0=1.$$

The first values are $B_0=1$, $B_1=1$, $B_2=2$, $B_3=5$, and $B_4=15$. These are counts of set partitions, not integer partitions.

For an algorithm, unordered blocks need a canonical encoding. Order the blocks by their least elements and label them $0,1,2,\ldots$. For each element $i$ in the ordered set $\{1,\ldots,n\}$, record the label of its block. The resulting restricted-growth string $(r_1,\ldots,r_n)$ satisfies

$$r_1=0,\qquad 0\le r_i\le1+\max(r_1,\ldots,r_{i-1})\quad(i\ge2)$$

A newly encountered block receives the next unused label; an existing block keeps its label. Conversely, a string satisfying this rule groups elements with equal labels, and the rule guarantees that labels appear in the required order. This is a bijection, so the encoding introduces no duplicate block orderings.

Restricted-Growth Strings Decision Tree for n = 3 Tree showing construction of all 5 restricted growth strings for a 3-element set: 000, 001, 010, 011, and 012. Restricted-Growth String Tree for B₃ = 5 Set Partitions r₁ = 0 00 01 000 {1,2,3} 001 {1,2}|{3} 010 {1,3}|{2} 011 {1}|{2,3} 012 {1}|{2}|{3} Rule: rᵢ ≤ 1 + max(r₁, ..., rᵢ₋₁) ➔ Exactly B₃ = 5 valid encodings ✓
Figure 7.4: Decision tree generating the 5 restricted-growth strings for a 3-element set.

Worked example. Partition $\{1,3\}\mid\{2,4\}$ becomes $0101$. The five strings for a three-element set are

$$000,\quad001,\quad010,\quad011,\quad012.$$

They encode respectively one block; block pair $\{1,2\}\mid\{3\}$; block pair $\{1,3\}\mid\{2\}$; block pair $\{1\}\mid\{2,3\}$; and three singleton blocks. The number of blocks in a nonempty string is one plus its maximum label.

A recursive generator starts with $0$ and, after a prefix with maximum label $m$, tries each next label in $\{0,\ldots,m+1\}$. Each valid string follows exactly one path. The empty string represents the unique partition of the empty set.

Another Bell recurrence is

$$B_{n+1}=\sum_{j=0}^n\binom{n}{j} B_j.$$

Distinguish the new element. Choose the $j$ old elements outside its block, partition those elements in $B_j$ ways, and place every remaining element in the distinguished block. The outside set and its partition are uniquely recoverable. For $n=3$, this gives $B_4=1+3+6+5=15$.

Exercise. Decode $0012$ and state its number of blocks. Hint: Group element positions carrying the same label. Answer: $\{1,2\}\mid\{3\}\mid\{4\}$, with three blocks.


7.5 Partition identities, including Euler's identity

A partition identity equates two restricted families of integer partitions. A good proof explains how to transform an object from one family into an object from the other and how to reverse that transformation.

Euler's odd–distinct identity. For every integer $n\ge0$, the number of partitions of $n$ into odd parts equals the number of partitions of $n$ into distinct parts. Odd parts may repeat; distinct parts may be even or odd. At $n=0$, both families contain the empty partition.

Bijection from odd parts to distinct parts. For each odd positive integer $u$, let $m_u$ be its multiplicity. Write that multiplicity in binary:

$$m_u=\sum_{j\ge0}\varepsilon_{u,j}2^j, \qquad \varepsilon_{u,j}\in\{0,1\}.$$

For every nonzero digit, replace the corresponding $2^j$ copies of $u$ by one part $2^ju$. The total is preserved. The resulting parts are distinct: every positive integer has a unique factorization as a power of two times an odd integer, so two different pairs $(u,j)$ cannot produce the same part.

Inverse. For each distinct part, write it uniquely as $2^ju$ with $u$ odd, then replace it by $2^j$ copies of $u$. Distinct parts with the same odd factor correspond to different binary digits. Uniqueness of the binary expansion proves that both transformations undo one another.

Euler's Odd-Distinct Partition Bijection for n = 13 Diagram showing odd-part partition 5+3+1+1+1+1+1 transforming into distinct-part partition 5+4+3+1 via binary expansion of multiplicity 5 = 4 + 1. Euler's Odd-Distinct Bijection: Odd Parts ⟷ Distinct Parts (n = 13) Odd-Part Partition 5 (mult = 1 = 2⁰) 3 (mult = 1 = 2⁰) 1 + 1 + 1 + 1 + 1 (mult = 5 = 2² + 2⁰) 5 copies of 1 ➔ 1×4 + 1×1 Distinct-Part Partition 5 × 2⁰ = 5 1 × 2² = 4 3 × 2⁰ = 3 1 × 2⁰ = 1 5 + 3 + 1 + 1 + 1 + 1 + 1 = 13 ⟷ 5 + 4 + 3 + 1 = 13 ✓
Figure 7.5: Converting odd parts into distinct parts using binary decomposition of multiplicities.

Worked example. The odd-part partition

$$5+3+1+1+1+1+1=13$$

has five copies of one. Since $5=4+1$ in powers of two, those copies become parts $4$ and $1$. The image is the distinct-part partition $5+4+3+1$. Replacing the part $4$ by four ones recovers the original partition.

For $n=6$, the correspondence is:

Odd-part partitionDistinct-part image
$5+1$$5+1$
$3+3$$6$
$3+1+1+1$$3+2+1$
$1+1+1+1+1+1$$4+2$

There are four objects in each family.

A generating-function view. A formal generating function records the count of total $n$ as the coefficient of $x^n$. For distinct parts, each size $r$ is absent or appears once, giving the factor $1+x^r$. For odd parts, each odd size can appear any number of times, giving a geometric-series factor. Thus

$$\prod_{r\ge1}(1+x^r) =\prod_{r\ge1}\frac{1-x^{2r}}{1-x^r} =\prod_{\substack{r\ge1\\r\text{ odd}}}\frac1{1-x^r}.$$

The middle expression cancels the factors for even sizes. This is a formal identity: for any fixed coefficient, only finitely many sizes matter. Section 7.7 develops this interpretation locally; the fuller treatment in Chapter 10, Section 10.1, is listed in the series roadmap. That later chapter is optional background, not an entry requirement here.

Exercise. List the odd-part and distinct-part partitions of five and pair them using the bijection. Hint: Five copies of one become parts four and one. Answer: $5\leftrightarrow5$, $3+1+1\leftrightarrow3+2$, and $1+1+1+1+1\leftrightarrow4+1$.


7.6 Durfee squares and conjugate partitions

The conjugate partition $\lambda'$ is obtained by transposing the Young diagram: its rows are the original columns. Formally,

$$\lambda'_j=\#\{i:\lambda_i\ge j\}.$$

The diagram of $(4,2,1)$ has column heights $3,2,1,1$, so its conjugate is $(3,2,1,1)$. Transposition preserves the number of cells and applying it twice restores the diagram. Thus conjugation is a bijection and an involution.

The largest part of $\lambda'$ is the number of parts of $\lambda$, and the number of parts of $\lambda'$ is the largest part of $\lambda$. Consequently, for every $n\ge0$ and $k\ge0$, conjugation pairs partitions of $n$ into at most $k$ parts with partitions of $n$ whose parts are at most $k$.

For example, the partitions of five into at most two parts are $(5)$, $(4,1)$, and $(3,2)$. Their conjugates are $(1,1,1,1,1)$, $(2,1,1,1)$, and $(2,2,1)$, exactly the partitions of five with largest part at most two.

The Durfee square is the largest square of cells in the upper-left corner of the diagram. Its side length is

$$d=\max\{i:\lambda_i\ge i\},$$

with $d=0$ for the empty partition. For $(4,2,1)$, the second row has at least two cells but the third has fewer than three, so $d=2$.

Durfee Square Decomposition and Conjugation of Partition (4,2,1) Diagram showing partition (4,2,1) split into a 2x2 Durfee square, right partition (2), and lower partition (1), and its conjugate (3,2,1,1). Durfee Square Decomposition & Conjugate Transposition Original λ = (4, 2, 1) [Durfee side d = 2] d² = 2×2 = 4 Right α = (2) Lower β = (1) ⟷ Transpose Conjugate λ' = (3, 2, 1, 1) d² = 2×2 = 4 Right β' = (1) Lower α' = (1,1) 7 = d² + |α| + |β| = 4 + 2 + 1 ➔ Reconstructs Partition Uniquely! ✓
Figure 7.6: Decomposing $\lambda=(4,2,1)$ into Durfee square and two sub-partitions, and transposing to conjugate $\lambda'=(3,2,1,1)$.

Removing the Durfee square leaves two independent pieces. To its right are row lengths

$$\alpha=(\lambda_1-d,\ldots,\lambda_d-d),$$

with zero entries omitted, so $\alpha$ has at most $d$ parts. Below it is $\beta=(\lambda_{d+1},\lambda_{d+2},\ldots)$, whose parts are at most $d$ because the square was maximal.

Worked decomposition. For $(4,2,1)$, the square contains four cells, the right piece is $(2)$, and the lower piece is $(1)$. Hence $7=4+2+1$.

Conversely, given $d$, a partition $\alpha$ with at most $d$ parts, and a partition $\beta$ with parts at most $d$, pad $\alpha$ with zeros to length $d$, add $d$ to each entry, and append the parts of $\beta$. The result is decreasing and has Durfee side exactly $d$. This reconstructs the original partition uniquely. Conjugation exchanges the roles of the right and lower pieces, transposing each.

Exercise. Find the conjugate and Durfee side of $(3,3,1)$. Hint: Count the heights of its three columns. Answer: Its conjugate is $(3,2,2)$, and its Durfee side is two.


7.7 Restricted partitions and partition generating functions

A restriction may specify allowed part sizes, multiplicities, the number of parts, or a diagram's dimensions. A generating function organizes these counts without requiring the later general theory.

For a formal series $F(x)=\sum_{n\ge0}a_nx^n$, the coefficient $a_n$ is recorded as $[x^n]F(x)$. Multiplication combines independent choices and adds their totals. Each coefficient calculation involves finitely many contributing choices in the products below, so no numerical convergence assumption is needed.

If positive part size $a$ is available without limit, its multiplicities contribute

$$1+x^a+x^{2a}+\cdots=\frac1{1-x^a}.$$

For an allowed set $A$ of positive sizes,

$$\#\{\text{partitions of }n\text{ with parts in }A\} =[x^n]\prod_{a\in A}\frac1{1-x^a}.$$

Each partition determines one multiplicity for every allowed size, and every such multiplicity choice determines one partition. We multiply once per size, so parts are not ordered. For a count up to total $N$, sizes greater than $N$ may be omitted even if $A$ is infinite.

Worked example. With allowed sizes $A=\{1,3,4\}$ and total six, the partitions are

$$4+1+1,\qquad3+3,\qquad3+1+1+1,\qquad1+1+1+1+1+1.$$

The count is four, the coefficient of $x^6$ in $1/((1-x)(1-x^3)(1-x^4))$.

Common restrictions modify the factors:

Restriction on size $a$Factor
Any nonnegative multiplicity$1/(1-x^a)$
At most one copy$1+x^a$
At most $b$ copies$1+x^a+\cdots+x^{ba}$
Any multiplicity, with $y$ recording the number of parts$1/(1-yx^a)$

Consequently, the coefficient of $x^ny^k$ in $\prod_{a\ge1}(1-yx^a)^{-1}$ counts partitions of $n$ into exactly $k$ parts.

For unrestricted partitions,

$$P(x)=\sum_{n\ge0}p(n)x^n=\prod_{a\ge1}\frac1{1-x^a}.$$

Conjugation shows that partitions into at most $d$ parts have the same generating function as partitions with largest part at most $d$, namely $\prod_{a=1}^d(1-x^a)^{-1}$. The Durfee decomposition therefore gives another identity:

$$P(x) = \sum_{d\ge0} \frac{x^{d^2}}{\prod_{a=1}^d (1-x^a)^2}$$

The square contributes $d^2$ cells; the right and lower pieces each contribute one of the two product factors. At any total $n$, only $d^2\le n$ can contribute. The $d=0$ term is one, using the empty-product convention.

Dynamic Programming Array Update for Partitions with A = {1, 3, 4} Diagram showing the DP array state transitions for totals 0 through 6 when processing item sizes 1, 3, and 4. Dynamic Programming Algorithm: D(s) = D(s) + D(s - a) for A = {1, 3, 4} After a = 1: [1,1,1,1,1,1,1] After a = 3: [1,1,1,2,2,2,3] After a = 4: [1,1,1,2,3,3,4] s=0s=1s=2s=3s=4s=5s=6 Result for n = 6 with parts {1, 3, 4} is D(6) = 4 Partitions ✓
Figure 7.7: Dynamic programming array transitions computing partition counts for $A=\{1,3,4\}$ up to total $N=6$.

Computing coefficients. For a finite allowed set $A$ and maximum total $N$, initialize $D(0)=1$ and $D(s)=0$ for $1\le s\le N$. Process each distinct allowed size $a$ once. For totals $s=a,a+1,\ldots,N$ in increasing order, replace $D(s)$ by $D(s)+D(s-a)$.

Before processing $a$, the array counts partitions using the previously processed sizes. At total $s$, the old term counts partitions with no copy of $a$; the already updated term at $s-a$ counts partitions with at least one copy after appending $a$. This invariant proves correctness. The increasing total order permits repeated use of the current size. For $A=\{1,3,4\}$, the final counts at totals zero through six are $1,1,1,2,3,3,4$.

The algorithm uses $O(|A|N)$ integer additions and $O(N)$ array entries. Exact counts can grow large, so these are arithmetic-operation bounds. Reversing the nesting of the size and total loops changes the counting interpretation and can count ordered compositions instead.

The broader ordinary-generating-function framework appears in Chapter 10, Section 10.1, listed in the series roadmap; everything needed for these products has been introduced here.

Exercise. Count partitions of five with largest part at most two. Hint: Use the coefficient of $x^5$ in $1/((1-x)(1-x^2))$. Answer: Three: $1+1+1+1+1$, $2+1+1+1$, and $2+2+1$.


7.8 Introduction to Young tableaux

Optional extension. A Young diagram records a shape. A Young tableau fills that shape with entries subject to rules. This section is not required for the chapter foundation.

A standard Young tableau of shape $\lambda\vdash n$ places the labels $1,2,\ldots,n$ into its cells, each exactly once, so that entries increase from left to right along rows and from top to bottom along columns. Write $f^\lambda$ for its count, with $f^{\varnothing}=1$.

Worked example. Shape $(3,2)$ has three cells in its top row and two directly beneath the first two. Its five standard tableaux are specified by these row entries:

TableauTop rowBottom row
$1$$(1,2,3)$$(4,5)$
$2$$(1,2,4)$$(3,5)$
$3$$(1,2,5)$$(3,4)$
$4$$(1,3,4)$$(2,5)$
$5$$(1,3,5)$$(2,4)$

The bottom entries align under the first two top entries. Check the row and column inequalities directly. Choosing any three labels for the top row and sorting both rows would give $\binom{5}{3}=10$ fillings with increasing rows, but only these five also satisfy the column conditions.

Removable Corners Recurrence for Standard Young Tableaux f^(3,2) = 5 Diagram showing the corner recurrence splitting shape (3,2) into removable corners yielding f^(2,2) = 2 and f^(3,1) = 3 for total 5. Removable Corner Recurrence: f^{(3,2)} = f^{(2,2)} + f^{(3,1)} = 2 + 3 = 5 Shape (3, 2) ➔ ➔ Remove (1,3) Shape (2,2) f^{(2,2)} = 2 Standard Tableaux Remove (2,2) Shape (3,1) f^{(3,1)} = 3 Standard Tableaux Corner Recurrence Total = 2 + 3 = 5 Standard Young Tableaux ✓
Figure 7.8: Splitting shape $(3,2)$ into removable corners to prove $f^{(3,2)} = 5$.

Why is the list complete? The largest label must occupy a removable corner: a cell with no cell immediately to its right or below, whose removal leaves a Young diagram. Removing that cell leaves a standard tableau of the smaller shape. Conversely, placing the new largest label in such a corner preserves all inequalities. Hence

$$f^\lambda=\sum_{c\text{ a removable corner of }\lambda}f^{\lambda\setminus c}.$$

For $(3,2)$, removing a corner gives shape $(2,2)$ or $(3,1)$. Their counts are two and three, respectively: $f^{(2,2)}=2$ and $f^{(3,1)}=3$. Thus $f^{(3,2)}=2+3=5$, proving completeness independently of the displayed list. These smaller counts follow by the same corner recurrence or direct listing.

A semistandard Young tableau uses positive integer entries that weakly increase along rows and strictly increase down columns; repetitions are allowed. For example, top row $(1,1,3)$ and bottom row $(2,2)$ give a semistandard tableau of shape $(3,2)$. It is not standard because labels repeat.

Tableaux also describe legal task orders. Regard each cell as a task that must occur after the cell immediately to its left and the cell immediately above it, when those cells exist. Labeling cells by their execution times gives exactly a standard tableau. Thus $f^\lambda$ counts the possible execution orders for this dependency pattern.

Exercise. List the standard tableaux of shape $(2,1)$. Hint: The upper-left cell must contain one. Answer: Top row $(1,2)$ with bottom entry $3$, or top row $(1,3)$ with bottom entry $2$; the count is two.


Construct partition bijections and enumerate restricted families

The chapter's models preserve different information. A composition records ordered sizes. An integer partition forgets their order. A set partition retains labeled memberships while forgetting block order. A Young tableau adds an ordered labeling to a diagram under row and column restrictions.

There is a concrete bridge from compositions to tableaux. For fixed shape $(3,2)$, the row sizes form the ordered size list $(3,2)$. Assigning five distinct labels to those rows and then sorting each row gives $5!/(3!2!)=10$ fillings. Column inequalities restrict that family to five standard tableaux. The composition specifies row sizes; the tableau records which labels occupy those positions and whether the dependencies are respected.

These distinctions matter in applications. Grouping distinct records into unlabeled clusters is a set-partition problem; retaining only the cluster-size distribution is an integer-partition problem. Scheduling batches in a fixed sequence uses compositions. Executing tasks with the diagram dependencies from Section 7.8 uses tableaux. Changing the representation changes which outcomes are considered distinct.

Investigation

Construct partition bijections and enumerate restricted families

Inputs. Start with total $n=6$ for integer partitions and the labeled set $\{1,2,3,4\}$ for set partitions. Use positive parts, decreasing order for integer partitions, and zero-based restricted-growth labels for set partitions.

Task 1: distinguish the models. Count compositions of four, integer partitions of four, and set partitions of four labeled elements. List enough objects to explain the differences.

Solutions: The counts are $8$, $5$, and $15$. The first follows from three cut positions, the second from the five size patterns, and the third from $S(4,1)+S(4,2)+S(4,3)+S(4,4)=1+7+6+1$.

Task 2: construct and invert Euler's bijection. Enumerate the odd-part partitions of six and map them to distinct-part partitions using binary multiplicities. Implement or describe the inverse by removing powers of two from each distinct part.

Solution check: The four pairs are displayed in Section 7.5. Prove preservation of the total, distinctness of the output parts, and both round-trip identities. The proof must use uniqueness of binary expansion and of the odd factor of a positive integer.

Task 3: conjugation and Durfee decomposition. Draw $(4,2,1)$, compute its conjugate, and identify its Durfee square and two remaining pieces. Reconstruct the diagram from those pieces.

Solution check: The conjugate is $(3,2,1,1)$, the square has side two, the right piece is $(2)$, and the lower piece is $(1)$. Explain why arbitrary right pieces with at most $d$ parts and lower pieces with parts at most $d$ reconstruct a partition with Durfee side exactly $d$.

Task 4: independent enumeration. Generate decreasing integer partitions recursively. A call with remaining total $s$ and maximum next part $M$ tries each positive next part $t\le\min(s,M)$, then recurses with remaining total $s-t$ and maximum $t$. Emit the prefix when the remaining total is zero. Start with $(s,M)=(n,n)$, handling $n=0$ by emitting the empty partition.

Every emitted tuple is decreasing and sums to $n$. Every partition follows its unique sequence of part choices, proving completeness and uniqueness. Filter these outputs for odd parts, distinct parts, or allowed sizes $\{1,3,4\}$. Independently compute the allowed-size counts by the array method in Section 7.7 and compare them.

Expected checks: $p(0),\ldots,p(6)$ are $1,1,2,3,5,7,11$. At total six, the odd-part and distinct-part counts are both four. The allowed-size count for $\{1,3,4\}$ is also four, but that family is different: it includes $4+1+1$, for example. Equal counts alone do not identify equal families.

For every partition generated, check that conjugating twice recovers the original. For every odd-part partition, check that the Euler map followed by its inverse recovers it; also check the reverse direction on every distinct-part partition. Generate the fifteen length-four restricted-growth strings and decode them to verify the set-partition count.

Optional tableau extension. Assign labels $1$ through $5$ to shape $(3,2)$ in all row-increasing ways. Retain only fillings with increasing columns. Compare the resulting five tableaux with the corner recurrence $f^{(3,2)}=f^{(2,2)}+f^{(3,1)}$. Explain which information the fixed row-size composition provides and which extra constraints the tableau imposes.

Deliverables. Submit the model comparisons, both directions of the two partition bijections, the Durfee reconstruction, and enumeration totals. Include the empty partition as a boundary test. Finite tests validate the examples; the reversible constructions and recursive invariants prove the general statements.

Assessment: 25 points. Award five points each for distinguishing the structure types; Euler's bijection and inverse; conjugation and Durfee reconstruction; correct enumeration with independent checks; and clear proofs, boundary handling, and interpretation of equal counts. The tableau extension is enrichment and is not required for full credit on the foundation.

Next in the Series

In Chapter 8: Permutation Structure, we'll explore Cycles, descents, inversions, and patterns reveal hidden order.