You are on page 1of 4

Bijections

Brice Huang
December 28, 2013

1 Background
Many combinatorial problems require us to determine the number of elements in a set that is difficult to
count directly. For these problems, we may consider finding a bijection or one-to-one correspondence,
a mapping that pairs each element of this set with an element of another set and vice versa. The bijection
ensures that the two sets have the same number of elements. We may then count the elements in the first
set indirectly, by counting the elements in the second set; if the second set is constructed appropriately, it
will generally be much easier to count than the first.
Other combinatorial problems ask us to prove that two sets have the same number of elements. For these
problems, it is natural to solve the problem by finding a bijection between these two sets.
In either case, the difficulty of these problems lies in finding the appropriate bijection and, in some cases,
proving that it is a bijection. Indeed, finding a suitable bijection for a problem requires experimentation,
patience, and experience.
Now, let’s see some bijections in action:

2 Two Classic Bijections


Block-Walking Problem: How many paths are there from (0, 0) to (6, 6) consisting only of steps of length
1 up or to the right?
Solution: Each path consists of six steps to the right and six steps up, in some order. Thus, each path
can be described by a string consisting of six R’s and six U’s in some order; for instance, the string RRUU-
UUURRRUR corresponds to the path consisting of two steps to the right, followed by 5 steps up, followed
by 3 steps to the right, followed by a a step up, followed by a step to the right. It is clear that each path
from (0,0) to (6,6) corresponds to a unique permutation of RRRRRRUUUUUU, and each permutation of
RRRRRRUUUUUU corresponds to a unique path from (0,0) to (6,6), so this correspondence is one-to-one.
12!
Therefore the number of paths is the number of permutations of RRRRRRUUUUUU, which is 6!6! =
12

6 = 924 .
This argument can easily be adapted for the general case of walking from (0,0) to a point (m, n), and
even to block-walks in more than two dimensions.

Stars and Stripes Technique: How many ways are there to buy 10 fruits from an infinite supply of apples,
oranges, and bananas?
Solution: Suppose we let a string of 10 stars (************), represent the 10 fruits we will buy. We may
insert two dividers among these stars so that the stars to the left of the first divider represent apples, those
between the two dividers represent oranges, and those to the right of the second divider represent bananas;
for instance, ***/**/***** represents 3 apples, 2 oranges, and 5 bananas, while *******//*** represents 7
apples, 0 oranges, and 3 bananas. As each combination of ten fruits corresponds to a unique permutation of
**********// and vice versa, this correspondence is a bijection.

1
Bijections High School North Math Club 2013-14
Therefore the number of combinations of fruits is the number of permutations of **********//, which is
12!
= 12

10!2! 2 = 66 .
This technique is known as the Stars and Stripes technique because of the appearance of the bijection
used. In general, Stars and Stripes
 1 implies that the number of nonnegative solutons (x1 , x2 , . . . , xm ) to
x1 + x2 + · · · + xm = n is n+m−1
m−1 .

3 Examples
Example 1: How many ways can Alice, Bob, Carol, and Dan sit in a row of 10 seats if no two people can
sit next to each other?
Solution: We claim that seatings in 10 seats with no two people next to each other biject to seatings in
7 seats without restriction. Indeed, each seating of the former type can be associated with a seating of the
latter type by removing a seat between each pair of consecutive people; each seating of the latter type can
be associated with a seating of the former type by adding a seat between each pair of consecutive people.
Thus the answer is the number of ways to seat the four people in 7 seats, or 7 · 6 · 5 · 4 = 840 .

Example 2: How many ways are there to write 10 as the sum of any number of positive integers if different
orderings of the same sum are distinguishable?
Solution: Let a string of 10 stars (**********) represent ten 1s. We may insert dividers between adjacent
stars to split them into groups that represent summands. For example, ***/**/*/**** represents 3+2+1+4
and */*/*/*/****** represents 1+1+1+1+6. Each placement of dividers corresponds to a unique sum-
mation, and each summation corresponds to a unique placement of dividers. We have thus established a
bijection between placements of dividers among the stars and valid summations.
As there are 10 stars, there are 9 locations between adjacent stars where we may insert a divider. At
each location, we have two choices: to place a divider or to not place a divider. Thus, we may place dividers
in 29 = 512 ways.

