Discrete Mathematics. Kishore Kothapalli
|
|
- Gerald Marshall
- 5 years ago
- Views:
Transcription
1 Discrete Mathematics Kishore Kothapalli
2 2
3 Chapter 4 Advanced Counting Techniques In the previous chapter we studied various techniques for counting and enumeration. However, there are several interesting problems that have applications to Computer Science that are not nown to have a solution using just the techniques from the previous chapter. In this chapter, we expand our repertoire of techniques to handle these more complicated problems. Some of the techniques we study in this chapter are the principle of inclusion-exclusion, using recurrence relations, and generating functions. 4.1 The Principle of Inclusion-Exclusion Recall the sum rule from the basic counting techniques. For a disjoint collection of choices, we said that the total number of ways will be a sum of the ways for each item in the disjoint collection. The sum rule was silent on what if the collection is not disjoint. To handle this situation, we need a refined sum rule, which is called as the principle of inclusion-exclusion. To start with, let us compute the size of the set A B for two sets A and B. If A B = Φ, we now that A B = A + B. However, using Venn diagrams, it can be seen that if A B Φ, then the elements of A B get counted twice in A + B. They get counted as they belong to A, and for the second time as they belong to B. So, to get A B, we have to discount A B from A + B. Thus, A B = A + B A B. The above formula can be generalized to what is called as the principle of inclusion-exclusion. For three sets A, B, and C, we have that: A B C = A + B + C A B B C C A + A B C. The intuitive explanation for this is as follows. In A + B + C, we count elements that occur in exactly one of A, B, C once, the elements that occur in exactly two of the sets are counted twice, and the elements that occur in all three sets are counted thrice. To compensate for the over count of the elements that occur in exactly two of the sets, we subtract the cardinality of the intersections taen two sets at a time. But, it has the effect that elements that occur in all the three sets are not counted at all. These were counted three times in A + B + C but were discounted three times because of ( A B + B C + A C. To account for this under-counting, we have to add A B C at the end. Thus, we get the above expression. In a similar manner, we can generalize the expression for A 1 A 2 A n as follows. Theorem (The Princple of Inclusion-Exclusion Let A 1, A 2,, A n be n finite sets. Then, A 1 A 2 A n = n i=1 A i 1 i<j n A i A j + 1 i<j< n A i A j A + ( 1 n+1 A 1 A 2 A n. 3
4 4 CHAPTER 4. ADVANCED COUNTING TECHNIQUES Proof. While a proof can be attempted using the principle of mathematical induction, following the flavor of the topic, we present a proof using combinatorics. We show the theorem by arguing that each element of A 1 A 2 A n is counted exactly once in the above formula. Consider an element x n i=1 A i. Let x belong to sets. Then, x is counted once in each of the sets, i.e., ( 1 times. It is discounted exactly ( ( 2 times during two-way intersections. It is then counted again for 3 times. So the number of times x is counted is: ( 1 ( + 2 ( ( + ( 1 n 3 Using nown identities about binomial coefficients, ( ( ( ( ( ( 1 n = So the above expression equals 1. Since the result is true for any x, and for any, the theorem holds Applications Another way to state the principle of inclusion-exclusion is to as for the number of elements in a set that do not have any of the properties P 1, P 2,, P n. Let N(P i1, P i2,, P i denote the number of elements that have all the properties P i1, P i2,, P i. Let the sets be A 1, A 2,, A n and let N be the total number of elements. We thus have that, N(P i1, P i2,, P i = A i1 A i2 A i It follows that we need to compute N(P 1, P 2,, P n which can be done as: N(P 1, P 2,, P n = N A 1 A 2 A n Applying the principle of inclusion-exclusion, we have: N(P 1, P 2,, P n = N A ( 1 A 2 A n = N 1 i n N(P i 1 i<j n N(P i, P j + + ( 1 n N(P 1 P 2 P n. There are several applications of the above formulation such as to the sieve of Eratosthenes, which we study below. Sieve of Eratosthenes The sieve of Eratosthenes is a procedure given by the Gree mathematician Eratosthenes to identify all primes not exceeding a certain positive integer n. The procedure starts by listing all the numbers 1 through n. Then, all the integers that are divisible by 2, except 2, are mared. Then, consider the smallest integer that is not mared, which is 3 in this case. Mar all integers that are divisible by 3, except 3. Continue this process of maring until no more integers can be mared. The unmared integers are the primes not exceeding n. Now, let us try to compute how many integers not exceeding n are prime. Notice that to see if any integer within n has any factors, then the factor is within n. Let n = 100. So we have to count the integers that are not divisible by any of 2, 3, 5, and 7. Let P i, for i = 1, 2, 3, and 4, denote the property that an integer is divisible by 2, 3, 5, and 7 respectively. We wish to compute 4 + N(P 1 P 2 P 3 P 4. Using the principle of inclusion-exclusion, we get: N(P 1 P 2 P 3 P 4 = n N(P 1 N(P 2 N(P 3 N(P 4 + N(P 1 P 2 + N(P 1 P 3 + N(P 1 P 4 + N(P 2 P 3 + N(P 2 P 4 + N(P 3 P 4 N(P 1 P 2 P 3 N(P 1 P 2 P 4 N(P 1 P 3 P 4 N(P 2 P 3 P 4 + N(P 1 P 2 P 3 P 4.
5 4.2. RECURRENCE RELATIONS 5 Now, N(P 1 = = 50, similarly, N(P 2 = = 33. N(P 2P 3 = 100/3 5 = 6. Computing other quantities similarly, we get that N(P 1P 2P 3P 4 = = 21. The above number indicates the number of integers between 1 through 100 that are not a divisor of any of 2,3,5, and 7. So, the total number of primes less than 100 is = 25. The list of these primes is 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, and 97. Derangements We now see another application of the principle of inclusion-exclusion to a classical problem in counting. Recall that a permutation of size n is a mapping of {1, 2,, n} to {π(1, π(2,, π(n}. A derangement of {1, 2,, n} is a permutation such that π(i i for all i {1, 2,, n}. Using the principle of inclusion exclusion, we can compute the number of derangements as follows. Let N(P i denote the number of permutations such that π(i = i. We wish to compute N(P 1 P 2 P n. We have, N(P 1P 2 P n = N N(P i + N(P ij + ( 1 n N(P 1 P 2 P n. 1 i n 1 i<j n Now, N(P 1 = (n 1! as fixing one place of the permutation, there is a n 1 permutation. Similarly, N(P i P j = (n 2!, and in general N(P i1 P i2 P im = (n m!. Thus, N(P 1 P 2 P n = N n(n 1! + ( ( n 2 (n 2! n 3 (n 3! + + ( 1 n ( n n (n n! = n! n(n 1! + n(n 1 2 (n 2! n(n 1(n 2 3! (n 3! + + ( 1 n = n! [ 1 1 1! + 1 2! 1 3! + + ( 1n 1 ] n! The number of derangements of n elements is represented by D n. So the above expression gives the value of D n for n 1. Noticing that e 1 = 1 1 1! + 1 2! 1 3! + + ( 1n 1 n!, we get that D n = n!/e. Other problems that can be solved using the principle of inclusion exclusion are counting the number of onto functions, the Euler totient function, etc. 4.2 Recurrence Relations Studying the spread of viruses has been an active topic for hundreds of years. It is nown that viruses can spread rapidly and cause new infections at a rapid rate. One can as the time by which the infected population reaches a million mar. To answer such a question, one needs to understand the rate of growth of the virus. Imagine an hypothetical scenario where for a certain ind of virus there are 3 infected people and the infection spreads to twice as many people every hour. To answer the original question, let us denote by a n the number of infected people by n minutes. So we are given that a 0 = 3, and we infer that a n = 2a n 1. Such a relation is called as a recurrence relation, a formal definition for which shall be given soon. Notice, however, that the above solution does not express a n in closed form, i.e., the value of a n for a given n is not nown yet. One has to solve the above recurrence relation to get the closed form value for a n. In this section, we will study how to represent counting problems as recurrence relations, and also how to solve recurrence relations. Consider a sequence a 0, a 1,, a n. A recurrence relation for the sequence is an equation that defines a n in terms of one or more of the previous element of the sequence, a 0, a 1,, a n 1, for all positive integers n n 0, where n 0 is a nonnegative integer.
6 6 CHAPTER 4. ADVANCED COUNTING TECHNIQUES The notion of a recurrence relation is an oft-occurring theme in Computer Science, especially in the analysis of (recursive algorithms. Specifically, one can express the complexity of a recursive algorithm in terms of the complexity of the algorithm on smaller instances. Let us loo at some examples of recurrence relations. The relations a n = 2a n 1 with a 0 = 3, that we obtained earlier, is an example. Example. Suppose you invest in a scheme where you pay Rs. 50, 000 every year over 10 years at an interest of 9% per annum, compounded annually. What is the return at the end of 10 years. Solution. To solve this problem, we first recall the basics of compound interest. If a principal of P is deposited and earns an interest of r% p.a. compounded annually, then at the end of the first year, the available amount is P + (Pr/100 = P(1 + (r/100. At the end of the second year, this increases to P(1 + r/100 + P(1 + r/100 r/100 = P(1 + r/ This can be generalized as follows. Let P(n denote the return at n years. Then, P(n = P(n 1 + P(n 1 r/100 = P(n 1(1 + r/100 In our problem, we can now see that the principal of Rs. 50, 000 will now be 50, 000 ( = 1, 18, 000 at the end of 10 years. Another example that traces a classical problem is that of the growth rate of a colony of rabbits. The problem is introduced by Fibonacci. Example. Suppose that a young pair of rats is placed in a colony Solving Recurrence Relations Let us now focus on how to solve recurrence relations. Here, we develop solution techniques by identifying classes of recurrence relations. Linear Homogeneous Recurrence Relations with Constant Coefficients A class of recurrence relations that are easy to solve is the linear recurrence relations that are homogeneous in nature with constant coefficients. A recurrence relation is said to be linear if the relation has only a sum of the previous terms. It is called homogeneous if all terms in the recurrence relation are of linear multiples of previous terms. The phrase Constant Coefficients refers to the condition that the coefficients are all constants, and not functions that depend on n. A formal definition is given below. Definition A recurrence relation of the form a n = c 1 a n 1 + c 2 a n c 1 a 1 + c 0 a 0 is called a linear homogeneous recurrence relation with constant coefficients of degree, where all c i IR and c 0. An example of a linear homogeneous recurrence relation with constant coefficients is a n = 3a n 1 + 5a n 2. This has a degree of 2. Notice that according to the above definition, the equation a n = a n 1 + n is not a linear homogeneous recurrence relation with constant coefficients. (It is not homogeneous. We show the following theorem that can be used to solve recurrence relations of the above ind.
7 4.2. RECURRENCE RELATIONS Solving Recurrence Relations Let us study a solution for solving linear homogeneous recurrence relations with constant coefficients. Let a n = c 1 a n 1 + c 2 a n c a n be a recurrence relation. We guess that a n = r n is a solution to the above recurrence relation if and only if r is a solution to the equation r c 1 r 1 c 2 r 2 c = 0. The above polynomial equation in r (of degree is called the characteristic equation of the recurrence relation. The solutions of this equation are called the characteristic roots of the recurrence relation. To show the above, we prove the theorem below. Theorem Let a n = c 1 a n 1 + c 2 a n c a n be a recurrence relation with c 1, c 2,, c be real numbers. Let the equation r c 1 r 1 c 2 r 2 c have distinct roots r 1, r 2,, r. Then, the recurrence relation has solution a n = α 1 r n 1 + α 2r n α r n for n 0 where α 1, α 2,, α are constants. Proof. We will first show that a n = α 1 r1 n + α 2r2 n + + α r n is a solution to the given recurrence relation. For this, note that as r 1, r 2,, r are roots of r c 1 r 1 c 2 r 2 c = 0, we have that ri n = c 1 ri n 1 + c 2 ri n c for i = 1, 2,,. Thus, c 1 a n 1 + c 2 a n c a n = c 1 (α 1 r1 n 1 + α 2 r2 n α r n 1 c 2 (α 1 r1 n 2 + α 2 r2 n α r n c (α 1 r1 n + α 2 r2 n + + α r n = α 1 (c 1 r1 n 1 + c 2 r1 n c r1 n + α 2 (c 1 r2 n 1 + c 2 r2 n c r2 n + + α (c 1 r n 1 + c 2 r n 2 = α 1 r1 n + α 2r2 n + + α r n + + c r n Now, we show that if the sequence {a n n 0} is a solution to the above recurrence relation, then also a n = α 1 r1 n + α 2r2 n + + α r n is a solution. This is done by establishing that there exist constants α 1, α 2,, α so that {a n } agrees with a n = α 1 r1 n + α 2r2 n + + α r n. Since the sequence {a n} n 0 satisfies the given recurrence relation, we have: C i = a i for i = 1, 2,, If a n = α 1 r n 1 + α 2r n α r n is a solution, then we must have that: α 1 + α α = C 0 α 1 r 1 + α 2 r α r = C 1 α 1 r1 2 + α 2r α r 2 = C 2 α 1 r1 1 + α 2 r α r 1 = C The above system of equations can be solved for α i, for i = 1, 2,,, by representing the above equations in the following matrix form α 1 C 0 r 1 r 2 r 3 r α 2 C 1 r1 2 r2 2 r3 2 r 2 α 3 = C 2. r1 1 r2 1 r3 1 r 1. α. C
8 8 CHAPTER 4. ADVANCED COUNTING TECHNIQUES The above system of equations has a unique solution as the matrix is a form of matrix called the Vandermonde matrix. It is however required that the roots of the characteristic equation r 1, r 2,, r are unique. Let us now loo at the following examples that illustrate the usage of theorem. Example. Consider the recurrence relation corresponding to the Fibonacci series F n = F n 1 + F n 2 with F 0 = 0 and F 1 = 1. Find a solution for F n. Solution. The characteristic equation for the recurrence relation given is r 2 r 1 = 0. The characteristic roots are r = 1± So the roots are r 1 = and r 2 = ( n ( So the solution to the given recurrence relation is of the form a n = α n, α2 2 for two constants α 1, α 2. We find ( α 1 and α 2 as follows. Since F 0 = 0, we have that α 1 + α 2 = 0. Similarly, since F 1 = 1, we ( have, α α Another example is given below. Example. Consider the recurrence relation a n = 3a n 1 2 n 2 with a 0 = 1 and a 1 = 2. The solution for this recurrence realtion can be obtained as follows. Solution. The characteristic equation for the given recurrence relation is r 2 3r + 2. The roots of this equation are r = 1 and r = 2. So, the solution is of the form a n = α 1 1 n + α 2 2 n for some constans α 1 and α 2. To find α 1, α 2, we note that a 0 = 1 = α 1 + α 2 and similarly, a 1 = 2 = α 1 + 2α 2. Solving, we get α 1 = 0 and α 2 = 1. Thus, a n = 2 n for n 0. Example. Consider the towers of Hanoi problem. There are three towers named Tower1, Tower2, and Tower3. On Tower1 n diss are placed so that the largest dis is on the bottom, the second largest is on top it, so on, till the smallest dis at the top. The goal is to arrange the n diss in the same order on Tower3 with the condition that a larger dis cannot be placed on top of a smaller dis at any time. What is the number of moves required for this rearrangement. Solution. While the exact number of moves is not nown, one solution is as follows. Suppose we move the n 1 diss, except the largest dis, onto Tower2. This can be done in a n 1 moves Solving Linear Nonhomogenous Recurrence Relations with Constant Coefficients A Master Theorem A particular ind of recurrence relations that occur often in analysis of algorithms, especially the divide and conquer ind of algorithms. Consider recurrence relations of the form T(n = at(n/b + f(n, where a, b are constants. Theorem (Masters Theroem Let a 1, b > 1 be constants and f(n be a function. Let T(n be defined as T(n = at(n/b + f(n Then T(n can be bounded as follows.
9 4.3. GENERATING FUNCTIONS 9 1. If f(n = O(n log a b ǫ for some constant ǫ > 0, then T(n = O(n log a b. 2. If f(n = Θ(n log a b then T(n = Θ(n log a b log n. 3. If f(n = Ω(n log a b+ǫ for some constant ǫ > 0, and if af(n/b cf(n for some constant c < 1 all all sufficiently large n then T(n = Θ(f(n. 4.3 Generating Functions Another important tool in counting is the use of generating functions. When using generating functions, we encode the values of a sequence as the coefficients of powers of a variable x in a formal power series. This helps us in manipulating the formal series to find answers about the counting problem. Generating functions can be used to also solve for recurrence relations. Definition Given a sequence a 0, a 1, a 2,,, of real numbers we define the generating function for the sequence as the infinite series G(x = a 0 + a 1 x + a 2 x 2 + = a x When the sequence is finite, so that a = 0 for n + 1 for some integer n, the generating function reduces to the polynomial a 0 + a 1 x + + a n x n of degree n. While using generating functions, and manipulating them to solve counting problems, one often ignores the convergence properties or uniqueness of the infinite series. Some examples of in order. Example. If a n = (1.11 n, then the generating function is G(x = =0 (1.11n x n. Example. For the sequence a = ( m for m, being positive integers, and 0 m, the generating function has the form (1 + x m. 1 Example. Since 1 x = 1 + x + x2 + x 3 +, G(x = 1 1 x is the generating function for the series 1, 1, 1,,. Notice however that the above expansion is valid for x < 1. We now define operations on generating functions that can be useful when applying them to counting problems or when proving combinatorial identities. Definition Let F(x = i=0 a ix i and G(x = i=0 b ix i be two generating functions. Then, the generating function H(x = F(x + G(x is defined as =0 H(x = (a i + b i x i i=0 and the generating function K(x = F(x G(x is defined as i K(x = a j b i j x i i=0 j=0
10 10 CHAPTER 4. ADVANCED COUNTING TECHNIQUES To be able to apply generating functions to certain couting problems, we need to expand the binomial coefficients as follows. For n, positive integers and 0 n, we now that ( n = n!!(n!. We now extend the definition to ( x for x IR and a nonnegative integer as: ( { x x(x 1(x 2 (x +1 =! if > 0, 1 = 0. The above extension applies to also x being negative and fractional. For example, ( 1/2 (1/2(1/2 1(1/2 2 (1/2 + 1 =! Similalry, ( n = ( n( n 1( n 2 ( n +1! = ( 1 n(n+1(n+2 (n+ 1! = ( 1 (n+ 1(n+ 2 n! = ( 1 ( n+ 1 The above results can be used to define an extended binomial theorem. Theorem For x IR and x < 1, and u IR, (1 + x u = =0 ( u x Notice that for u being a positive integer, since ( u = 0 for > u, the extended binomial theorem reduces to the standard binomial theorem in this case. Finally, we apply generating functions to solve the following counting problems. Example. One of the typical counting problems is to find the number of integral solutions to an equation of the form x 1 + x n = n satisfying certain mild constraints on the x i s. When x i 0, we now that the solution is ( +n 1. If the constraints are nontrivial such that xi n i, we can use generating functions to solve the problem as follows. Solution. Let us consider = 3 and n = 20. Then we claim that the number of integral solutions that satisfy 2 x 1 8, 1 x 2 6, and 4 x 3 15, is the coefficient of x 20 in the expansion of (x 2 +x 3 + +x 8 (x+x 2 + +x 6 (x 4 +x 5 + +x 15. The argument is as follows. In the expansion, a term of x 20 is obtained by taing the sum of three integers i 1, i 2, and i 3 such that i 1 + i i 3 = 20. Moreover i 1 is the power of the term x i 1 in the first sum, i 2 is the power of the term x i 2 in the second sum, and similarly using x i 3 from the third sum. While the earlier method of solving this problem did not give us an easy way to place such constraints, using generating functions allows us the ability to deal with complex constraints. If we specify no constraints apart from x i 0 for all i, we notice that the solution to x 1 + x x = n is the coefficient of x n in the expansion of (1 + x + x 2 +. Now, ( n (1 + x + x 2 + = 1 1 x = (1 x = ( i=0 i ( x i = = i=0 i=0 ( 1i( +i 1 ( i +i 1 i x i ( x i
11 4.3. GENERATING FUNCTIONS 11 So, the number of solutions to x 1 + x x n = is ( +n 1 n. The example below illustrates using generating functions to solve recurrence relations. Example. Consider the following recurrence relation with B(0 = 1. Solve for B(n. n 1 B(n = B(iB(n i 1 i=0 Solution. Let B(x = i 0 b ix i be the generating function for B(n. Then, the recurrence relation gives us that xb 2 (x = B(x 1. Solving for B(x gives us: B(x = 1 1 4x 2x The other possibility that B(x = x/2x can be ignored given that by convention we set B(0 = 1. It remains to simplify the above expression. Using binomial theorem for non-integral coefficients, we have that ( 1 ( 1/2 n 0 n ( 4x n = n 0 ( 1 n 2 2n+1 x m B(x = 1 2x ( 1/2 n+1 Thus, equating the coefficient of x m in both sides, we have that B(n = ( 1/2 n+1 ( 1 n 2 2n+1. On simplification, ( 1/2 (1/2(1/2 1(1/2 2 (1/2 n = = ( 1n (2n 1 n + 1 (n + 1! 2 n (n + 1! Finally, B(n = (2n 1 (n+1! 2 2n+1. On multiplying and dividing by n! we get that B(n = (2n! n!n! 1 n+1.
Advanced Counting Techniques. Chapter 8
Advanced Counting Techniques Chapter 8 Chapter Summary Applications of Recurrence Relations Solving Linear Recurrence Relations Homogeneous Recurrence Relations Nonhomogeneous Recurrence Relations Divide-and-Conquer
More information1 Basic Combinatorics
1 Basic Combinatorics 1.1 Sets and sequences Sets. A set is an unordered collection of distinct objects. The objects are called elements of the set. We use braces to denote a set, for example, the set
More informationare the q-versions of n, n! and . The falling factorial is (x) k = x(x 1)(x 2)... (x k + 1).
Lecture A jacques@ucsd.edu Notation: N, R, Z, F, C naturals, reals, integers, a field, complex numbers. p(n), S n,, b(n), s n, partition numbers, Stirling of the second ind, Bell numbers, Stirling of the
More informationAdvanced Counting Techniques
. All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Advanced Counting
More informationPRIME NUMBERS YANKI LEKILI
PRIME NUMBERS YANKI LEKILI We denote by N the set of natural numbers: 1,2,..., These are constructed using Peano axioms. We will not get into the philosophical questions related to this and simply assume
More informationBasic counting techniques. Periklis A. Papakonstantinou Rutgers Business School
Basic counting techniques Periklis A. Papakonstantinou Rutgers Business School i LECTURE NOTES IN Elementary counting methods Periklis A. Papakonstantinou MSIS, Rutgers Business School ALL RIGHTS RESERVED
More informationAsymptotic Analysis and Recurrences
Appendix A Asymptotic Analysis and Recurrences A.1 Overview We discuss the notion of asymptotic analysis and introduce O, Ω, Θ, and o notation. We then turn to the topic of recurrences, discussing several
More informationSolving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 =
Solving Recurrence Relations 1. Guess and Math Induction Example: Find the solution for a n = 2a n 1 + 1, a 0 = 0 We can try finding each a n : a 0 = 0 a 1 = 2 0 + 1 = 1 a 2 = 2 1 + 1 = 3 a 3 = 2 3 + 1
More informationBinomial Coefficient Identities/Complements
Binomial Coefficient Identities/Complements CSE21 Fall 2017, Day 4 Oct 6, 2017 https://sites.google.com/a/eng.ucsd.edu/cse21-fall-2017-miles-jones/ permutation P(n,r) = n(n-1) (n-2) (n-r+1) = Terminology
More informationRecurrence Relations
Recurrence Relations Winter 2017 Recurrence Relations Recurrence Relations A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms
More informationThe Inclusion Exclusion Principle
The Inclusion Exclusion Principle 1 / 29 Outline Basic Instances of The Inclusion Exclusion Principle The General Inclusion Exclusion Principle Counting Derangements Counting Functions Stirling Numbers
More informationApplications. More Counting Problems. Complexity of Algorithms
Recurrences Applications More Counting Problems Complexity of Algorithms Part I Recurrences and Binomial Coefficients Paths in a Triangle P(0, 0) P(1, 0) P(1,1) P(2, 0) P(2,1) P(2, 2) P(3, 0) P(3,1) P(3,
More informationLecture 4: Probability and Discrete Random Variables
Error Correcting Codes: Combinatorics, Algorithms and Applications (Fall 2007) Lecture 4: Probability and Discrete Random Variables Wednesday, January 21, 2009 Lecturer: Atri Rudra Scribe: Anonymous 1
More informationSome Review Problems for Exam 3: Solutions
Math 3355 Spring 017 Some Review Problems for Exam 3: Solutions I thought I d start by reviewing some counting formulas. Counting the Complement: Given a set U (the universe for the problem), if you want
More informationChapter Generating Functions
Chapter 8.1.1-8.1.2. Generating Functions Prof. Tesler Math 184A Fall 2017 Prof. Tesler Ch. 8. Generating Functions Math 184A / Fall 2017 1 / 63 Ordinary Generating Functions (OGF) Let a n (n = 0, 1,...)
More informationDiscrete Mathematics & Mathematical Reasoning Chapter 6: Counting
Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting Kousha Etessami U. of Edinburgh, UK Kousha Etessami (U. of Edinburgh, UK) Discrete Mathematics (Chapter 6) 1 / 39 Chapter Summary The Basics
More informationPart IA. Numbers and Sets. Year
Part IA Year 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 2003 2002 2001 2017 19 Paper 4, Section I 1D (a) Show that for all positive integers z and n, either z 2n 0 (mod 3) or
More informationMethods for solving recurrences
Methods for solving recurrences Analyzing the complexity of mergesort The merge function Consider the following implementation: 1 int merge ( int v1, int n1, int v, int n ) { 3 int r = malloc ( ( n1+n
More informationSome Review Problems for Exam 3: Solutions
Math 3355 Fall 018 Some Review Problems for Exam 3: Solutions I thought I d start by reviewing some counting formulas. Counting the Complement: Given a set U (the universe for the problem), if you want
More informationWhat you learned in Math 28. Rosa C. Orellana
What you learned in Math 28 Rosa C. Orellana Chapter 1 - Basic Counting Techniques Sum Principle If we have a partition of a finite set S, then the size of S is the sum of the sizes of the blocks of the
More informationAlgorithms: Background
Algorithms: Background Amotz Bar-Noy CUNY Amotz Bar-Noy (CUNY) Algorithms: Background 1 / 66 What is a Proof? Definition I: The cogency of evidence that compels acceptance by the mind of a truth or a fact.
More informationCSC2100B Data Structures Analysis
CSC2100B Data Structures Analysis Irwin King king@cse.cuhk.edu.hk http://www.cse.cuhk.edu.hk/~king Department of Computer Science & Engineering The Chinese University of Hong Kong Algorithm An algorithm
More informationDiscrete Mathematics -- Chapter 10: Recurrence Relations
Discrete Mathematics -- Chapter 10: Recurrence Relations Hung-Yu Kao ( 高宏宇 ) Department of Computer Science and Information Engineering, National Cheng Kung University First glance at recurrence F n+2
More informationSection 11.1 Sequences
Math 152 c Lynch 1 of 8 Section 11.1 Sequences A sequence is a list of numbers written in a definite order: a 1, a 2, a 3,..., a n,... Notation. The sequence {a 1, a 2, a 3,...} can also be written {a
More informationTopics in Algorithms. 1 Generation of Basic Combinatorial Objects. Exercises. 1.1 Generation of Subsets. 1. Consider the sum:
Topics in Algorithms Exercises 1 Generation of Basic Combinatorial Objects 1.1 Generation of Subsets 1. Consider the sum: (ε 1,...,ε n) {0,1} n f(ε 1,..., ε n ) (a) Show that it may be calculated in O(n)
More informationChapter 11 - Sequences and Series
Calculus and Analytic Geometry II Chapter - Sequences and Series. Sequences Definition. A sequence is a list of numbers written in a definite order, We call a n the general term of the sequence. {a, a
More information6 CARDINALITY OF SETS
6 CARDINALITY OF SETS MATH10111 - Foundations of Pure Mathematics We all have an idea of what it means to count a finite collection of objects, but we must be careful to define rigorously what it means
More informationCDM Combinatorial Principles
CDM Combinatorial Principles 1 Counting Klaus Sutner Carnegie Mellon University Pigeon Hole 22-in-exclusion 2017/12/15 23:16 Inclusion/Exclusion Counting 3 Aside: Ranking and Unranking 4 Counting is arguably
More informationRecursion: Introduction and Correctness
Recursion: Introduction and Correctness CSE21 Winter 2017, Day 7 (B00), Day 4-5 (A00) January 25, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Today s Plan From last time: intersecting sorted lists and
More informationIndistinguishable objects in indistinguishable boxes
Counting integer partitions 2.4 61 Indistinguishable objects in indistinguishable boxes When placing k indistinguishable objects into n indistinguishable boxes, what matters? We are partitioning the integer
More informationGenerating Functions
Generating Functions Karen Ge May, 07 Abstract Generating functions gives us a global perspective when we need to study a local property. We define generating functions and present its applications in
More informationProblem 1: Suppose A, B, C and D are finite sets such that A B = C D and C = D. Prove or disprove: A = B.
Department of Computer Science University at Albany, State University of New York Solutions to Sample Discrete Mathematics Examination III (Spring 2007) Problem 1: Suppose A, B, C and D are finite sets
More informationPart III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES
CS131 Part III, Sequences and Series CS131 Mathematics for Computer Scientists II Note 16 RECURRENCES A recurrence is a rule which defines each term of a sequence using the preceding terms. The Fibonacci
More information{ 0! = 1 n! = n(n 1)!, n 1. n! =
Summations Question? What is the sum of the first 100 positive integers? Counting Question? In how many ways may the first three horses in a 10 horse race finish? Multiplication Principle: If an event
More informationPractical Session #3 - Recursions
Practical Session #3 - Recursions Substitution method Guess the form of the solution and prove it by induction Iteration Method Convert the recurrence into a summation and solve it Tightly bound a recurrence
More informationALL TEXTS BELONG TO OWNERS. Candidate code: glt090 TAKEN FROM
How are Generating Functions used in finding the closed form of sequences involving recurrence relations and in the analysis of probability distributions? Mathematics Extended Essay Word count: 3865 Abstract
More informationNamed numbres. Ngày 25 tháng 11 năm () Named numbres Ngày 25 tháng 11 năm / 7
Named numbres Ngày 25 tháng 11 năm 2011 () Named numbres Ngày 25 tháng 11 năm 2011 1 / 7 Fibonacci, Catalan, Stirling, Euler, Bernoulli Many sequences are famous. 1 1, 2, 3, 4,... the integers. () Named
More informationDivide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201
Divide and Conquer: Polynomial Multiplication Version of October 7, 2014 Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Outline Outline: Introduction The polynomial multiplication
More informationand the compositional inverse when it exists is A.
Lecture B jacques@ucsd.edu Notation: R denotes a ring, N denotes the set of sequences of natural numbers with finite support, is a generic element of N, is the infinite zero sequence, n 0 R[[ X]] denotes
More informationLecture 2. Fundamentals of the Analysis of Algorithm Efficiency
Lecture 2 Fundamentals of the Analysis of Algorithm Efficiency 1 Lecture Contents 1. Analysis Framework 2. Asymptotic Notations and Basic Efficiency Classes 3. Mathematical Analysis of Nonrecursive Algorithms
More informationMATH 310 Course Objectives
MATH 310 Course Objectives Upon successful completion of MATH 310, the student should be able to: Apply the addition, subtraction, multiplication, and division principles to solve counting problems. Apply
More informationCS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University
CS 5321: Advanced Algorithms - Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating example:
More informationPROBLEMS ON CONGRUENCES AND DIVISIBILITY
PROBLEMS ON CONGRUENCES AND DIVISIBILITY 1. Do there exist 1,000,000 consecutive integers each of which contains a repeated prime factor? 2. A positive integer n is powerful if for every prime p dividing
More informationGenerating Functions
Semester 1, 2004 Generating functions Another means of organising enumeration. Two examples we have seen already. Example 1. Binomial coefficients. Let X = {1, 2,..., n} c k = # k-element subsets of X
More informationOn Arithmetic Properties of Bell Numbers, Delannoy Numbers and Schröder Numbers
A tal given at the Institute of Mathematics, Academia Sinica (Taiwan (Taipei; July 6, 2011 On Arithmetic Properties of Bell Numbers, Delannoy Numbers and Schröder Numbers Zhi-Wei Sun Nanjing University
More informationCS 2210 Discrete Structures Advanced Counting. Fall 2017 Sukumar Ghosh
CS 2210 Discrete Structures Advanced Counting Fall 2017 Sukumar Ghosh Compound Interest A person deposits $10,000 in a savings account that yields 10% interest annually. How much will be there in the account
More informationGrade 11/12 Math Circles Fall Nov. 5 Recurrences, Part 2
1 Faculty of Mathematics Waterloo, Ontario Centre for Education in Mathematics and Computing Grade 11/12 Math Circles Fall 2014 - Nov. 5 Recurrences, Part 2 Running time of algorithms In computer science,
More informationSolutions to Practice Final
s to Practice Final 1. (a) What is φ(0 100 ) where φ is Euler s φ-function? (b) Find an integer x such that 140x 1 (mod 01). Hint: gcd(140, 01) = 7. (a) φ(0 100 ) = φ(4 100 5 100 ) = φ( 00 5 100 ) = (
More informationMATH 802: ENUMERATIVE COMBINATORICS ASSIGNMENT 2
MATH 80: ENUMERATIVE COMBINATORICS ASSIGNMENT KANNAPPAN SAMPATH Facts Recall that, the Stirling number S(, n of the second ind is defined as the number of partitions of a [] into n non-empty blocs. We
More informationCS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline
CS 5321: Advanced Algorithms Analysis Using Recurrence Ali Ebnenasir Department of Computer Science Michigan Technological University Acknowledgement Eric Torng Moon Jung Chung Charles Ofria Outline Motivating
More informationChapter 4 Divide-and-Conquer
Chapter 4 Divide-and-Conquer 1 About this lecture (1) Recall the divide-and-conquer paradigm, which we used for merge sort: Divide the problem into a number of subproblems that are smaller instances of
More informationPUTNAM PROBLEMS SEQUENCES, SERIES AND RECURRENCES. Notes
PUTNAM PROBLEMS SEQUENCES, SERIES AND RECURRENCES Notes. x n+ = ax n has the general solution x n = x a n. 2. x n+ = x n + b has the general solution x n = x + (n )b. 3. x n+ = ax n + b (with a ) can be
More informationLecture 3: Miscellaneous Techniques
Lecture 3: Miscellaneous Techniques Rajat Mittal IIT Kanpur In this document, we will take a look at few diverse techniques used in combinatorics, exemplifying the fact that combinatorics is a collection
More informationn if n is even. f (n)=
6 2. PROBABILITY 4. Countable and uncountable Definition 32. An set Ω is said to be finite if there is an n N and a bijection from Ω onto [n]. An infinite set Ω is said to be countable if there is a bijection
More informationPartition of Integers into Distinct Summands with Upper Bounds. Partition of Integers into Even Summands. An Example
Partition of Integers into Even Summands We ask for the number of partitions of m Z + into positive even integers The desired number is the coefficient of x m in + x + x 4 + ) + x 4 + x 8 + ) + x 6 + x
More informationWhat we have learned What is algorithm Why study algorithm The time and space efficiency of algorithm The analysis framework of time efficiency Asympt
Lecture 3 The Analysis of Recursive Algorithm Efficiency What we have learned What is algorithm Why study algorithm The time and space efficiency of algorithm The analysis framework of time efficiency
More informationGeneralized Near-Bell Numbers
1 2 3 47 6 23 11 Journal of Integer Sequences, Vol. 12 2009, Article 09.5.7 Generalized Near-Bell Numbers Martin Griffiths Department of Mathematical Sciences University of Esse Wivenhoe Par Colchester
More informationAlgorithmic Approach to Counting of Certain Types m-ary Partitions
Algorithmic Approach to Counting of Certain Types m-ary Partitions Valentin P. Bakoev Abstract Partitions of integers of the type m n as a sum of powers of m (the so called m-ary partitions) and their
More informationConvergence of sequences and series
Convergence of sequences and series A sequence f is a map from N the positive integers to a set. We often write the map outputs as f n rather than f(n). Often we just list the outputs in order and leave
More informationFibonacci numbers. Chapter The Fibonacci sequence. The Fibonacci numbers F n are defined recursively by
Chapter Fibonacci numbers The Fibonacci sequence The Fibonacci numbers F n are defined recursively by F n+ = F n + F n, F 0 = 0, F = The first few Fibonacci numbers are n 0 5 6 7 8 9 0 F n 0 5 8 55 89
More informationEx. Here's another one. We want to prove that the sum of the cubes of the first n natural numbers is. n = n 2 (n+1) 2 /4.
Lecture One type of mathematical proof that goes everywhere is mathematical induction (tb 147). Induction is essentially used to show something is true for all iterations, i, of a sequence, where i N.
More informationMATH 363: Discrete Mathematics
MATH 363: Discrete Mathematics Learning Objectives by topic The levels of learning for this class are classified as follows. 1. Basic Knowledge: To recall and memorize - Assess by direct questions. The
More information1 Substitution method
Recurrence Relations we have discussed asymptotic analysis of algorithms and various properties associated with asymptotic notation. As many algorithms are recursive in nature, it is natural to analyze
More informationExecutive Assessment. Executive Assessment Math Review. Section 1.0, Arithmetic, includes the following topics:
Executive Assessment Math Review Although the following provides a review of some of the mathematical concepts of arithmetic and algebra, it is not intended to be a textbook. You should use this chapter
More informationRook Polynomials In Higher Dimensions
Grand Valley State University ScholarWors@GVSU Student Summer Scholars Undergraduate Research and Creative Practice 2009 Roo Polynomials In Higher Dimensions Nicholas Krzywonos Grand Valley State University
More information2 Generating Functions
2 Generating Functions In this part of the course, we re going to introduce algebraic methods for counting and proving combinatorial identities. This is often greatly advantageous over the method of finding
More informationCS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication
CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication Integer multiplication Say we have 5 baskets with 8 apples in each How do we determine how many apples we have? Count them all? That would take
More informationCMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005
CMSC-37110 Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005 Instructor: László Babai Ryerson 164 e-mail: laci@cs This exam contributes 20% to your course grade.
More informationSome multiplicative arithmetical functions
Some multiplicative arithmetical functions an invitation to number theory K. N. Raghavan http://www.imsc.res.in/ knr/ IMSc, Chennai August 203 Standard form of prime factorization of a number; GCD and
More informationSumming Series: Solutions
Sequences and Series Misha Lavrov Summing Series: Solutions Western PA ARML Practice December, 0 Switching the order of summation Prove useful identity 9 x x x x x x Riemann s zeta function ζ is defined
More informationLecture 4: Counting, Pigeonhole Principle, Permutations, Combinations Lecturer: Lale Özkahya
BBM 205 Discrete Mathematics Hacettepe University http://web.cs.hacettepe.edu.tr/ bbm205 Lecture 4: Counting, Pigeonhole Principle, Permutations, Combinations Lecturer: Lale Özkahya Resources: Kenneth
More informationThe well-known Fibonacci sequence is defined by a recurrence. Specifically,letF i denote the ith number. Then, we have:
Week 4 Recurrences (I) 4.1 The Fibonacci Sequence The well-known Fibonacci sequence is defined by a recurrence. Specifically,letF i denote the ith number. Then, we have: F 0 =0 (4.1) F 1 =1 (4.2) F n =
More informationNotes. Combinatorics. Combinatorics II. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006
Combinatorics Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry Spring 2006 Computer Science & Engineering 235 Introduction to Discrete Mathematics Sections 4.1-4.6 & 6.5-6.6 of Rosen cse235@cse.unl.edu
More informationChapter 7. Inclusion-Exclusion a.k.a. The Sieve Formula
Chapter 7. Inclusion-Exclusion a.k.a. The Sieve Formula Prof. Tesler Math 184A Fall 2019 Prof. Tesler Ch. 7. Inclusion-Exclusion Math 184A / Fall 2019 1 / 25 Venn diagram and set sizes A = {1, 2, 3, 4,
More informationChapter 2. Recurrence Relations. Divide and Conquer. Divide and Conquer Strategy. Another Example: Merge Sort. Merge Sort Example. Merge Sort Example
Recurrence Relations Chapter 2 Divide and Conquer Equation or an inequality that describes a function by its values on smaller inputs. Recurrence relations arise when we analyze the running time of iterative
More informationPartitions, permutations and posets Péter Csikvári
Partitions, permutations and posets Péter Csivári In this note I only collect those things which are not discussed in R Stanley s Algebraic Combinatorics boo Partitions For the definition of (number) partition,
More informationFRESHMAN PRIZE EXAM 2017
FRESHMAN PRIZE EXAM 27 Full reasoning is expected. Please write your netid on your paper so we can let you know of your result. You have 9 minutes. Problem. In Extracurricula all of the high school students
More informationPart IA Numbers and Sets
Part IA Numbers and Sets Definitions Based on lectures by A. G. Thomason Notes taken by Dexter Chua Michaelmas 2014 These notes are not endorsed by the lecturers, and I have modified them (often significantly)
More informationMath Circle: Recursion and Induction
Math Circle: Recursion and Induction Prof. Wickerhauser 1 Recursion What can we compute, using only simple formulas and rules that everyone can understand? 1. Let us use N to denote the set of counting
More informationEnumerative Combinatorics 7: Group actions
Enumerative Combinatorics 7: Group actions Peter J. Cameron Autumn 2013 How many ways can you colour the faces of a cube with three colours? Clearly the answer is 3 6 = 729. But what if we regard two colourings
More informationData Structures and Algorithms Chapter 3
Data Structures and Algorithms Chapter 3 1. Divide and conquer 2. Merge sort, repeated substitutions 3. Tiling 4. Recurrences Recurrences Running times of algorithms with recursive calls can be described
More informationMATH39001 Generating functions. 1 Ordinary power series generating functions
MATH3900 Generating functions The reference for this part of the course is generatingfunctionology by Herbert Wilf. The 2nd edition is downloadable free from http://www.math.upenn. edu/~wilf/downldgf.html,
More informationMath 378 Spring 2011 Assignment 4 Solutions
Math 3 Spring 2011 Assignment 4 Solutions Brualdi 6.2. The properties are P 1 : is divisible by 4. P 2 : is divisible by 6. P 3 : is divisible by. P 4 : is divisible by 10. Preparing to use inclusion-exclusion,
More informationarxiv: v1 [math.co] 21 Sep 2015
Chocolate Numbers arxiv:1509.06093v1 [math.co] 21 Sep 2015 Caleb Ji, Tanya Khovanova, Robin Park, Angela Song September 22, 2015 Abstract In this paper, we consider a game played on a rectangular m n gridded
More informationMATH 2200 Final LC Review
MATH 2200 Final LC Review Thomas Goller April 25, 2013 1 Final LC Format The final learning celebration will consist of 12-15 claims to be proven or disproven. It will take place on Wednesday, May 1, from
More informationMassachusetts Institute of Technology Handout J/18.062J: Mathematics for Computer Science May 3, 2000 Professors David Karger and Nancy Lynch
Massachusetts Institute of Technology Handout 48 6.042J/18.062J: Mathematics for Computer Science May 3, 2000 Professors David Karger and Nancy Lynch Quiz 2 Solutions Problem 1 [10 points] Consider n >
More informationFinite and Infinite Sets
Chapter 9 Finite and Infinite Sets 9. Finite Sets Preview Activity (Equivalent Sets, Part ). Let A and B be sets and let f be a function from A to B..f W A! B/. Carefully complete each of the following
More informationCombinatorics & Discrete Probability Theory
& Discrete Probability Theory CIS008-2 Logic and Foundations of Mathematics David Goodwin david.goodwin@perisic.com 11:00, Tuesday 28 th February 2012 Outline 1 Combinatorics Enumeration Permutations Combinations
More informationCHAPTER 8 Advanced Counting Techniques
96 Chapter 8 Advanced Counting Techniques CHAPTER 8 Advanced Counting Techniques SECTION 8. Applications of Recurrence Relations 2. a) A permutation of a set with n elements consists of a choice of a first
More informationASSIGNMENT 1 SOLUTIONS
MATH 271 ASSIGNMENT 1 SOLUTIONS 1. (a) Let S be the statement For all integers n, if n is even then 3n 11 is odd. Is S true? Give a proof or counterexample. (b) Write out the contrapositive of statement
More informationCounting Peaks and Valleys in a Partition of a Set
1 47 6 11 Journal of Integer Sequences Vol. 1 010 Article 10.6.8 Counting Peas and Valleys in a Partition of a Set Toufi Mansour Department of Mathematics University of Haifa 1905 Haifa Israel toufi@math.haifa.ac.il
More informationAlgorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee
Algorithm Analysis Recurrence Relation Chung-Ang University, Jaesung Lee Recursion 2 Recursion 3 Recursion in Real-world Fibonacci sequence = + Initial conditions: = 0 and = 1. = + = + = + 0, 1, 1, 2,
More informationAlgebra 1 Standards Curriculum Map Bourbon County Schools. Days Unit/Topic Standards Activities Learning Targets ( I Can Statements) 1-19 Unit 1
Algebra 1 Standards Curriculum Map Bourbon County Schools Level: Grade and/or Course: Updated: e.g. = Example only Days Unit/Topic Standards Activities Learning Targets ( I 1-19 Unit 1 A.SSE.1 Interpret
More informationarxiv: v1 [math.co] 17 Dec 2007
arxiv:07.79v [math.co] 7 Dec 007 The copies of any permutation pattern are asymptotically normal Milós Bóna Department of Mathematics University of Florida Gainesville FL 36-805 bona@math.ufl.edu Abstract
More informationWeek Some Warm-up Questions
1 Some Warm-up Questions Week 1-2 Abstraction: The process going from specific cases to general problem. Proof: A sequence of arguments to show certain conclusion to be true. If... then... : The part after
More informationPart II. Number Theory. Year
Part II Year 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2017 Paper 3, Section I 1G 70 Explain what is meant by an Euler pseudoprime and a strong pseudoprime. Show that 65 is an Euler
More informationThe maximum-subarray problem. Given an array of integers, find a contiguous subarray with the maximum sum. Very naïve algorithm:
The maximum-subarray problem Given an array of integers, find a contiguous subarray with the maximum sum. Very naïve algorithm: Brute force algorithm: At best, θ(n 2 ) time complexity 129 Can we do divide
More informationAsymptotic Notation. such that t(n) cf(n) for all n n 0. for some positive real constant c and integer threshold n 0
Asymptotic Notation Asymptotic notation deals with the behaviour of a function in the limit, that is, for sufficiently large values of its parameter. Often, when analysing the run time of an algorithm,
More informationWhat can you prove by induction?
MEI CONFERENCE 013 What can you prove by induction? Martyn Parker M.J.Parker@keele.ac.uk Contents Contents iii 1 Splitting Coins.................................................. 1 Convex Polygons................................................
More informationReview problems solutions
Review problems solutions Math 3152 December 15, 2017 1. Use the binomial theorem to prove that, for all n 1 and k satisfying 0 k n, ( )( ) { n i ( 1) i k 1 if k n; i k 0 otherwise. ik Solution: Using
More information