## Section8.5Partitions of an Integer

A recurring theme in this course has been to count the number of integer solutions to an equation of the form $$x_1+x_2+\cdots + x_k = n\text{.}$$ What if we wanted to count the number of such solutions but didn't care what $$k$$ was? How about if we took this new question and required that the $$x_i$$ be distinct (i.e., $$x_i\neq x_j$$ for $$i\neq j$$)? What about if we required that each $$x_i$$ be odd? These certainly don't seem like easy questions to answer at first, but generating functions will allow us to say something very interesting about the answers to the last two questions.

By a partition $$P$$ of an integer, we mean a collection of (not necessarily distinct) positive integers such that $$\sum_{i\in P} i = n\text{.}$$ (By convention, we will write the elements of $$P$$ from largest to smallest.) For example, $$2+2+1$$ is a partition of $$5\text{.}$$ For each $$n\ge0\text{,}$$ let $$p_n$$ denote the number of partitions of the integer $$n$$ (with $$p_0=1$$ by convention). Note that $$p_8=22$$ as evidenced by the list in Figure 8.15.

Note that there are $$6$$ partitions of $$8$$ into distinct parts. Also there are $$6$$ partitions of $$8$$ into odd parts. While it might seem that this is a coincidence, it in fact is always the case as Theorem 8.16 states. Before looking at that theorem and its proof, let's think about what a generating function for $$p_n\text{,}$$ the number of partitions of $$n\text{,}$$ would look like. Given a partition of $$n\text{,}$$ we can count how many $$1$$'s appear, how many $$2$$'s appear, and so on. This suggests a similarity with our fruit basket problems earlier in the chapter, leading to the generating function

\begin{equation*} P(x) = \left(\sum_{m=0}^\infty x^{m}\right)\left(\sum_{m=0}^\infty x^{2m}\right) \left(\sum_{m=0}^\infty x^{3m}\right)\cdots \left(\sum_{m=0}^\infty x^{km}\right)\cdots = \prod_{m=1}^\infty\frac{1}{1-x^m}. \end{equation*}

Here the factor whose sum contains terms $$x^{km}$$ is accounting for the number of $$k$$'s in the partition. While $$P(x)$$ has a quite elegant form, that doesn't mean that it's terribly useful for computing $$p_n\text{.}$$ In fact, providing an asymptotic estimate for $$p_n$$ was a notoriously difficult problem, finally addressed by Hardy and Ramanujan in 1918. A popular account of this can be found in Robert Kanigel's 1991 book The Man who Knew Infinity or the 2016 film with the same title.

Proving the relationship between the number of partitions into distinct parts and the number of partitions into odd parts will involve restricted versions of the generating function $$P(x)$$ from above.

The generating function $$D(x)$$ for the number of partitions of $$n$$ into distinct parts is

\begin{equation*} D(x)=\prod_{n=1}^\infty (1+x^n). \end{equation*}

On the other hand, the generating function $$O(x)$$ for the number of partitions of $$n$$ into odd parts is

\begin{equation*} O(x)=\prod_{n=1}^\infty\frac{1}{1-x^{2n-1}}. \end{equation*}

To see that $$D(x)=O(x)\text{,}$$ we note that $$1-x^{2n}=(1-x^n)(1+x^n)$$ for all $$n\ge1\text{.}$$ Therefore,

\begin{align*} D(x)\amp =\prod_{n=1}^\infty (1+x^n)=\prod_{n=1}^\infty\frac{1-x^{2n}}{1-x^n} =\frac{\prod_{n=1}^\infty(1-x^{2n})}{\prod_{n=1}^\infty(1-x^n)}\\ \amp =\frac{\prod_{n=1}^\infty(1-x^{2n})}{ \prod_{n=1}^\infty(1-x^{2n-1})\prod_{n=1}^\infty(1-x^{2n})} =\prod_{n=1}^\infty\frac{1}{1-x^{2n-1}}\\ \amp = O(x). \end{align*}