mod6 - Module 6: Basic Counting Theme 1: Basic Counting...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Module 6: Basic Counting Theme 1: Basic Counting Principle We start with two basic counting principles, namely, the sum rule and the multiplication rule. The Sum Rule: If there are ¾, second set , Ò Ñ Ò½ objects in the disjoint (i.e., ½ , Ò¾ objects in the , and if the sets ½ ¾ are different objects in the first set for any Ñth set Ñ Ñ Ñ), then the total number of ways to ½ select an object from one of the set is Ò½ · Ò¾ · ¡ ¡ ¡ · Ò Ñ in other words, ½ ¾ ½ Ñ ¾ · · ¡¡¡ · Ñ The Multiplication Rule: Suppose a procedure can be broken into dered) stages, with Ò½ outcomes in the first stage, Ò Ñ Ñ successive (or- Ò¾ outcomes in the second stage, , outcomes in the Ñth stage. If the number of outcomes at each stage is independent of the choices in previous stages, and if the composite outcomes are all distinct, then the total procedure has Ò½ ¡ Ò¾ ¡ ¡ ¡ Ò Ñ different composite outcomes. Sometimes this rule can be phrased in terms of sets ½ Ñ as follows ½ ¢ ¾ ¢ ¡¡¡ ¢ Example 1: There are ¼ ½ Ñ students in an algebra class and ¡ ¼ ¾ ¡¡¡ Ñ students in a geometry class. How many different students are in both classes combined? This problem is not well formulated and cannot be answered unless we are told how many students are taking both algebra and geometry. If there is not student taking both algebra and geometry, then by the sum rule the answer is ¼ · . But let us assume that there are ¼ algebra and geometry. Then there are ¿¼ students only in algebra, ½¼ ¿¼ ½¼ students taking both students only in geometry, and students in both algebra and geometry. Therefore, by the sum rule the total number of students is ¿¼ · ¿¼ · ½¼ . ¼ Example 2: There are boxes in a postal office labeled with an English letter (out of acters) and a positive integer not exceeding ¼ ¾ English char- . How many boxes with different labels are possible? 1 The procedure of labeling boxes consists of two successive stages. In the first stage we assign ¾ different English letters, and in the the second stage we assign ¼ natural numbers (the second stage does not depend on the outcome of the first stage). Thus by the multiplication rule we have ¾ ¡ ¼ ¾¼ ¼ different labels. Example 3: How many different bit strings are there of length five? We have here a procedure that assigns two values (i.e., zero or one) in five stages. Therefore, by the multiplication rule we have ¾ ¿¾ different strings. Exercise 6A: How many binary strings of length are there that start with a ½ and end with a ¼? Example 4: Counting Functions. Let us consider functions from a set with Ñ elements to a set with Ò elements. How many such functions are there? We can view this as a procedure of successive Ñ stages with Ò outcomes in each stage, where the outcome of the next stage does not depend on the outcomes of the previous stages. By the multiplication rule there are Ò ¡ Ò ¡ ¡ ¡ Ò Ò Ñ functions. But, let us now count the number of one-to-one functions from a set of Ñ elements to the set Ò elements. Again, we deal here with a procedure of Ñ successive stages. In the first stage we can assign Ò values. But in the second stage we can only assign Ò ½ values since for a one-toof one function we are not allowed to select the value used before. In general, in the th stage we Ò · ½ elements at our disposal. Ò´Ò ½µ ¡ ´Ò Ñ · ½µ one-to-one functions. have only Thus by (a generalized) multiplication rule we have Let us now consider some more sophisticated counting problems in which one must use a mixture of the sum and multiplication rules. Example 5: A valid file name must be six to eight characters long and each name must have at least one digit. How many file names can there be? If Æ is the total number of valid file names and Æ ,Æ and Æ are, respectively, file names of length six, seven, and eight, then by the sum rule Æ Æ · Æ · Æ Let us first estimate Æ . We compute it in an indirect way using the multiplication rule together with the sum rule. We first estimate the number of file names of length six without the constraint that there must be at least one digit. By the multiplication rule there are ´¾ · ½¼µ ¿ file names. Now the number of file names that consists of only letters (no digits) is ¾ . We must subtract these since they are not allowed. Therefore (by the sum rule) Æ ¿ ¾ ½ ¼ In a similar way, we compute Æ ¿ 2 ¾ Æ ¿ ¾ so that finally Æ Æ · Æ · Æ ¾ ¿¼ ¿¿ ¼ The next example illustrates the inclusion-exclusion principle that we already mentioned in Module 2: For two sets (not necessary disjoint) and the following holds · since in · the part (1) is counted twice, therefore we must subtract it. Example 6: How many bit strings of length eight start with ½ or end with two bits ¼¼? We consider two tasks. The first one, constructing a string of length eight with the first bit equal to ½, can be done on ¾ ½¾ ways (by the multiplication rule after noticing that the first bit is set to be ½ and there are only seven “free” stages). In the second task we count the number of strings that end with ¼¼. Again, by the multiplication rule there are ¾ ¿¾ strings (since the last two stages are set to be ¼¼). By adding these two numbers we would over count since both cases occur twice in this sum. To get it right, let us estimate the number of strings that starts with ½ and end with ¼¼. By the multiplication rule we have ¾ such strings (since three stages are set to be fixed). Therefore, by the inclusion-exclusion rule we find ¾ ·¾ ¾ ½ ¼ that is, it is the sum of strings with the first bit set to ½ and the the last two bits set to ¼¼, minus the number of strings with the first first bit ½ and the last bits ¼¼. 3 Theme 2: The Pigeonhole Principle Surprisingly many complex problems in combinatorics can be solved by an easy to state and prove principle called the pigeonhole principle. The Pigeonhole Principle. If ·½ objects are placed into boxes, then there is at least one box containing two or more of the objects. This principle is easy to prove by contradiction. Assume to the contrary that all boxes have at most one object. Since there are boxes, we will end up with at most the assumption stating that we have · ½ objects, which contradicts objects. Example 7: Consider a set of ¾ English words. There must be at least two words that begin with the same letter, since there are only ¾ letters in the English alphabet. In some applications the following generalization of the pigeonhole principle is useful. Theorem 1 [Generalized Pigeonhole Principle] If Æ objects are placed into at least one box containing at least to Ü. Æ objects, where Ü boxes, then there is is the smallest integer larger or equal Proof. Let us assume contrary that all boxes contain at most Æ ½ objects. Then the total number of objects is at most ´ Æ ½µ ´ Æ · ½ ½µ Æ which is impossible. Example 8: Consider a group of ½¼¼ students. Among them there are at least 9 who were born in the same month. Indeed, by the generalized pigeonhole principle with Æ least ½¼¼ ½¾ ½¼¼ and ½¾ we have at people born in the same month. Finally, we discuss two more sophisticated examples of the pigeonhole principle. Lemma 1. Among any Ò · ½ positive integers not exceeding ¾Ò there must be an integer that divides one of the other integers from the set of Ò · ½ positive integers. Proof. Let the Ò · ½ integers be ½ ·½ . We represent every such an integer as Ò ¾ where as ¾¼ Õ Ò·½ ½ ¾ is a nonnegative integer and Õ is an odd integer. For example, if ¾ ¾ ¡ , while ½ ¼ ¾ ¡ ½ . Certainly, the integers Õ½ , then we can write ¾¼ Õ ·½ are odd integers smaller Ò than ¾Ò. Since there are only Ò odd integers smaller than ¾Ò, it follows from the pigeonhole principle that two of the odd integers among Ò · ½ must be the same. Assume that Õ to . Then ¾ Õ ¾ 4 Õ Õ Õ for not equal Clearly, either divides or vice versa since two ¾ ¾ ¾ . The proof is completed. Exercise 6B: Justify that in any set of Ò · ½ positive integers not exceeding ¾Ò there must be two that are relative prime (i.e., the greatest common divisor of both numbers is one). Example 9: Assume that in a group of six people, each pair of individuals consists of two friends or two enemies. We will show that there are either three mutual friends or three mutual enemies in the group. Indeed, let the group be labeled as and . Consider now the person labeled as . The remaining five people can be grouped into friends or enemies of (other than of ), there are either three or more who are friends of . Indeed, when a set of are at least them ¾ or ¿ . Of the five other people , or three or more than are enemies objects (persons) is divided into two groups (friends or enemies) there elements in one of these groups. Consider first the group of friends of . If any of these three individuals are friends, then these two and of three mutual friends. Otherwise, case of three enemies of , and . Call form the group form a set of three mutual enemies. The proof in the proceeds in a similar manner. This last example is an instance of an important part of combinatorics called Ramsey theory. In general, Ramsey theory deals with the distribution of subsets of elements of sets. 5 Theme 3: Permutations and Combinations In computer science one often needs to know in how many ways one can arrange certain objects (e.g., how many inputs are there consisting of ten digits?). To answer these questions, we study here permutations and combinations – the simplest arrangements of objects. A permutation of a set of distinct objects is an ordered arrangements of these objects. An ordered arrangements of Ö elements of a set is called an Ö -permutation. Example 10: Let Ë , , , and . Then , , , , , are ¾-permutations of Ë . are permutations of Ë , while It is not difficult to compute the number of Ö -permutations. Let permutations of a set with Ò distinct elements. , È ´Ò Öµ be the number of Ö- Observe that we can choose the first element in the Ö-permutation in Ò ways, the second element in ´Ò ½µ (since after selecting the first element we can not use it again in the second choice), and so on, finally choosing the Ö -th element in Ò Ö · ½ ways. Therefore, by the multiplication rule the total number of Ö -permutations is È ´Ò Öµ Ö Ò´Ò ½µ ¡ ´Ò ¾µ ¡ ¡ ¡ ´Ò Ö · ½µ ½ ¡ ¾ ¡¡¡ Above we use the product notation É Ò Ò ½ ½ ¼ ´ Ò µ (2) introduced in Module 2. Example 11: On how many ways one can construct a three digits number with all different digits (e.g., ½ ¾ is a legitimate digit but ¾¾¿ is not)? We recognize this problem as a ¿-permutation, therefore the answer is ½¼ ¡ ¡ . ¾¼ In an Ö -permutation the order of elements is important (e.g., is different than ), while in the Ö-combination is not. An Ö-combination of elements of a set is an unordered selection of Ö elements from the set (i.e., and are the same ¾-combinations). The number of Ö -combinations of a set with Ò distinct elements is denoted by ´Ò Ö µ or . Thus the number of Ö -permutations is equal to the number of Ö -combinations times numbers of permutations (within each combinations), that is, Ö Ò Ò Öµ ¡ Ö È ´Ò Ö µ since every Ö -combination leads to Ö Example 12: Let Ë ´ È ´Ö Öµ Ö-permutations. . Consider first ¾-combinations. We have the following ¾-combinations: that generate the following six ¾-permutations ´ µ ´ µ ´ µ ´ 6 µ ´ µ ´ µ From the previous formula we immediately obtain ´ È ´Ò Öµ Ò´Ò ½µ´Ò ¾µ ¡ ¡ ¡ ´Ò Ö · ½µ È ´Ö Ö µ Ö Ò´Ò ½µ´Ò ¾µ ¡ ¡ ¡ ´Ò Ö · ½µ´Ò Öµ Ö ´Ò Ö µ Ò Ö ´Ò Öµ Ò Öµ The first line above follows from the definition of Ö -permutations, while in the second line we multiply and divide by ´Ò Ö µ , and finally in the third line we observed that Ò´Ò ½µ´Ò ¾µ ¡ ¡ ¡ ´Ò Ö ·½µ´Ò Öµ Ò Ò´Ò ½µ´Ò ¾µ ¡ ¡ ¡ ´Ò Ö ·½µ¡´Ò Öµ¡´Ò Ö ½µ ¡ ¡ ¡ ¾¡½ In summary, we prove ´ Ò Öµ Ò Ö ´Ò Ö µ (3) Exercise 6C: In how many ways one can create a four-letter word with all distinct letters (we assume there are ¾ letters)? Ò Öµ was already introduced in Module 4 where we wrote An astute reader should notice that ´ it as: Ö ´ Ò Hereafter, we shall write ´ Ò Öµ Ò Ò Öµ for these numbers that are also called binomial coefficients or Newton’s coefficients. In Module 4 we proved several properties of these coefficients algebraically. We now re-prove them using counting or combinatorial arguments. In particular, in Lemma 2 of Module 2 we proved algebraically that ´ Ò Öµ ´ Ò ½ Öµ · ´ Ò ½ Ö ½µ (4) We now re-establish it using counting (combinatorial) arguments. In order to obtain all Ö -combinations Ò Öµ) we pick up one element from the set and put it aside. Call it Þ . Now we build all Öcombinations from the set Ë Þ of size Ò ½. Clearly, we have ´Ò ½ Ö µ such Ö -combinations. Let us now construct ´Ö ½µ-combinations from the set Ë Þ . We have ´Ò ½ Ö ½µ such combinations. After adding the element Þ to such combinations we still have ´Ò ½ Ö ½µ Ö combinations, each different than in the first experiment (i.e., without using Þ ). But combining these two Ö -combinations we obtain all possible Ö -combinations which is equal to ´Ò Ö µ. We proved (4). ( ´ In a similar fashion we can prove another identity established in Module 4, namely, Ò Ò Öµ Ò Öµ ´ ´ 7 Ò Öµ-combinations: is an Ö combination, then the corresponding ´Ò Ö µ-combination is Ë . Indeed, there is one-to-one correspondence between Ö -combinations and ´ if In Module 4 we also proved that Ò ¼ ´ Ò µ Ò ¾ We can re-establish it using counting arguments. Consider a set Ë of cardinality Ò. From Module 2 we know that there are ¾Ò subsets of Ë . The set of all subsets can be partitioned into subsets of size Ö , which are in fact Ö -combinations. There are Ò Öµ combinations and they must sum to all subsets, ´ Ò which is ¾ . Finally, we prove one new identity known as Vandermonde’s Identity: ´ Ñ · Ò Öµ Ö ´ ¼ Ñ Ö µ ´ Ò µ (In words, the number of Ö -combinations among Ñ · Ò elements is the sum of products of combi- nations out of Ò and Ö -combinations out of Ñ.) We use a counting argument. Suppose that there Ñ items in one set and Ò items in another set. The total number of ways to select Ö items from the union of these sets is ´Ñ · Ò Ö µ. Another way of doing the same, is to select items from the second set (we can do it in ´Ò µ ways) and Ö items from the first set (which can be done on ´Ñ Ö µ ways), where ¼ Ö. By the multiplication rule these two actions can be done in ´Ñ Ö µ ´Ò µ ways, hence the total number of ways to pick Ö elements is the sum over all , are and the Vandermonde identity is proved. 8 Theme 4: Generalized Permutations and Combinations In many counting problems, elements may be used repeatedly. For example, digits ¼ ½ may be used more than once to form a valid number; letters can be repeatedly used in words (e.g., SUCCESS). In the previous section we assumed that the objects were distinguishable, while in this section we consider the case when some elements are indistinguishable. Finally, we also explain how to count the ways to place distinguishable elements in boxes (e.g., in how many ways poker hands can be dealt to four players). Permutations with Repetition The are Ò permutations of Ò distinct (distinguishable) elements. But in how many ways we can obtain Ö -permutations when objects (elements) can be repeated? Example 13: How many words of characters can be created from ¾ English letters? Observe that we do allow repetitions, so that SUCCESS words but there are only ¾ ¾ is a valid word. By the multiplication rule we have ¡ ¡ ¡ ¡ ¡ ¡ ¾ ¾¿ ¾¾ ¾½ ¾¼ ¾ words with all different letters. We can formulate the following general result. Consider Ö -permutations of a set with Ò elements when repetition is allowed. The number of Ö -permutations of such a set (with repetitions allowed) is Ò Ö Indeed, we have Ö stages with Ò outcomes in each stage, hence by the multiplication rule the number of outcomes is ÒÖ . Combinations with Repetitions How many ways one can pick up (unordered) Ö elements from a set of Ò elements when repetitions are allowed? This is a harder problem, and we start with an example. Example 14: In a bag there are money bills of the following denominations: °½ °¾ ° °½¼ °¾¼ ° ¼ and °½¼¼ We are asked to select five bills. In how many ways we can do it assuming that the order in which the bills are chosen does not matter and there are at least five bills of each types? It is not ´ µ since we can pick up five bills of the same denomination. To solve this problem we apply an old combinatorial trick: We build an auxiliary device, that of a cash box with seven compartments, each one holding one type of bill. The bins containing the bills are separated by six dividers. Observe that selecting five bills corresponds to placing five markers (denoted usually as a star ) on the compartments holding the bills. For example, the following symbolic figure: 9 corresponds to the case when one °½ bill, three ° bills, and one °¾¼ bill are selected. Therefore, the number of ways to select five bills corresponds to the number of ways to arrange six bars (dividers) and five stars (markers). In other words, this amounts to selecting the position of the five stars from ½½( ) positions. But this can be done in · ´½½ ½½ µ ¾ ways. This is the number of selecting five bills from a bag with seven types of bills. In general, let us select Ö -combinations from a set of Ò elements when repetition of elements is allowed. We represent this problem as a list of Ò ½ bars and Ö stars. These Ò ½ bars are used to mark Ò cells (bins). We assume that the th cell contains a star whenever the th element occurs in the combination. For instance, a -combination of a set of four elements has three bars and six stars. In particular, corresponds to the combination containing exactly two of the first elements, none of the second element, one of the third element, and three of the fourth element of the set. In general, each different list containing Ò ½ bars and Ö stars corresponds to an Ö-combination of the set with Ò elements, when repetition is allowed. But the number of such lists is Ò ½ · Ö Öµ (5) ´ which is also the number of Ö -combinations from the set of Ò elements when repetitions is allowed. Example 15: How many solutions does the following equation ܽ · ܾ · Ü¿ · Ü have, where ܽ ܾ Ü¿ and Ü ½ are nonnegative integers? Here is a solution to this problem. We assume we have four types labeled ܽ ܾ Ü¿ and Ü . There are ½ items or units (since we are looking for an integer solution). Every time an item (unit) is selected it adds one to the type it picked it up. Observe that a solution corresponds to a way of selecting ½ items (units) from a set of four elements. Therefore, it is equal to ½ -combinations with repetition allowed from a set with four elements. Thus by (5) we have ´ · ½ solutions. (We recall that ´ ½ ½ µ Ò µ ´½ ½ µ Ò Ò ´ ´½ .) µ 10 ¿µ ½ ¡ ¡ ¡ ½ ¾ ¿ ½ ½ Permutations of Sets with Indistinguishable Objects When counting some care must be exercised to avoid counting indistinguishable objects more than once. Example 16: How many different strings can be made by reordering the letters of the word TOTTOS? If all letters in the word TOTTOS would be different, then the answer would be but then we would over count. To avoid it, we observe that there are positions. The letter Ì can be placed among these six positions in ´¿ ¾µ ´ ¿µ times, while the letter ways; finally Ë can be put in ´ ¿µ ´½ ½µ ´¿ ¾µ Ç can be placed in the remaining positions in ways. By the multiplication rule we have ¿ ´½ ½µ ½ ¿ ¿ ¾ ½ ½ ¼ ¼ ¿ ¾ ½ orderings, where we used the formula ´ Ò Ò ´Ò µ µ learned before. We can obtain the same result in a different way. Observe that there are letters, however, there are ¿ permutations in which permuting the letter there ¾ permutations of letter Ç that results in the same word. Ì permutations of six result in the same word; In summary, the number of different words is ¿ ¾ ½ as before. Let us now generalized the above example. Assume there are Ò objects with Ò½ indistinguishable objects of type 1, Ò¾ objects of type 2, , Ò indistinguishable objects of type . The number of different permutations are Ò Ò½ Ò¾ ¡¡¡Ò (6) There are many ways to prove this result. For example, we know that there Ò permutations, but many of these permutations are the same since we have many permutations are the same due to permutations of type 1, Ò¾ of type 2, classes of indistinguishable objects. How Ò½ indistinguishable objects. Obviously, there are Ò½ , Ò of type . Thus the result follows. such Balls-and-Urns Model Finally, we consider throwing Ò distinguishable balls (objects) into distinguishable urns (boxes). The combinatorial model will answer such questions as in how many ways five cards from a deck of ¾ cards can be distributed to four players. 11 Ò balls, and three boxes. We want to know in how many ways we can throw these Ò balls such that there are Ò½ balls in the first box, Ò¾ in the second box, and Ò¿ balls in the third box. Of course, there are ´Ò Ò½ µ of ways putting Ò½ balls from a set of Ò balls into the first box. For every such an arrangement, the remaining Ò Ò½ balls can be thrown in ´Ò Ò½ Ò¾ µ ways into the second box so that it contains Ò¾ balls. Finally, the last box will have Ò¿ balls on ´Ò Ò½ Ò¾ Ò¿ µ ways. Therefore, by the multiplication rule we have Consider the following example. There are Ò ´Ò Ò½ µ ´Ò Ò½ Ò¾ µ Ò½ ´Ò Ò½ µ Ò¾ ´Ò Ò½ Ò¾ µ Ò¿ ´Ò Ò½ Ò¾ Ò¿ µ Ò Ò½ Ò¾ Ò¿ In general, let Ò distinguishable objects be thrown into distinguishable boxes with Ò objects in Ò Ò½ µ ´Ò Ò½ Ò¾ µ ´Ò Ò½ Ò¾ Ò¿ µ ´ the th box, ½ ¾ . Then, generalizing our example, we obtain Ò Ò½ Ò¾ ¡ ¡ ¡ Ò ´Ò Ò½ Ò¾ ways to distribute these Ò objects among ¾ µ (7) boxes. Example 17: In how many ways we can distribute hands of deck of Ò cards to each of four players from the cards? We may represent this problem as throwing ¾ objects into four boxes each containing Thus the solution is ¾ ¿¾ since every hand has cards, and after the distribution of 12 ¡ cards there remain ¿¾ cards. cards. Theme 5: Linear Recurrences1 Consider the following problem, which was originally posed by Leonardo di Pisa, also known as Fibonacci, in the thirteenth century in his book Lieber abaci. A young pair of rabbits (one of each sex) is placed on an island. A pair of rabbits does not reproduce until they are 2 months old. After they are 2 month old, each pair of rabbits produces another pair each month. Denote of pairs of rabbits after Ò months, e.g. ½ ¾ ½ ¿ , ¾ , ¿ Ò the number , etc. (At the end of the first and second month there is only one pair, but at the end of the third, there is another one and at the end of the fourth once again, an additional one.) To find the number of pairs after Ò months we just ½ , and the number of newborn pairs, have to add the number of rabbits in the previous month, which equals the sequence ¾ , since each newborn pair comes from a pair at least 2 month old. Consequently, Ò Ò satisfies the recurrence relation ½ · Ò for Ò ¿ Ò together with the initial condition Ò ½ ½ ¾ Ò and ¾ and the initial condition uniquely determines the sequence ¾ Ò . Of course, this recurrence relation . It should be mentioned that these numbers ½ ½ ¾ ¿ ½¿ ¾½ ¿ are called Fibonacci numbers. Sometimes the initial conditions for the Fibonacci numbers are and ½ ½ ¼ ¼ (this has some theoretical advantages) but this causes just a shift of 1 in the index. Internet Exercise: Find on the internet two new applications of Fibonacci numbers and post a paragraph to the forum what you found out. The Fibonacci numbers occur in various counting problems. Example 18: Let Ò denote the number of binary strings of length Ò with the property that there are no two subsequent ones: ½ ¾ ¼ ½ ¾ ¿ ¼¼ ¼½ ½¼ ¿ ¼¼¼ ¼½¼ ¼¼½ ½¼¼ ½¼½ ¡¡¡ Again you can find a recurrence relation for ¡¡¡ Ò . If the last bit of a sequence of length Ò (of that kind) ½ possible ways for the first Ò ½ bits. However, if the last bit is 1 then the ´Ò ½µst bit has to be 0 and, hence, there are exactly ¾ possible ways for the first Ò ¾ is 0, then there are exactly Ò Ò 1 This material is more advanced and the student should take time to study it carefully. 13 ¿ letters. (For example, there are strings among which ¾ ¿ ends with ¼ and ½ ¾ with ½.) Consequently one obtains ½ · Ò for Ò ¾ Ò Ò . This is the same recurrence relation as for the Fibonacci numbers. Only the initial ¿ ½ condition is different: ¿ and ¾ . This implies a shift by two, that is, Ò for all Ò ½ Ò ·¾ . More generally we define: A linear homogeneous recurrence relation of degree with constant coefficients is a recurrence relation of the form ½ ½ · ¾ ¾ · ¡ ¡ ¡ · Ò where ½ ¾ Ò Ò are real numbers, and Ò . ¼ The recurrence relation is linear since the right-hand side is a sum of multiples of terms The recurrence relation is homogeneous since no terms occur that are not multiples of the coefficients are all constant, rather than functions that depend on Ò. The degree is expressed in terms of the previous Ò . s. The because Ò is terms of the sequence. It is clear (by induction) that a sequence satisfying the recurrence relation in the definition is uniquely determined by its recurrence relation and the ¼ ¼ ½ That is, once we set the first ½ initial conditions ½ ½ ½ values, then the next values for Ò can be computed from Ô the recurrence. Example 19: The recurrence relation degree one. The recurrence relation Ò ½ is a linear homogeneous recurrence relation of ½ · ¾ is a linear homogeneous recurrence relation is a linear homogeneous recurrence relation of ¾ Ò Ò Ò Ò of degree two. The recurrence relation Ò Ò Ò degree five. Example 20: The recurrence relation The recurrence relation is not a multiply of Ò ¾ ½ Ò ½ · ¾ ¾ is not linear because there is term ¾ ¾ . Ò ·½ Ò Ò Ò is linear but not homogeneous because of the term ½ (which Ò ). The recurrence relation Ò Ò ½ is linear but does not have constant Ò coefficients. Exercise 6D: Is the following recurrence Ò ½ · ´Ò ¾µ ¾ · Ò Ò 14 linear, homogeneous, with constant coefficients? The basic approach for solving linear homogeneous recurrence relations is to look for solutions of the form Ö Ò where Ö is a constant. ¾ ¾ · ¡ ¡ ¡ Ò Ò Note that Ö Ò Ò Ò is a solution of the recurrence relation Ò ½ ½ · Ò if and only if Ö ½ Ö ½ · ¾ Ö ¾ · ¡ ¡ ¡ · Ö Ò Ò Ò Ò When both sides of this equation are divided by Ö Ò and the right-hand side is subtracted from the left, we obtain the equivalent equation Ö Consequently, the sequence ½ Ö ½ ¾ Ö ¾ ¡ ¡ ¡ Ö Ò ½ Ö ¼ is a solution if and only if Ö is a solution of this last equation, Ò which is called the characteristic equation of the recurrence relation. The solutions of this equation are called the characteristic roots of the recurrence relation. As we will see, these characteristic roots can be used to give an explicit formula for all solutions of the recurrence relation. We will consider in details the case of degree and thus we will not stated. For form Ö ¾ ½ Ö ¾ ¾ . The general case is similar but more involved the characteristic equation is just a quadratic equation of the . We recall that the quadratic equation Ö ¾ ¼ ½¦ Ö½ ¾ if ¾ · ¾ ½ ¾ ¾ ¼; if ½ · ¾ ¼ Ô¾ ½Ö ¾ ¼ has two solutions ½· ¾ ¾ , then the equation has one solution Ö½ ½ ¾; otherwise there is no real solution to this equation. First, we consider the case when there are two distinct characteristic roots. Theorem 2. Let ½ and ¾ be real numbers. Suppose that Ö¾ ½ Ö ¾ and Ö¾ . Then the sequence Ò ¼ has two distinct roots Ö½ is a solution of the recurrence relation Ò ½ ½ · ¾ ¾ Ò Ò if and only if «½ Ö½ Ò Ò · «¾ Ö¾ Ò Ò (8) ¼ where «½ and «¾ are constants. Proof. We must do two things to prove the theorem. First, it must be shown that if Ö½ and Ö¾ are the roots of the characteristic equation, and «½ and «¾ are constants, then the sequence is a solution of the recurrence relation. Second, it must be shown that if the sequence then Ò «½ Ö½ Ò · «¾ Ö¾ Ò for some constants «½ and «¾ . 15 «½ Ö½ · «¾ Ö¾ Ò Ò Ò Ò is a solution, Now we will show that if «½ Ö½ · «¾ Ö¾ , then the sequence Ò Ò Ò Ò is a solution of the recurrence equation. We have ½ ´«½ Ö½ ½ · «¾ Ö¾ ½µ · ¾ ´«½ Ö½ ¾ · «¾ Ö¾ ¾ µ «½ Ö½ ¾ ´ Ö½ · ¾ µ · «¾ Ö¾ ¾ ´ Ö¾ · ¾ µ «½ Ö½ · «¾ Ö¾ ½ ½ · ¾ ¾ Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò Ò where the third lines is a consequence of the fact that since Ö½ and Ö¾ are roots of Ö ¾ ¾ then Ö½ ¾ ½ Ö½ · ¾ and Ö¾ ½ Ö¾ · ¾ . This shows that the sequence Ò with ½ Ö ¾ ¼, «½ Ö½ · «¾ Ö¾ is Ò Ò Ò a solution of the recurrence relation. To show that every solution Ò «½ Ö½ Ò · «¾ Ö¾ Ò Ò of the recurrence relation for some constants relation, and the initial conditions are «½ and «¾ so that the sequence Ò ¼ with ½ ½ · ¾ ¾ is of the form Ò Ò «½ and «¾ , suppose that Ò Ò is a solution of the recurrence ¼ and ½ ½ . It will be shown that there are constants «½ Ö½ · «¾ Ö¾ satisfies the same initial conditions. This Ò Ò Ò requires that ¼ ½ «½ · « ¾ «½ Ö½ · «¾ Ö¾ ¼ ½ We can solve these two equations for «½ and «¾ and get ½ ¼ Ö¾ Ö½ Ö¾ «½ and ¼ Ö½ ½ Ö½ Ö¾ where these expressions depend on the fact that Ö½ Ö¾ . (When Ö½ Ö¾ this theorem is not true.) Hence, with these values for «½ and «¾ , the sequence and the sequence «½ Ö½ · «¾ Ö¾ satisfy the «¾ Ò Ò ¼ Ò ½ . Since the recurrence relation and these initial conditions uniquely determine the sequence, it follows that «½ Ö½ · «¾ Ö¾ . two initial conditions ¼ and ½ Ò Ò Ò Example 21: We derive an explicit formula for the sequence of Fibonacci numbers defined by the ¾ with initial conditions ¼ ¼ and ½ ½. The characteristic equation of the Fibonacci recurrence is Ö ¾ Ö ½ ¼. Its solution is recurrence relation Ò Ò Ö½ ½ · Ò ½ · Ò Ô ½ · ½ · ¾ Ô Ö¾ and ¾ ½ ¾ Therefore, from (8) it follows that the Fibonacci numbers are given by Ò «½ ½ · Ô Ò · ¾ 16 «¾ ½ Ô Ô ¾ Ò for some constants «½ and «¾ . ¼ The initial conditions and ¼ ½ ½ can be used to find these constants. We have ¼ «½ · «¾ ½ «½ ½ · Ô ¼ · ¾ «¾ ½ Ô ½ ¾ The solution of these simultaneous equations is given by Ô «½ Ô «¾ ½ ½ Consequently, the Fibonacci numbers can be explicitly expressed as Ô ½ · ½ Ò Ô Ò ¾ Ô ½ ½ Ô Ò ¾ Now we discuss the case when the characteristic equation has only one root (e.g., Ö ¾ ¾Ö · ½ Ö ½µ¾ ). We shall omit the proof. ´ ¼ Theorem 3. Let the sequence Ò ½ and ¾ real numbers. Suppose that Ö¾ ½ Ö ¾ ¼ has only one root Ö¼ . Then is a solution of the recurrence relation ½ ½ · ¾ ¾ if and only if Ò «½ Ö¼ Ò Ò (for Ò ¼ · Ò Ò «¾ ÒÖ¼ Ò ), where «½ and «¾ are constants. Example 22: What is the solution of the following recurrence relation ½ Ò ¾ Ò ? ¼ ½ and ½ ¾ Ö· ¾ The only root of Ö ´Ö ¿µ Ò with initial conditions ¼ Ö is . Hence, the solution to this recurrence ¿ relation is «½ ¿ Ò Ò · «¾ Ò¿ Ò for some constants «½ and «¾ . Using the initial conditions, it follows that ¼ «½ ¿«½ · ¿«¾ ½ ½ Solving these two equations shows that «½ ½ and «¾ ½ . Consequently, the solution to this recurrence relation is Ò ¿ Ò · Ò¿ Ò 17 Ò Ò · ½µ ¿ ´ ...
View Full Document

This homework help was uploaded on 04/19/2008 for the course CS 182 taught by Professor W.szpankowski during the Fall '08 term at Purdue.

Ask a homework question - tutors are online