A standard way to prove that every nonnegative integer has a unique binary representation is to use the division algorithm. Repeatedly divide the number by 2, record the remainders, and continue until the quotient becomes zero. The remainders, read backwards, give the binary expansion. Uniqueness follows because at each step the quotient and remainder are uniquely determined. For example, take and perform repeated division by
:
,
,
,
Reading the remainders backwards gives which is indeed
.
But there is a generatingfunctionology proof that feels almost magical: write down a generating function and let algebra do the bookkeeping. An interested reader can learn more about generating functions in Wilf’s book generatingfunctionology. It is helpful to reexpress the problem in terms of a weighing problem. If you are given all possible weights that are powers of two, namely and an arbitrary weight
, in how many ways can you weigh
? We consider the following infinite product
. The power of generating functions lies first in observing that the coefficient
of the power
is exactly the number of different ways of representing
as a sum of different numbers from the set
. We already know the answer, namely
, which means that the answer should be
.
Let us verify this directly from the product. Consider the finite truncation
The useful identity is
Therefore,
Continuing in the same way, everything telescopes:
Hence
But the right-hand side is just
So the finite product already tells us something striking: using the powers
every integer from up to
is represented exactly once as a sum of distinct powers of two.
Now let grow. For any fixed exponent
, once
, the coefficient of
has already stabilized. Thus in the infinite limit,
Therefore every coefficient is equal to . In other words, every nonnegative integer has exactly one representation as a sum of distinct powers of two. This is precisely the uniqueness of binary representation in generatingfunctionology terms.