Example 3: A positive integer is called increasing if each digit is greater than the digit to its left. How
many 3-digit increasing numbers are there?
Solution: Observe that there is a bijection between 3-digit increasing numbers and sets of 3 distinct nonzero
digits: each set of 3 distinct nonzero digits corresponds to the 3-digit number made by placing said digits in
increasing order, and 3-digit increasing number corresponds to the set containing its three digits. Therefore,
we may simply count the number of sets of 3 distinct nonzero digits; there are 93 = 84 such sets.

Example 4: Eight points are chosen on a circle and all possible line segments between pairs of points are
drawn. Given that no three of the line segments drawn meet at the same point, determine the number of
distinct intersections of these line segments in the interior of the circle.
Solution: Each interesction corresponds to a pair of line segments, which in turn correspond to a unique
set of four of the chosen points. Likewise, each set of four points can be associated with the intersection
of the diagonals of the quadrilateral determined by these four points. This is a one-to-one correspondence
between intersections and sets of four points. Thus, to answer the question, we may count the number of
sets of four points; there are 84 = 70 such sets.

Example 5: [AIME 1983] For {1, 2, . . . , n} and each of its nonempty subsets a unique alternating sum is
defined as follows: Arrange the numbers in the subset in decreasing order and then, beginning with the
1 Do not memorize this result. If you understand Stars and Stripes, you will be able to re-derive this formula quickly whenever

you need it.

