• Tidak ada hasil yang ditemukan

ELEMENTARY COUNTING PRINCIPLES 59 Example 8

Pigeon-hole principle

2.2. ELEMENTARY COUNTING PRINCIPLES 59 Example 8

Show that in any sequence ofn integers, there is a subsequence of consecutive integers whose sum is exactly divisible by n.

Solution: We shall use the pigeon-hole principle to prove the result. Consider the sequence (a1, a2, . . . , an) of n integers and all of its possible n subsequences of consecutive integers (a1), (a1, a2), (a1, a2, a3), ,(a1, a2, . . . , an). Let s1, s2, . . . , sn be their respective sums, that is si = ∑i

j=1aj for 1 i n.

If one of the sis is divisible by n then we are done. So we may suppose thatno si is divisible byn (with remainder 0). Since the remainder 0 is excluded, the possible remainders of si’s when di- vided by nmust be among the integers 1,2, . . . , n−1.Since there arensums and onlyn−1 remainders, bythe pigeon-hole principle (identify the sums with letters and the remainders with the letter boxes) there are integerspand qwithp < q such that the sumssp and sq leave the same remainder r when divided by n. Therefore we can write: sq =bn+randsp =cn+r.By subtraction, we have sq−sp = (b−c)n. This means that, ap+1+· · ·+aq = (b−c)n, a multiple of n.

The following example shows that the decimal expansion of a rational number either terminates or repeats. For example, the decimal representation of 1/2 is 0.5, which terminates. On the other hand, the decimal representation of 1/3 is 0.333. . ., which repeats indefinitely. The decimal representation of 1/7 is 0.142857 where the bar indicates the repetition of the digits indefinitely.

More generally, ifx is any real number, then xcan be written as

x=n+ 0.d1d2d3. . . dk. . .

where n is an integer anddi is a digit with 0 di 9. To avoid ambiguity, we suppose that the sequence of digits doesn’t end with infinitely many 9s; this is because, for example, 0.5 = 0.4999. . . . The above representation ofx means that

n+ d1 10+ d2

102 +· · ·+ dk

10k ≤x < n+ d1 10+ d2

102 +· · ·+ dk 10k + 1

10k. In other words, dk is the largest digit satisfying the following in-

equality n+ d1

10+ d2

102 +· · ·+ dk

10k ≤xfor all integer k >0.

Example 2.2.9 (The decimal expansion of a rational number): Prove that the decimal expansion of a rational number a/b either terminates or repeats where a and b are positive integers.

Solution: By the Euclidean division algorithm, if we divide a by b we get the integer quotient q and the nonnegative integer remainderr, which is strictly less than the divisorb. Symbolically,

a=bq+r, with 0≤r < b

Ifr= 0, then the division process terminates and we havea/b =q, in which case the decimal expansion is q, which is a terminating one.

If not, since we have exhausted the digits of a, we bring down 0. Note that the digit that we bring down is always 0. We continue the division process after bringing down 0 at each step. We must obtain one of the remainders 0,1, . . . , b−1. If 0 is obtained after a finite number of divisions, then again the decimal expansion is a terminating one. If 0 is not obtained, then by the pigeon- hole principle after at most b steps one of the remainders must be repeated (since we are left with onlyb−1 possible remainders 1,2, . . . , b−1). If the remainder repeats, the entire division process repeats.

We shall prove the following interesting theorem due to Erd¨os and Szekeres which may be considered as a generalization of the pigeon-hole principle.

Theorem 2.2.1 (Erd¨os and Szekeres):

Consider any sequence of mn + 1 distinct integers (a) = (a1, a2, . . . , amn+1). Then either the sequence (a) contains a (strictly) decreasing subsequence of> m terms or the sequence (a) contains a (strictly) increasing subsequence of> n terms.

2.2. ELEMENTARY COUNTING PRINCIPLES 61 Proof. We shall prove the theorem by contradiction. Suppose the theorem is false.

Letli be the number of integers in a longest decreasing subse- quence of the given sequence (a) starting with the termai and let l+i be the number of integers in a longest increasing subsequence of the sequence (a) beginning with the integer ai.Since the theo- rem is assumed to be false, we have the inequalities: li ≤m and l+i ≤n for each i= 1,2, . . . , mn+ 1.

We shall establish an injective function from the set{a1, a2, . . ., amn+1} to the Cartesian product {1,2,· · · , m} × {1,2, . . . , n}. To define an injective function f, we associate to each integer ai the ordered pair (li , l+i ), that is,

f(ai) = (li , li+) for each i= 1,2, . . . , mn+ 1.

Since the theorem is assumed to be false,f is a function from the set{a1, a2, . . . , amn+1}to the Cartesian product {1,2,· · · , m} × {1,2, . . . , n}. We shall prove thatf is injective. We have to show that if ai ̸=aj then f(ai)̸=f(aj).

Consider two distinct integersai and aj withi < j. We distin- guish two cases:

Case 1: ai < aj.

By the definition of l+i and lj+, we have li+ > l+j and hence (li , l+i ) ̸= (lj , l+j ) (by the definition of equality of ordered n- tuples). That is, f(ai)̸=f(aj).

Case 2: ai > aj.

By the definition of li and lj, we have li > lj and hence (li , l+i ) ̸= (lj , l+j ) (by the definition of equality of ordered n- tuples). That is, f(ai)̸=f(aj).

Hence f is an injective function. But by theProposition 2.2.1, we have

|{a1, a2, . . . , amn+1}| ≤ |{1,2, . . . , m} × {1,2, . . . , n}|

That is,mn+ 1≤mn, a contradiction.

The number of functions from an n-element set to an m element set:

Theorem 2.2.2:

Let A and B be two sets with A = {1,2, . . . , n} and B = {1,2, . . . , m}. The number of functions from the set A to the setB is |B||A| =mn.

Proof. A function f from A to B can be viewed as an element of the Cartesian product Bn =

ntimes

z }| {

B ×B× · · · ×B (second interpreta- tion of functions). Hence the set of all functions from A to B is the set of all orderedn-tuples of elements of B. In particular, the number of functions fromAtoBis|Bn|=

n times

z }| {

|B| × |B| × · · · × |B|= mn.

Because of the above theorem, the set of all functions from a setA to a set B is denoted byBA.Symbolically,

BA ={f |f :A→B}.

A function from A to B is sometimes traditionally called a permutation with repetition of elements of B taken n at a time.

Herenis the number of elements of the domain set A. Ann-set is a set of n elements. An m-subset of a set A is a subset of A with exactlym elements.

Subtraction Rule:

Example 2.2.10 (Rule of subtraction):

Consider a biology class of 40 students in which 25 students are girls. Then the number of boys in the class is 4025 = 15. The rule of sum generalizes this simple example.

Fact 2.2.2.1:

LetS be a finite set and let A be a subset of S.Then the number of elements of the setS not in the subset A is

S\A=|S| − |A|.

2.2. ELEMENTARY COUNTING PRINCIPLES 63