An Introduction to Mathematical Methods in Combinatorics
Total Page:16
File Type:pdf, Size:1020Kb
An Introduction to Mathematical Methods in Combinatorics Renzo Sprugnoli Dipartimento di Sistemi e Informatica Viale Morgagni, 65 - Firenze (Italy) January 18, 2006 2 Contents 1 Introduction 5 1.1 What is the Analysis of an Algorithm . ......... 5 1.2 The Analysis of Sequential Searching . ...... 6 1.3 Binary Searching . ..... 6 1.4 ClosedForms ...................................... ....... 7 1.5 TheLandaunotation................................... ...... 9 2 Special numbers 11 2.1 Mappings and powers . 11 2.2 Permutations ....................................... ...... 12 2.3 The group structure . ..... 13 2.4 Counting permutations . ....... 14 2.5 Dispositions and Combinations . ......... 15 2.6 ThePascaltriangle.................................. ........ 16 2.7 Harmonicnumbers .................................... ...... 17 2.8 Fibonacci numbers . ..... 18 2.9 Walks, trees and Catalan numbers . ........ 19 2.10 Stirling numbers of the first kind . ........ 21 2.11 Stirling numbers of the second kind . ....... 22 2.12 Bell and Bernoulli numbers . ...... 23 3 Formal power series 25 3.1 Definitions for formal power series . ........ 25 3.2 The basic algebraic structure . ....... 26 3.3 Formal Laurent Series . ...... 27 3.4 Operations on formal power series . ........ 27 3.5 Composition ..................................... ........ 29 3.6 Coefficient extraction . ...... 29 3.7 Matrixrepresentation ................................ ........ 31 3.8 Lagrange inversion theorem . ........ 32 3.9 Some examples of the LIF . ..... 33 3.10 Formal power series and the computer . ...... 34 3.11 The internal representation of expressions . ......... 35 3.12 Basic operations of formal power series . ............. 36 3.13 Logarithm and exponential . ........ 37 4 Generating Functions 39 4.1 General Rules . 39 4.2 Some Theorems on Generating Functions . 40 4.3 More advanced results . ..... 41 4.4 Common Generating Functions . 42 4.5 The Method of Shifting . 44 4.6 Diagonalization................................... ......... 45 4.7 Some special generating functions . ..... 46 3 4 CONTENTS 4.8 Linear recurrences with constant coefficients . 47 4.9 Linear recurrences with polynomial coefficients . 49 4.10 The summing factor method . ...... 49 4.11 The internal path length of binary trees . ....... 51 4.12 Height balanced binary trees . ..... 52 4.13 Some special recurrences . 53 5 Riordan Arrays 55 5.1 Definitions and basic concepts . 55 5.2 The algebraic structure of Riordan arrays . .......... 56 5.3 The A-sequence for proper Riordan arrays . ...... 57 5.4 Simple binomial coefficients . 59 5.5 Other Riordan arrays from binomial coefficients . ....... 60 5.6 Binomial coefficients and the LIF . ..... 61 5.7 Colouredwalks ..................................... ....... 62 5.8 Stirling numbers and Riordan arrays . ......... 64 5.9 Identities involving the Stirling numbers . .......... 65 6 Formal methods 67 6.1 Formallanguages.................................... ....... 67 6.2 Context-free languages . ....... 68 6.3 Formal languages and programming languages . ....... 69 6.4 Thesymbolicmethod .................................. ...... 70 6.5 Thebivariatecase ................................... ....... 71 6.6 The Shift Operator . ..... 72 6.7 The Difference Operator . 73 6.8 Shift and Difference Operators - Example I . 74 6.9 Shift and Difference Operators - Example II . ..... 76 6.10 The Addition Operator . ...... 77 6.11 Definite and Indefinite summation . 78 6.12 Definite Summation . ..... 79 6.13 The Euler-McLaurin Summation Formula . ...... 80 6.14 Applications of the Euler-McLaurin Formula . ....... 81 7 Asymptotics 83 7.1 The convergence of power series . ..... 83 7.2 ThemethodofDarboux .................................. ..... 84 7.3 Singularities: poles . ........ 85 7.4 Polesandasymptotics ................................. ....... 86 7.5 Algebraic and logarithmic singularities . ............ 87 7.6 Subtracted singularities . ...... 88 7.7 The asymptotic behavior of a trinomial square root . ............. 89 7.8 Hayman’smethod ..................................... ..... 89 7.9 Examples of Hayman’s Theorem . ..... 91 8 Bibliography 93 Chapter 1 Introduction 1.1 What is the Analysis of an ever, as a matter of fact, the nature of S is not essen- Algorithm tial, because we always deal with a suitable binary representation of the elements in S on a computer, and have therefore to be considered as “words” in An algorithm is a finite sequence of unambiguous the computer memory. The “problem of searching” rules for solving a problem. Once the algorithm is is as follows: we are given a finite ordered subset started with a particular input, it will always end, T = (a1, a2,...,an) of S (usually called a table, its obtaining the correct answer or output, which is the elements referred to as keys), an element s S and solution to the given problem. An algorithm is real- we wish to know whether s T or s T , and∈ in the ized on a computer by means of a program, i.e., a set ∈ 6∈ former case which element ak in T it is. of instructions which cause the computer to perform Although the mathematical problem “s T or the elaborations intended by the algorithm. not” has almost no relevance, the searching∈ prob- So, an algorithm is independent of any computer, lem is basic in computer science and many algorithms and, in fact, the word was used for a long time before have been devised to make the process of searching computers were invented. Leonardo Fibonacci called as fast as possible. Surely, the most straight-forward “algorisms” the rules for performing the four basic algorithm is sequential searching: we begin by com- operations (addition, subtraction, multiplication and paring s and a1 and we are finished if they are equal. division) with the newly introduced arabic digits and Otherwise, we compare s and a2, and so on, until we the positional notation for numbers. “Euclid’s algo- find an element ak = s or reach the end of T . In rithm” for evaluating the greatest common divisor of the former case the search is successful and we have two integer numbers was also well known before the determined the element in T equal to s. In the latter appearance of computers. case we are convinced that s T and the search is Many algorithms can exist which solve the same unsuccessful. 6∈ problem. Some can be very skillful, others can be The analysis of this (simple) algorithm consists in very simple and straight-forward. A natural prob- finding one or more mathematical expressions de- lem, in these cases, is to choose, if any, the best al- scribing in some way the number of operations per- gorithm, in order to realize it as a program on a par- formed by the algorithm as a function of the number ticular computer. Simple algorithms are more easily n of the elements in T . This definition is intentionally programmed, but they can be very slow or require vague and the following points should be noted: large amounts of computer memory. The problem an algorithm can present several aspects and is therefore to have some means to judge the speed • therefore may require several mathematical ex- and the quantity of computer resources a given algo- pressions to be fully understood. For example, rithm uses. The aim of the “Analysis of Algorithms” for what concerns the sequential search algo- is just to give the mathematical bases for describing rithm, we are interested in what happens during the behavior of algorithms, thus obtaining exact cri- a successful or unsuccessful search. Besides, for teria to compare different algorithms performing the a successful search, we wish to know what the same task, or to see if an algorithm is sufficiently good worst case is (Worst Case Analysis) and what to be efficiently implemented on a computer. the average case is (Average Case Analysis) with Let us consider, as a simple example, the problem respect to all the tables containing n elements or, of searching. Let S be a given set. In practical cases for a fixed table, with respect to the n elements S is the set N of natural numbers, or the set Z of it contains; integer numbers, or the set R of real numbers or also the set A∗ of the words on some alphabet A. How- the operations performed by an algorithm can be • 5 6 CHAPTER 1. INTRODUCTION of many different kinds. In the example above technical point for the analyst. A large part of our the only operations involved in the algorithm are efforts will be dedicated to this topic. comparisons, so no doubt is possible. In other Let us now consider an unsuccessful search, for algorithms we can have arithmetic or logical op- which we only have an Average Case analysis. If Uk erations. Sometimes we can also consider more denotes the number of comparisons necessary for a complex operations as square roots, list concate- table with k elements, we can determine Un in the nation or reversal of words. Operations depend following way. We compare s with the first element on the nature of the algorithm, and we can de- a in T and obviously we find s = a , so we should 1 6 1 cide to consider as an “operation” also very com- go on with the table T ′ = T a1 , which contains plicated manipulations (e.g., extracting a ran- n 1 elements. Consequently,\ we { have:} dom number or performing the differentiation of − a polynomial of a given degree). The important Un = 1 + Un 1 − point is that every instance of the “operation” takes on about the same time or has the same This is a recurrence relation, that is an expression complexity. If this is not the case, we can give relating the value of Un with other values of Uk having different weights to different operations or to dif- k < n. It is clear that if some value, e.g., U0 or U1 ferent instances of the same operation. is known, then it is possible to find the value of Un, for every n N. In our case, U0 is the number of We observe explicitly that we never consider exe- comparisons∈ necessary to find out that an element cution time as a possible parameter for the behavior s does not belong to a table containing no element.