2
Bijections High School North Math Club 2013-14
largest, alternately add and subtract successive numbers (For example, the alternating sum for {1, 2, 4, 6, 9}
is 9 − 6 + 4 − 2 + 1 = 6 and for {5}, it is simply 5. Find the sum of all such alternating sums for n = 7.
Solution: There are 27 = 128 subsets of {1, 2, . . . , 7} (because for each number, we have a choice to include
it or not include it in a subset). We pair the subsets as follows: if a subset includes the number 7, we pair it
with the same subset with 7 removed; if a subset does not include 7, we pair it with the same subset with 7
added. There are 128 2 = 64 such pairs.
Notice that the sum of the alternating sums of each pair is 7; for example, {1, 2, 5} and {1, 2, 5, 7} have a
combined alternating sum of (5 − 2 + 1) + (7 − 5 + 2 − 1) = 7. In general, in the alternating sums of every
pair of subsets, every summand that is positive in one alternating sum is negative in the other, except for
the 7, which only appears (as a positive summand) in one alternating sum. As there are 64 pairs of subsets
and each pair’s alternating sums add to 7, the total of all the alternating sums is 64 · 7 = 448 .

Example 6: What is the 200th smallest positive integer that can be written as the sum of distinct powers
of 4?
Solution: Call a number permissible if it is expressible as the sum of distinct powers of 4. In order for a
number to be permissible, its base-4 representation must include only 0s and 1s. This observation allows us
to begin listing these numbers in increasing order: 14 , 104 , 114 , 1004 , 1014 , 1104 , 1114 , 10004 , and so on.
But, observe that 1, 10, 11, 100, 101, 110, 111, 1000 are numbers in base 2; moreover, the numbers 12 , 102 ,
112 , 1002 , 1012 , 1102 , 1112 , 10002 are precisely the numbers 1, 2, 3, 4, 5, 6, 7, 8 in decimal - that is, the base-4
representations of permissible numbers biject to the base-2 representations of all counting numbers.
With this insight, we may compute the nth smallest permissible number by converting n to base 2 and reading
the result in base 4. We have 200 = 11001002 , so the 200th smallest permissible number is 11001004 =
20544 .

Example 7: [Catalan numbers] Let Cn denote the number of paths consisting of steps of 1 unit to the
right and 1 unit
 up starting at (0, 0) and ending at (n, n) that stay on or below the line y = x. Show that
1 2n
Cn = n+1 n .
Solution: Observe first that
             
1 2n 2n n 2n 2n n (2n)! 2n (2n)! 2n 2n
= − = − = − = −
n+1 n n n+1 n n n + 1 n!n! n (n − 1)!(n + 1)! n n−1

. It thus suffices to show that Cn = 2n 2n


argument, there are a total of 2n
  
n − n−1 . By a block-walking n
2n

paths from (0, 0) to (n, n); it is enough, then, to show that n−1 paths cross above the line y = x.
We claim that the paths from (0, 0) to (n, n) that cross above the line y = x biject to the paths from (0, 0)
to (n − 1, n + 1). We establish the bijection as follows: for each path from (0, 0) to (n, n) that crosses above
the line y = x, consider the first point with integer coordinates on the path that lies above this line - say,
(m, m + 1). Keep the portion of this path from (0, 0) to (m, m + 1) the same, but from (m, m + 1) onward,
change every right-step to an up-step and every up-step to a right-step. Because the original path from
(m, m + 1) to (n, n) has one more right-step than up-steps, the modified path will have one more up-step
than right-steps, and will therefore end at (n−1, n+1). Therefore each path from (0, 0) to (n, n) that crosses
above the line y = x corresponds to a unique path from (0, 0) to (n − 1, n + 1).
Furthermore, each path from (0, 0) to (n − 1, n + 1) corresponds to a unique path from (0, 0) to (n, n) that
crosses above the line y = x: for any path from (0, 0) to (n − 1, n + 1), consider the first point on the path
that lies above the line y = x (such a point must exist, because the path’s destination is above y = x). Keep
the portion of the path up to this point unchanged, and change each right-step thereafter to an up-step and
vice versa. The resulting path will be a path from (0, 0) to (n, n) that crosses above the line y = x.
Therefore the paths from (0, 0) to (n, n) that cross above the line y = x biject to the paths from (0, 0) to

3
Bijections High School North Math Club 2013-14
2n

(n − 1, n + 1), as claimed. By a block-walking argument, there are n−1 paths from (0, 0) to (n − 1, n + 1);
2n

therefore, there are n−1 paths from (0, 0) to (n, n) that cross above the line y = x, as desired.
Numbers of the form Cn are known as Catalan numbers, and these numbers have many applications in
combinatorics2 ; the first few Catalan numbers are 1,1,2,5,14,42,132,429.

4 Exercises
1. A number is called palindromic if it reads the same forward and backward. How many 6-digit palindromic
numbers are there?

2. How many ways can 6 people sit in a ring of 20 chairs if at least two empty seats must be between each
pair of people?

3. [St. Petersburg 1989] Tram tickets have six-digit numbers (from 000000 to 999999). A ticket is called
lucky if the sum of its first three digits is equal to that of its last three digits. A ticket is called medium
if the sum of all of its digits is 27. Let A and B denote the numbers of lucky tickets and medium tickets,
respectively. Find A − B.

4. How many nonnegative solutions (x1 , x2 , . . . , xm ) are there to x1 + x2 + · · · + xm ≤ n, in terms of m and


n?

5. How many divisors of 1060 are less than 1030 and do not divide 1030 ?

6. A partition of a positive integer n is a way of writing n as the sum of any number of positive integers in
which the order of the summands does not matter (for example, 7, 2 + 5, and 2 + 2 + 3 are all partitions of
7, but 2 + 5 and 5 + 2 are considered the same partition). Prove that the number of partitions of a number
n into any number of parts equals the number of partitions of 2n into exactly n (positive) parts.

7. Let S denote the set of powers of 9 from 90 to 94000 , inclusive. Given that 94000 ’s base-10 representation
begins with a 9 and has 3816 digits, determine the number of elements of S whose base-10 representations
begin with 9.

8. Prove that the number of partitions of a number into only odd parts equals the number of partitions of
the same number into distinct parts.

9. [OMO 2012-13] How many sequences of nonnegative integers a1 , a2 , . . . , an (n ≥ 1) are there such that
Qn−1
a1 · an > 0, a1 + · · · + an = 10, and i=1 (ai + ai+1 ) > 0?

10. [USAMO 1996] Let an be the number of n-digit strings of 0s and/or 1s in which no three consecutive
digits are 0, 1, 0, in that order. Let bn be the number of n-digit strings of 0s and/or 1s in which no four
consecutive digits are 0, 0, 1, 1, or 1, 1, 0, 0, in that order. Prove that bn+1 = 2an for all positive integers
n.

11. [USAJMO 2013] Each cell of an m × n board is filled with some nonnegative integer. Two numbers in
the filling are said to be adjacent of their cells share a common side (Note that two numbers in cells that
share only a corner are not adjacent). The filling is called a garden if it satisfies the following two conditions:
(i) The difference between any two adjacent numbers is either 0 or 1.
(ii) If a number is less than or equal to all of its adjacent numbers, then it is equal to 0.
Determine the number of distinct gardens in terms of m and n.

2 they count, for example, the number of balanced strings of n pairs of parentheses, the number of ways to triangulate a

convex n + 2-gon, and the number of ways to pair the vertices of a convex 2n-gon so that line segments connecting each pair
do not intersect

You might also like