It is now time to delve into some of the mathematical underpinnings of combinatorics. The concept of relation plays a central role. Functions, equivalence relations, graphs, and partial orders are the main players that we will encounter in this book, and each is a different kind of relation. We begin with functions because they are the most familiar and they are closely related to the counting methods of Sections 1.1 and 1.2.
Counting via a bijection
In Section 1.1, we counted the possible subsets of the set Œ3 via the correspondence shown at the left of Figure 1.2. We counted the 5-digit binary numbers with exactly two 1s via the correspondence shown at the right.
In both cases the objects to count appear to the left of the arrows, and objects that we know how to count (because they are instances of standard counting problems) appear to the right. The correspondence on the left shows that there are exactly as many subsets of Œ3 as there are 3-digit binary numbers, namely 23. The correspondence on the right shows that there are exactly as many 5-digit binary numbers with exactly two 1s as there are 2-subsets of Œ5, namely 52.
Each of these correspondences is a kind of function called a bijection. They are useful in combinatorics because, as the two examples suggest, we can count the elements of a set Athat is difficult to count by
1.3. Functions and the bijection principle 25 ; ! 000 f1g ! 100 f2g ! 010 f3g ! 001 f1; 2g ! 110 f1; 3g ! 101 f2; 3g ! 011 f1; 2; 3g ! 111 11000 ! f1; 2g 10100 ! f1; 3g 10010 ! f1; 4g 10001 ! f1; 5g 01100 ! f2; 3g 01010 ! f2; 4g 01001 ! f2; 5g 00110 ! f3; 4g 00101 ! f3; 5g 00011 ! f4; 5g Figure 1.2.Two correspondences for counting.
finding another set B which is easier to count, and constructing a bijection from A to B.
This allows us to conclude that A and B have the same size. Though the two correspon- dences shown involve relatively intuitive or straightforward bijections, tougher problems call for more cleverness. As such, we need to understand the theory of functions pertinent to counting.
Relations and functions
In order to define a relation we first define the Cartesian product. For sets A and B, the Cartesian product ofA and Bis that set A B given by
A B D˚.a; b/W a 2 A and b 2 B :
For example, if AD f1; 2g and B D f˛; ˇ; g, then A B contains six ordered pairs: A B D˚.1; ˛/; .1; ˇ/; .1; /; .2; ˛/; .2; ˇ/; .2; / :
Question 27 What isB A? In general, if X and Y are finite sets, then are the following statements true or false? (1)X Y D Y X; (2) jX Y j D jY Xj.
Next we define relation.
Definition 1.3.1 (relation) Let A and B be sets. A relation from A to B is a subset of A B. A relation on A is a subset of A A.
A mere relation needn’t have very much structure. By imposing the following structure we obtain what we wish to study in this section—a function.
Definition 1.3.2 (function) LetA and B be sets. A function from A to B is a relation f from A to B that satisfies the following property: for each a 2 A, there is exactly one b2 B such that .a; b/ 2 f . We write f W A ! B to indicate that f is a function from A toB, and we write f .a/D b to mean .a; b/ 2 f .
You might consider a function to be an input-output rule like f .x/ D x2, not a set of ordered pairs. But this input-output rule means that each input x is associated with the
output x2. When you graph this function, you plot ordered pairs of the form .x; x2/such as .0; 0/, .0:5; 0:25/, .1; 1/, and .1:5; 2:25/. So from this point of view a function really is a set of ordered pairs as described in the definition.
For example, if A D f1; 2; 3; 4; 5g and Z is the set of integers, then the function f W A ! Z defined by the rule f .x/ D x2is the set of ordered pairs
f D˚.1; 1/; .2; 4/; .3; 9/; .4; 16/; .5; 25/ : (1.4) For example, .3; 9/2 f means f .3/ D 9.
Question 28 Defineg W 2Œ2 ! Z by the rule g.S/ D jSj, where S is any subset of Œ2. Writeg as a set of ordered pairs.
Domain, codomain, and range
If we have a function f W A ! B, then the set A is the domain of f and the set B is the codomain off. We write dom.f /D A and co.f / D B to indicate this. The range of f is that subset of B defined by
rng.f /WD fb 2 B W f .a/ D b for at least one a 2 Ag:
The range could equal the codomain but not necessarily. For example, if we define f W R ! R by f .x/ D x2, then this has dom.f / D co.f / D R while rng.f / is the set of nonnegative real numbers. The definition of function allows us to be careless with the codomain.
Examples
(a) If f is the function at the left of Figure 1.2, then the domain is the power set of Œ3 and the codomain is the set of 3-digit binary numbers. For any set S in the domain, the rule is f .S /D d1d2d3where diis 1 or 0 according to whether i 2 S or i 62 S, respectively.
(b) If g is the function at the right of Figure 1.2, then the domain is the set of 5-digit binary numbers containing exactly two 1s and the range is the set of 2-subsets of Œ5. For any binary number b in the domain, the rule is g.b/D fi; j g where i and j are the positions in which b has a 1.
(c) Let A be the set of 2-subsets of Œ5 and let B be the set of 3-subsets of Œ5. Then the function hW A ! B defined by the rule h.S/ D Sc is the function that associates each set in A with its complement, which is in B. For example, hf3; 4gD f1; 2; 5g. See Figure 1.3 for a picture of the function in part (c).
Question 29 LetX D 2Œ10and letY be the set of nonnegative integers. Define f W X ! Y by f .S /D jSj. Find f f3; 5; 6; 7; 8gandf .;/. Is rng.f / D Y ?
One-to-one, onto, and bijective functions
We next identify the properties of functions that are useful for counting. For a function f W A ! B, it is one-to-one provided that it “uses” every possible output in B at most once. It is onto provided that every possible output in B is “used” at least once. A bijection is a one-to-one and onto function.
1.3. Functions and the bijection principle 27 {1, 3} {1, 4} {1, 5} {2, 3} {2, 4} {2, 5} {3, 4} {1, 2} {3, 5} {4, 5} {2, 4, 5} {2, 3, 5} {2, 3, 4} {1, 4, 5} {1, 3, 5} {1, 3, 4} {1, 2, 5} {3, 4, 5} {1, 2, 4} {1, 2, 3}
Figure 1.3.Function from the 2-subsets of Œ5 to the 3-subsets of Œ5.
Definition 1.3.3 (one-to-one, onto, bijection) For a functionf W A ! B, we say f is a bijection or one-to-one correspondence providedf has both of the following properties.
One-to-one: For each a1; a22 A, if f .a1/D f .a2/, then a1D a2. Onto: For each b 2 B, there exists some a 2 A such that f .a/ D b.
A one-to-one function is also called an injective function or an injection. An onto func- tion is also called a surjective function or a surjection. Another way to define one-to-one function is with the contrapositive of the statement given in the above definition.
One-to-one, alternate version: For each a1; a22 A, if a16D a2, thenf .a1/6D f .a2/. This may seem more natural—it says that different inputs produce different outputs—but the original one is sometimes easier to use in proofs.
We have already seen three examples of bijections in Figures 1.2 and 1.3. Question 30 Is the functionf of Question 29 a bijection?
The bijection principle
Figure 1.4 shows a basic but important visual representation of four kinds of functions. It appears that when a function is a bijection the domain and codomain are equal in size. In fact, this is the mathematical definition of what it means for two sets to have the same size.
The bijection principle: Two finite setsA and B have the same size if and only if there exists a bijection from one set to the other.
Bijective proofs
We now have the theory that allows us to count using the method explained at the beginning of this section. To illustrate, we’ll use the bijection principle to prove the following two statements. A proof using the bijection principle is called a bijective proof.
The number of k-subsets of Œn equals the number of .n k/-subsets of Œn.
The number of subsets of Œn of odd size equals the number of subsets of Œn of even size.
function, neither one-to-one nor onto
1 2 3 1 2 3 4 1 2 3 one-to-one function, not onto 1 2 3 4 1 2 3 4 bijection 1 2 3 4 onto function, not one-to-one 1 2 3 1 2 3 4 5
Figure 1.4.Four kinds of functions.
The first statement says nk D n kn . This is intuitively clear: to specify a k-subset of Œnwe can choose the k elements to include or equivalently choose the n kelements to exclude. We’ll prove it using the bijection principle for the purposes of illustration. The second statement is perhaps less obvious.
Bijective proof #1
Figure 1.3 illustrates how the set complement function gives a bijection between the 2- subsets of Œ5 and the 3-subsets of Œ5. We now generalize this.
Let A be the set of k-subsets of Œn and let B be the set of .n k/-subsets of Œn. Define hW A ! B by the rule h.S/ D Sc. Note that S has size k so Sc has size n k, which means that this function is well defined. We prove that h is a bijection.
One-to-one:Assume S1and S2are two k-subsets of Œn satisfying S16D S2. It follows that there is some i satisfying i 2 S1and i 62 S2. Since i 2 S1, we know that i 62 h.S1/ because h is the set complement function. Also, since i 62 S2, we know that i 2 h.S2/. But this means h.S1/6D h.S2/since the element i is in h.S2/but not h.S1/. Therefore h is one-to-one.
Onto:Let T be an .n k/-subset of Œn. Our job is to find some k-subset S of Œn such that h.S /D T . Choosing S D Tcworks: T has size n kso Tchas size k, meaning that Tc 2 A. Moreover,
h.S /D h.Tc/D .Tc/c D T:
Therefore, h is onto. This completes the proof that h is a bijection. Therefore knD n kn
, because we know nkis the number of k-subsets of Œn and n kn is the number of .n k/- subsets of Œn.
1.3. Functions and the bijection principle 29
Bijective proof #2
Notice that there are as many even-sized subsets of Œ3 as there are odd-sized: even size ;, f1; 2g, f1; 3g, f2; 3g
odd size f1g, f2g, f3g, f1; 2; 3g The same is true for the even- and odd-sized subsets of Œ4:
even size ;, f1; 2g, f1; 3g, f1; 4g, f2; 3g, f2; 4g, f3; 4g, f1; 2; 3; 4g odd size f1g, f2g, f3g, f4g, f1; 2; 3g, f1; 2; 4g, f1; 3; 4g, f2; 3; 4g
This looks like it should be true in general. The question is whether there is a natural bijection between the sets. Here is one: if a set contains element 1, remove it; and if a set doesn’t contain element 1, add it.
Question 31 Draw a picture of the correspondence for the subsets ofŒ3, as described in the last sentence.
In general, let E and O be the set of even-sized and odd-sized subsets of Œn, respec- tively. Define f W E ! O by the rule
f .A/D (
A f1g if 1 2 A A[ f1g if 1 62 A.
First we observe that f is indeed well-defined because if A is any even-sized subset, then the size of f .A/ is eitherjAj 1orjAj C 1 and both of these numbers are odd.
One-to-one: Let A1 and A2 be even-sized subsets of Œn, and assume that f .A1/ D f .A2/. Our goal is to show that A1 D A2. We use the standard technique of showing that A1 A2and A2 A1.
To show A1 A2, let i 2 A1. We need to show i 2 A2, and we do so by considering two cases: i D 1 and i > 1. First, if i D 1 then
12 A1 H) 1 62 f .A1/ since f removes element 1
H) 1 62 f .A2/ since f .A1/D f .A2/by assumption H) 1 2 A2 since f removed element 1.
On the other hand, if i > 1 then
i2 A1 H) i 2 f .A1/ since f does not remove element i H) i 2 f .A2/ since f .A1/D f .A2/by assumption H) i 2 A2 since f did not remove element i . In either case i 2 A2and therefore A1 A2.
To show A2 A1, the details are similar; see the Question below. Therefore A1 D A2 and so f is one-to-one.
Question 32 Provide the details that proveA2 A1.
Onto:Let B be an odd-sized subset of Œn. We must construct an even-sized subset A of Œn such that f .A/D B. The idea is simple: if 1 2 B then define A WD B f1g, and if 162 B then define A WD B [ f1g. Notice that in either case A is an even-sized subset. Now, if 12 B then
and if 162 B then
f .A/D f B [ f1gD B [ f1g f1g D B:
In either case, f .A/ D B. Therefore f is onto. This completes the proof that f is a bijection. Therefore the number of even-sized subsets of an n-set equals the number of odd-sized subsets of an n-set.
Function composition
In the remainder of this section we mention two more ideas involving functions that will be useful in our later work. The first is function composition. For example, recall that the function h.x/D .x3 1/5is the composition of f .x/D x3 1and g.x/D x5because .gı f /.x/ D g f .x/D g x3 1D .x3 1/5.
Definition 1.3.4 (composition) For functionsf W A ! B and g W B ! C , the com- position off with g is that function gı f W A ! C defined by .g ı f /.a/ D g f .a/. For example, let f W Œ4 ! Œ3 and g W Œ3 ! Œ7 be defined by
f D˚.1; 2/; .2; 1/; .3; 1/; .4; 2/ gD˚.1; 2/; .2; 6/; .3; 6/ :
This means that gı f D˚.1; 6/; .2; 2/; .3; 2/; .4; 6/ because g f .1/D g.2/ D 6 and g f .2/D g.1/ D 2 and so forth.
Question 33 Is the compositionf ı g defined? Explain.
Inherited properties
The one-to-one and onto properties of functions are preserved under composition. Theorem 1.3.5 Letf W A ! B and g W B ! C . If f and g are both one-to-one, then so isgı f . If f and g are both onto, then so is g ı f . If f and g are both bijective, then so isgı f .
Proof:Assume f W A ! B and g W B ! C .
Assume that f and g are both one-to-one. To prove that gıf is one-to-one, let a1; a22 Aand assume that .gı f /.a1/D .g ı f /.a2/, i.e., g f .a1/D g f .a2/. Since g is one- to-one, this implies f .a1/ D f .a2/. Then since f is one-to-one, this implies a1 D a2. Therefore gı f is one-to-one.
The proof that g ı f is onto is left to you in the Question after the proof. It then immediately follows that gı f is bijective when f and g are bijective.
Question 34 Prove that iff and g are onto, then gı f is onto.
Function composition is associative
That function composition is an associative operation is an important property. In fact, the counting method that we study in Chapter 5 relies on this principle.
Theorem 1.3.6 Letf W A ! B, g W B ! C , and h W C ! D. Then h ı .g ı f / D .hı g/ ı f .
1.3. Functions and the bijection principle 31 Proof:Let f W A ! B, g W B ! C , and h W C ! D. First examine the function hı .g ı f /. Definition 1.3.4 shows that g ı f W A ! C , and then also that h ı .g ı f / W A ! D. Also by that definition, h ı g W B ! D and so .h ı g/ ı f W A ! D. This means that the two functions in question have equal domains and codomains.
Now let a2 A. On one hand, apply Definition 1.3.4 twice to show hı .g ı f /.a/D h .g ı f /.a/D hg f .a/: On the other hand,
.hı g/ ı f /.a/D .h ı g/ f .a/D hg f .a/:
Since hı .g ı f /.a/D .h ı g/ ı f /.a/for each a2 A, and since these two functions have the same domain and codomain, they must be equal.
Inverse relation, inverse function
The last concept we cover in this section is the inverse of a relation. To obtain the inverse of a relation we simply switch the order of the elements in each 2-list. If R is a relation from A to B, then the inverse of R is that relation R 1from B to A given by
R 1D˚.b; a/W .a; b/ 2 R :
Put another way, .a; b/2 R if and only if .b; a/ 2 R 1. Since every function is a relation, then the inverse of a function does not need a separate definition. Yet we must make one crucial point: the inverse of a function need not be a function.
Question 35 Is the inverse relation of the functionf shown in (1.4) on page 26 a function? If so, give the domain and codomain off 1as well as its input-output rule.
The best we can say is that if f W A ! B is a function from A to B, then f 1 is a relationfrom B to A. We now give a necessary and sufficient condition for f 1 to be a function.
Theorem 1.3.7 Iff is a function, then the inverse relation f 1is a function if and only if f is one-to-one. In that case,dom.f 1/D rng.f / and rng.f 1/D dom.f /.
See Exercise 7 for the proof.
This now gives us two slightly different methods for demonstrating that a function f W A ! B is bijective.
Prove that f is one-to-one and onto.
Prove that the inverse relation f 1is a function with domain equal to B.
Mathematical convenience dictates which one to use. You can tell when the second method is being used because it is often accompanied by the term “reversible.” Exercise 11 asks you to prove it without using Theorem 1.3.7.
Summary
If A is a set of objects that is difficult to count, and you suspect that there are as many ob- jects in A as there are in a different, easy-to-count set B, then the bijection principle might be of use. A bijection is a one-to-one and onto function, and the bijection principle says that two finite sets have the same size exactly when there is a bijection between them. Be- sides studying these ideas, we also examined function composition and the inverse relation of a function.
Exercises
1. The less-than relation on Œ4 is the set
RD˚.1; 2/; .1; 3/; .1; 4/; .2; 3/; .2; 4/; .3; 4/ :
In other words, .a; b/2 R if and only if a < b. It contains six ordered pairs. How many ordered pairs are in the less-than relation on Œn? How many are in the less- than-or-equal-to relation on Œn?
2. Define a relation R on Œ24 Œ24 where .a; b/ 2 R exactly when a is a factor of b. Write R as a set of ordered pairs.
3. How many different functions from Œ7 to Œ10 are there?
4. Given a set S , a function f W S S ! S is called a binary operation on S. If S is a finite set, then how many different binary operations on S are possible?
5. Give a bijective proof: The number of subsets of Œn equals the number of n-digit binary numbers. (This proves one fact suggested by Figure 1.2 on page 25.)
6. Give a bijective proof: The number of n-digit binary numbers with exactly k 1s equals the number of k-subsets of Œn. (This proves the other fact suggested by Figure 1.2 on page 25.)
7. Prove Theorem 1.3.7.
8. Prove: If f W A ! B is a bijection, then f 1is a bijection B ! A.
9. In Bijective Proof #1, prove that the set complement function is one-to-one using the property as stated in Definition 1.3.3 instead. Compare with the proof given in the text.
10. Suppose A and B are finite sets withjAj D jBj and that f W A ! B is a function. Prove: f is one-to-one if and only if f is onto.
11. Suppose that A and B are finite sets and that f W A ! B is a function. Prove without using Theorem 1.3.7: If the inverse relation f 1is a function with domain B, then f is a bijection. Also, do you need A and B to be finite sets?
12. Let E and O be the sets of even- and odd-sized subsets of Œn, respectively. If n is odd then the set complement function maps sets in E to sets in O. Is this a bijection? Prove or disprove.
13. This exercise outlines a bijective proof of the formula nkD kCn 1k from Section 1.1. Let A be the set of k-multisets taken from Œn and let B be the set of k-subsets of ŒkC n 1. Assume that the k-multisetfa1; a2; : : : ; akg is written in nondecreasing order: a16a26 6 ak. Define f W A ! B by
f fa1; a2; : : : ; akgD fa1; a2C 1; a3C 2; : : : ; akC k 1g: This function, and proof, is originally due to Euler.
(a) Prove that the outputs of f are indeed k-subsets of ŒkC n 1. This requires proof since it is not immediately clear from the definition of f .