This book is intended for undergraduate/graduate students in computer science, mathematics and engineering. Students with a high school level of mathematics can use this book for independent study and reference.
The scope of the book
In Chapter 5, titled “Introduction to Algorithms and Data Structures,” we begin with the concept of algorithm and the classic example of the greatest common divisor algorithm (the granddaddy of all algorithms, according to Donald Knuth). These include the data model list, its representation as an array, and the linked list.
Use of the Book
In the first section we study the concepts of statements, attribution of truths to statements, implication (conditional statement), logically equivalent statements, truth tables, tautology, contradiction, valid arguments, arguments with errors (invalid arguments) and proof techniques in mathematics. Exercises at the end of each chapter or section test your understanding of the concepts developed in the text.
Acknowledgment
Parthasarathy of the Indian Institute of Technology, Chennai, India for introducing him to graph theory and supervising his dissertation. A thousand thanks go to Professor Claude Berge, one of the greatest pioneers in graph theory and combinatorics, who invited him to CAMS (Centre d'Analyse Math'ematique Sociale) and supervised his doctoral work in Paris.
Summary
Introduction
We do not iterate over elements in a collection and the order of the elements in a collection is irrelevant. Usually, sets are denoted by capital letters such as A, B, etc., and the elements of the sets by lowercase letters ssa, b, etc.
INTRODUCTION 3 There are generally two ways of specifying sets. One way is to
Venn diagrams and operations on sets
Functions
For example, if A is a set of students of a particular class, then fora∈A, if iff(a) denotes the height of a, then : A→R+ is the set of positive real numbers is a function. As an example, let A denote the set of 1,000 students of a college A, and B denote the set of positive integers.
FUNCTIONS 7 Definition 5
I is the indexing set of the family (in other words, for each ∈I there is an element xi ∈X of the family).
Equivalence Relations
On the set Z of integers (positive integers, negative integers, and zero), setaRbiff-bis divisible by 5. A partition P of a set X is the collection P of nonstring subsets of X whose union is X such that the intersection of any two distinct terms of P is empty.
Finite and Infinite Sets
Any subset of a finite set is finite, and therefore any superset of an infinite set is infinite. By induction, it follows that the union of a disjoint family of a finite number of finite sets is finite.
Cardinal Numbers of Sets
CARDINAL NUMBERS OF SETS 15 Proof. That no finite set can be equipotent to a proper subset of
POWER SET OF A SET 17
Power Set of a Set
Exercises
Give an example of a relation that is i) reflexive and symmetric but not transitive (ii) reflexive and transitive but not symmetric.
Partially Ordered Sets
PARTIALLY ORDERED SETS 21 Definition 2
PARTIALLY ORDERED SETS 23
The largest and smallest elements of a poset, whenever they exist, are denoted by 1 and 0, respectively. Clearly, the largest element of a poset is a maximal element and the smallest element a minimal element.
Lattices
Duality Principle
LATTICES 27
A subset of a lattice (L, ∧, ∨) need not be a sublattice even if it is a posed with respect to the operation "≤" defined by . For example, let (L, ∩, ∪) be the lattice of all subsets of a vector space L and S be the collection of all subspaces of L.
Distributive and Modular Lattices
Complemented Lattice
LATTICES 31
That the diamond grid and the pentagonal grid (in figure 1.8) are decisive in the study of distributive grids is the content of theorem 1.9.13. A lattice is distributive if it does not contain a sublattice that is isomorphic to the diamond lattice or the pentagonal lattice.
Modular Lattices
LATTICES 33 (Note: For a = c, equality holds on the right.) But the modular
A consequence of Theorems 1.9.13 and 1.9.16 is that every distributive lattice is modular (since L is distributive ⇒ L does not contain the pentagonal lattice as a sublattice⇒Lis modular).
Boolean Algebras
- Introduction
- Examples of Boolean Algebras
BOOLEAN ALGEBRAS 35 2. Let B n denote the set of all binary sequences of length n
Boolean Subalgebras
Boolean Isomorphisms
- Atoms in a Lattice
- ATOMS IN A LATTICE 39 Lemma 4
- ATOMS IN A LATTICE 41 Corollary 7
- Exercises
That is, a is an atom if there is no b strictly smaller than a. Suppose b ̸= a, then b has a non-zero complement, e.g. c, in the section [0, a], since we have assumed that L is sectionally complemented.
Bibliography
- What Is Combinatorics?
- WHAT IS COMBINATORICS? 49 (see Table 2.1)
- Elementary Counting Principles
- ELEMENTARY COUNTING PRINCIPLES 53 Example 2 (Product of two intervals)
In fact, the second counting problem can be seen as the generalization of the existence problem. Note that the two diagonally opposite squares are of the same color (either both black or both white).
Two Interpretations of functions
Example 2.2.3 (Right circular cylinder as Cartesian product): The product of a circle in the ax plane and a closed interval in the z-axis is a right circular cylinder in the three-dimensional space R3.
First interpretation: Professors and offices/rooms
Second interpretation: Cartesian product or word
The elements of the product B5 are sometimes called words of length 5 of the alphabet B. The number of letters in the word is its length). In this representation, the function is identified by a word whose length is equal to the number of elements in the function's domain.
Equality of functions
There exists an injective function from the set A to the set B if and only if |A| ≤ |B|. For example, to prove that two finite sets A and B are of the same cardinality, we can establish a one-to-one correspondence between the sets A and B.
Popular form of the fundamental principle
ELEMENTARY COUNTING PRINCIPLES 57
The first letter of the word can be chosen in 26 ways, the second in 26 ways and the third also in 26 ways. After choosing the first and second, the third can be chosen in 24 ways.
Pigeon-hole principle
- ELEMENTARY COUNTING PRINCIPLES 59 Example 8
- ELEMENTARY COUNTING PRINCIPLES 63 Example 11 (Subtraction rule)
- Permutations and Combinations
- PERMUTATIONS AND COMBINATIONS 65 Example 2 (Permutation construction)
- PERMUTATIONS AND COMBINATIONS 67 The symbol ≈ means “approximately equal” and the number e
- PERMUTATIONS AND COMBINATIONS 69 Example 6 (Binomial coefficients)
Example 2.2.7 (counting the number of divisors of an integer): Find the number of positive divisors of the integer 600. The following theorem gives a formula for the number of permutations of an m-string taken n at a time.
Power set
PERMUTATIONS AND COMBINATIONS 77 by Theorem 4, there is a one-to-one correspondence between
In particular, the number of subsets of A is equal to the number of characteristic functions on A. The next elementary identity is obtained by counting the number of subsets of the ann-set in two different ways.
PERMUTATIONS AND COMBINATIONS 79 Case 1: The k-subsets of A containing a particular element, say,
- Sums and Products
In this matrix, the indices j of the numbers aij verify the following property: i=j if faij is in the main diagonal. In general, we can replace the index variable i with p(i), where p(i) is a permutation of the range of i. (See [1].).
Binomial Theorem
Similarly, the term on the right-hand side in the expansion (a+b)3 is a homogeneous term of degree 3 ina and b. It is clear that aEn+bEn is a homogeneous expression of degree n+ 1 and all possible terms of the form akbn+1−k appear in it for all k with 0 ≤ k ≤ n+ 1.
BINOMIAL THEOREM 85
Like the rising and waning moon, the binomial coefficients first increase and then decrease. Because of the above duality property, the name Chanda-Sutra=Moon Formula perfectly justifies the name The Binomial Theorem.
BINOMIAL THEOREM 87 Corollary 2.1
We will show that the left side of the identity is also the coefficient of xn in the product. A term in xn is obtained by taking a term (n .. n−k . )xn−k from the second factor of the right-hand side of the above expression for allk with 0≤k≤n.
BINOMIAL THEOREM 89 We may assume that r and s are positive integers. The right-
Differentiating both sides with respect to x using the formula d/dx(xk) = kxk−1, for k≥0, we get.
MULTINOMIAL COEFFICIENTS 91
Multinomial Coefficients
Each choice of a subset k-subsetB uniquely defines another (n −k)-subset Bc = A\B, the complement of the set B in the set A. Therefore, each k-subset B of A defines an ordered (k, n−k) partition and conversely, each ordered (k, n−k) partition of the n-set A defines a k-subset of A. Hence the number of k -subsets of A is the same as the number ordered (k, n−k) partitions of A. 1) ordered partitions of an n-set.
MULTINOMIAL COEFFICIENTS 93 The following theorem gives a formula for the multinomial co-
Find the number of different words that can be formed from the word "MISSISSIPPI." Find the number of these words in which four I's do not occur together. Solution: The words in "MISSISSIPPI" induce the multiset M={1.M,4.S,4.I,2.P }.The number of elements in the multiset.
MULTINOMIAL COEFFICIENTS 95 is 11. Hence the required number is the number of permutations
Then the number of words of length n that can be formed by using the letter a1 exactly n1 times, using the letter a2 exactly n2 times, etc., and using the letter ak exactly nk times, is the multinomial coefficient . Calculate the number of words with a length of 4 (words of 4 letters) that can be formed from the letters a, b, c in which the letter a occurs at most three times, b occurs at most once and c occurs at most twice.
MULTINOMIAL COEFFICIENTS 101 first three partitions give the same coefficient 1, the second three
It is the coefficient of a1 from the first bracket multiplied by the coefficient ean11−1an22· · ·annk from the second bracket + the coefficient of a2 from the first bracket multiplied by the coefficient of an11an22−1· · ·ank from the second bracket +· · · + the coefficient ofai from the first bracket multiplied by the coefficient of ean11an22−1· · ·anii−1· · ·annk from the second bracket +· · ·+ the coefficient of ak from the first bracket multiplied by the coefficient of an11an22· · ·annk−1 from the second bracket.
Stirling Numbers
The absolute value of the coefficient of xk in the polynomial xn= x(x−1)· · ·(x−n+ 1) is called the Stirling number of the first type and is denoted by [n. The main motivation for determining the Stirling number of the first kind is to convert descending factorial powers to ordinary powers.
STIRLING NUMBERS 105 Solution: By definition, [ n+1
For example, the fourth row of the Stirling triangle gives the coefficients [4. Note that the first row is the 0th row.). To get the number thekth in the nth row (assuming that the terms in row (n−1) have already been calculated), we multiply by the number found to the north-east of the number to be found and add it. on the number northwest of the number to be counted.
STIRLING NUMBERS 107 Example 3 (Three representations of a permutation)
We will see that the permutation p is indeed the product (composition) of the disjoint cycles (123) and (45) because. Note that the elements i that are not present in the cycle (123) are fixed by the permutation p1 that is, p(i) =i.
STIRLING NUMBERS 109 Combinatorial meaning of [ n
After the first element of the cycle is selected, the second integer can be chosen n − 2 ways.
STIRLING NUMBERS 111 Cyclic permutations or circular permutations
Example 2.6.11 (Number of cyclic permutations on (n+ 1) set): Find the number of cyclic permutations on an (n+ 1) set (n≥0.) Solution: By the combinatorial interpretation of the Stirling number of the first kind, [n+1. Another equivalent way of defining the Stirling number of the first kind is as the sum of the product of certain integers.
STIRLING NUMBER OF THE SECOND KIND { N
Stirling Number of the Second Kind { n
First, we count the number of ordered 2-partitions of the set A (the empty set is allowed as part of the partition.). Therefore, the number of unordered partitions of the set A into two mutually disjoint non-empty subsets is 12 ×(2n+1−2) = 2n−1.
Bell Numbers
THE PRINCIPLE OF INCLUSION 127
The Principle of Inclusion and Exclusion
THE PRINCIPLE OF INCLUSION 129 equation involving binomial coefficients
- Applications of Inclusion and Exclusion PrinciplePrinciple
Moreover, A0 is by definition the number of elements of S belonging to at least zero of the subsets S1, S2, . Sm which is the number of elements of S. Therefore, the number of elements in none of the subsets.
THE PRINCIPLE OF INCLUSION 133 Of these six permutations, the derangements, that is, permuta-
Solution: The number of disorders in 3 symbols is 3!(1− .. See Chapter 6 for more details.) Consider gentlemen attending a party. Find the number of ways in which these eight heads can be placed on the board in such a way that no rook can attack another (that is, no two rooks are in the same row or column) ) and the second main diagonal/black diagonal (the diagonal from the lower left square to the upper right square) is free of beds.
THE PRINCIPLE OF INCLUSION 137 fore, by Proposition 2.2.1, the number possible positions of the
- Application of Inclusion and Exclusion Principle to Elementary Number TheoryPrinciple to Elementary Number Theory
We note that the number of positive integers ≤n and relatively simple tone is the same as the number of integers in the set A which are not divisible by p1, p2,. Therefore we count the number of integers in the set A not divisible by any of the pi's.
THE PRINCIPLE OF INCLUSION 139 By Corollary 1.1, this number is
The formula of Theorem 2.9.4 can be written elegantly using the function M¨obiusµ(n). For a positive integer, the function µ(n) is defined as. Therefore, only divisors of the form=pq11pq22· · ·pqmm with qi = 0 or 1 contribute to the sum (2.3), that is, only divisors d that are either 1 or the product of distinct primes are counted in the sum ( 2.3).
THE PRINCIPLE OF INCLUSION 141 Hence the sum 2.3 can be written as
Now cross out the numbers of the list that are divisible by p1, then cross out the numbers that are divisible by p2, and so on, and finally cross out the numbers that are divisible by pm. prime numbers >. Using the notation π(x), the number of integers that do not appear in any of the sets Si is π(n)−π(√ .n).
THE PRINCIPLE OF INCLUSION 143 But this number can be computed in a second way using the
- Applications to Permanents
Note that the operation of a permutation p on an element i is denoted by pi instead of p(i).
THE PRINCIPLE OF INCLUSION 145 Example 13
If A is an n × n square matrix with real entries, then per(A) = per(At) where At is the transpose of A. The transpose of A is the matrix obtained by permuting the rows and columns of A.) . PRINCIPLE OF INCLUSION 147 More generally, the product of the row sums of the matrix ann×n,.
We will now calculate the permanent of the matrix M in a second way using the formula of Theorem 2.9.8. The row sums(li) of the entries in the ith row of the matrixMr are given by.
Generating Functions and Recur- rence Relationsrence Relations
Let us now calculate the permanent of the matrix M in a different way using the formula of Theorem 2.9.8. In other words, the row sum of Mrisn−r for the rowsj1′, j2′,. jr′ and it equals ton−r−1 for all other sequences. possible choices of columns from available columns).
GENERATING FUNCTIONS 153 series)
The series converges absolutely for all z and satisfies the inequality|z|< r. If is a real number such that 0≤s < rthen. Nothing can be said about the convergence of the series for values in the circle of convergence.
Exponential generating function
We can distinguish term by term the series a0+a1z+ a2z2+· · · and the derived series has the same radius of convergence as the original series. If the series is convergent only forz = 0, then it may be possible to obtain a convergent series for the sequence (ai/i!). This motivates the following definition.
Addition and scalar multiplication of power se- ries
Multiplication of two power series
- Solving Recurrence Relations Using Generating Function TechniquesGenerating Function Techniques
Our problem is to find a closed formula for the nth term of the sequence (fn). Our goal, if possible, is to find a "closed formula" forg(z) like our example 2.10.1 of the geometric series.
GENERATING FUNCTIONS 159 That is,
- Catalan Numbers
GENERATED FUNCTIONS 161 ways to perform the multiplication M1×M2 × · · · ×Mn is the. 2.9) We have thus derived a recurrence relation with c′is. Therefore, the generating function satisfies the relation zg(z)2 = g(z)−1. If we solve this quadratic equation in “g(z)” we get the closed form.
GENERATING FUNCTIONS 165 Example 13
Generating Subsets
Let's observe the order of the list of strings in the second column of Example 2.11.1. This is why we list the elements of the set [n] in descending order.
In the subset generation algorithm above, we find the subset immediately following the subset {6,4,3,1}. To find the next string, replace the first 0 to the right with a 1 bit and all other bits to the right of that 0 with 1s.
GENERATING SUBSETS 171 Example 6 (Subsets in lexicographic order)
Then replace the third (= 2+1) integer from the right side of the string by its immediate successor. In this case, find the largest length l of consecutive integers from the right side of the string (also called the largest length of consecutive suffix).
GENERATING SUBSETS 173 Example 7
By subtracting the above sum from the total number of (n . k . )afk subsets of [n], we get the formula for the theorem. Let us find the place of occurrence of the 4-subset 2346 among the list of 4-subsets of [6] written in lexicographic order.
EXERCISES 175
Exercises
Find the number of ways to place the objects in the two labeled boxes B1 and B2 in which each box contains at least one element. Find the number of ways to seat 5 boys and 3 girls in a row so that no two girls are together.
EXERCISES 177 (c) All the girls are never together
Use the Stirling number of the second type to find the number of equivalence relations that can be defined on the set. Show that for any five points chosen within a square of side length 2, there must exist two points such that their Euclidean distance is strictly less than .
EXERCISES 179 49. Choose any ten points inside an equilateral triangle of side
Ryser, Combinatorische wiskunde, The Carus Mathematical Monographs, The Mathematical Association of America, gedistribueerd door John Wiley and Sons, Inc., 1963.