Sie sind auf Seite 1von 45

An Introduction to

Combinatorics
Unit I
Three principal themes
• Discrete StructuresGraphs, digraphs, networks,
designs, posets, strings, patterns, distributions,
coverings, and partitions.
• EnumerationPermutations, combinations,
inclusion/exclusion, generating functions,
recurrence relations, and Pólya counting.
• Algorithms and OptimizationSorting, eulerian
circuits, hamiltonian cycles, planarity testing,
graph coloring, spanning trees, shortest paths,
network flows, bipartite matchings, and chain
partitions.
LET’S SEE EXAMPLES FROM EACH
SECTION !!!
Enumeration
• An enumeration is a complete, ordered listing
of all the items in a collection.
• A jeweler sells six-beaded necklaces in his
shop. Given that there are three different
colors of beads, how many varieties of
necklaces does he need to create in order to
have every possible permutation of colors?
Enumeration

Necklaces made with three colors


Enumeration
1. How many different necklaces of six beads can be formed
using three reds, two blues and one green?
2. How many different necklaces of six beads can be formed
using red, blue and green beads (not all colors have to be
used)?
3. How many different necklaces of six beads can be formed
using red, blue and green beads if all three colors have to
be used?
4. How would we possibly answer these questions for
necklaces of six thousand beads made with beads from
three thousand different colors? What special software
would be required to find the exact answer and how long
would the computation take?
Combinatorics and Graph Theory

• A graph G consists of a vertex set V and a


collection E of 2-element subsets ofV. Elements
of E are called edges.
• we will always use the convention
that V={1,2,3,…,n} for some positive
integer n. With this convention, graphs can be
described precisely with a text file:
– The first line of the file contains a single
integer n,n, the number of vertices in the graph.
– Each of the remaining lines of the file contains a pair
of distinct integers and specifies an edge of the graph.
In general we can try to answer these ??

1. What is the largest k for which G has a path of


length k?
2. What is the largest k for which G has a cycle of
length k?
3. What is the largest k for which G has a clique of
size k?
4. What is the largest k for which G has an
independent set of size k?
5. What is the shortest path from vertex 7 to
vertex 6?
For the above example
• G has 9 vertices and 10 edges.
• {2,6} is an edge.
• Vertices 5 and 9 are adjacent.
• {5,4} is not an edge.
• Vertices 3 and 7 are not adjacent.
• P=(4,3,1,7,9,5) is a path of length 5 from vertex 4 to vertex 5.
• C=(5,9,7,1) is cycle of length 4.
• G is disconnected and has two components. One of the
components has vertex set {2,6,8}.
• {1,5,7} is a triangle.
• {1,7,5,9} is a clique of size 4.
• {4,2,8,5} is an independent set of size 4.
Combinatorics and Number Theory
• Example :Form a sequence of positive integers using the
following rules. Start with
a positive integer n > 1. If n is odd, then the next number is
3n + 1. If n is even, then the next number is n/2. Halt if you
ever reach 1.
example, if we start with 28,
the sequence is:
28; 14; 7; 22; 11; 34; 17; 52; 26; 13; 40; 20; 10; 5; 16; 8; 4;
2; 1:
Sequences formed by this rule are called Collatz sequences.
Another example can be considered as find least common
multiple of two integers (very large!!!)
Combinatorics and Geometry

• There are many problems in geometry that


are in combinatorial form or for which
combinatorial techniques can be used.
• Example. In Figure, we show a family of 4 lines
in the plane. Each pair of lines intersects and
no point in the plane belongs to more than
two lines.
• These lines determine 11 regions.
Combinatorics and Geometry
• Under these same restrictions, how many
regions would a family of 8947 lines
determine?
• Can different arrangements of lines determine
different numbers of regions?
Combinatorics and Optimization

• Shortest path problem.


• Minimum spanning tree problem.
Sudoku Puzzles

• A Sudoku puzzle is a 9×9 array of cells that


when completed have the integers 1,2,…,9
appearing exactly once in each row and each
column.
• Also the numbers 1, 2, 3,…,9 appear once in
each of the nine 3×3 subsquares identified by
the darkened borders.
Strings, Sets, and Binomial
Coefficients
Strings
• Let n be a positive integer.
• [n] to denote the n-element set {1,2,…,n}.
• let X be a set. Then a function s:[n]→X is also
called an X-string of length n.
• For X-strings, we refer to the elements of X as
characters, hence the element s(i) is the ith
character of s.
• We denote a string s by writing s=“x1x2x3…xn”,
rather than s(1)=x1, s(2)=x2, …, s(n)=xn.
Strings
• Strings are also called sequences, especially when
X is a set of numbers and the function
s is defined by an algebraic rule.
For example, the sequence of odd integers is
defined by si=2i−1.
• Strings are called words, the set X is called the
alphabet and the elements of X are called letters.
• In computer strings are called arrays
For example, aababbccabcbb is a 13-letter word on
the 3-letter alphabet {a,b,c}.
Another example
• Suppose a license plates consist of four digits
followed by a space followed by three capital
letters. The first digit cannot be a 0. How many
license pl
• Let X consist of the digits {0,1,2,…,9}, let Y be the
singleton set whose only element is a space, and
let Z denote the set of capital letters.
• Then a valid license plate is just a string
from(X−{0})×X×X×X×Y×Z×Z×Z.
• so the number of different license plates
is 9×103×1×263=158184000
Another example
• Suppose that a website allows its users to pick
their own usernames for accounts, but imposes
some restrictions. The first character must be an
upper-case letter in the English alphabet. The
second through sixth characters can be letters
(both upper-case and lower-case allowed) in the
English alphabet or decimal digits (00–99). The
seventh position must be `@' or `.'. The eighth
through twelfth positions allow lower-case
English letters, `*', `%', and `#'. The thirteenth
position must be a digit. How many users can the
website accept registrations from?
Solution
• 26×625×2×295×10=9771287250890863360

# # # # #
D D D D D % % % % %
L L L L L . * * * * *
U U U U U U @ L L L L L D

26 62 62 62 62 62 2 29 29 29 29 29 10
Permutations
• Suppose we need to place 26 letters of the English alphabet in a bag and
then draw them out one at a time (without returning a letter once it's
been drawn) to form a six-character string.
• We know there are 266 strings of length six that can be formed from the
English alphabet.
• If we restrict the manner of string formation, not all strings are possible.
• Example : The string “yellow” has six characters, but it uses the letter “l”
twice and thus cannot be formed by drawing letters from a bag.
• Whereas “jacket” can be formed in this manner.
• Starting from a full bag, we note there are 26 choices for the first letter.
• Once it has been removed, there are 25letters remaining in the bag.
• Continuing, we note that immediately before the sixth letter is drawn from
the bag, there are 21 letters in the bag.
• Thus, we can form 26⋅25⋅24⋅23⋅22⋅21 six-character strings of English
letters by drawing letters from a bag, a little more than half the total
number of six-character strings on this alphabet.
Permutations
• let X be a finite set and let n be a positive integer.
An X-string s=x1x2…xn is called a permutation if
all n characters used in s are distinct.
• Clearly, the existence of an X-permutation of
length n requires that |X|≥n.
• Now for integers m,n
with m≥n≥0 define P(m,n) by
• P(m,n)=m!/(m−n)!=m(m−1)⋯(m−n+1).
• Example, P(9,3)=9⋅8⋅7=504
• P(8,4)=8⋅7⋅6⋅5=1680
Permutations
• Proposition2.6
• If X is an m-element set and n is a positive
integer with m≥n, then the number of X-
strings of length nn that are permutations
is P(m,n).

Combinations
• Let X be a finite set and let k be an integer
with 0≤k≤|X|.
• Then a k-element subset of X is also called
a combination of size k.
• When |X|=n, the number of k-element subsets of X is
denoted 𝑛𝑘 .
• Numbers of the form 𝑛𝑘 are called binomial
coefficients, and many combinatorists read 𝑛𝑘 as
“n choose k.”
• We will use notation C(n,k) which is referred to as the
number of combinations of n things, taken k at a time.
Combinations
• If n and k are integers
with 0≤k≤n, then 𝑛𝑘 =C(n,k)=P(n,k)/k!=n!/k!(n−k)!

• Proposition2.10 : for all integers n and k with 0≤k≤n,


𝑛 𝑛
𝑘
= 𝑛−𝑘
• Example :
• A Southern restaurant lists 21 items in the “vegetable” category of
its menu. They sell a vegetable plate which gives the customer four
different vegetables from the menu. Since the order the vegetables
are placed on the plate is not important , there
are C(21,4)=5985 different ways for a customer to order a vegetable
plate at the restaurant.
Problem time ???
1. How many permutations are there of the letters a, b, c, d, e, f?
2. How many functions f:{1,2,…,8}→{1,2,…,8}
are bijective?
3. How many 4 letter “words” can you make from the letters a through
f, with no repeated letters?
4. How many functions f:{1,2,3}→{1,2,3,4,5,6,7,8}
are injective?
5 You decide to have a dinner party. Even though you are incredibly
popular and have 14 different friends, you only have enough chairs to
invite 6 of them.
i) How many choices do you have for which 6 friends to invite?
ii) What if you need to decide not only which friends to invite but also
where to seat them along your long table? How many choices do you
have then?
• Sum of first n natural numbers 1+2+3+⋯+n=n(n+1)/2.
• Consider an (n+1)×(n+1) array of dots as shown in
figure . There are (n+1)2 dots altogether, with exactly
(n+1)on the main diagonal.
• The off-diagonal entries split naturally into two equal
size parts, those above and those below the diagonal.
• Furthermore, each of those two parts has
S(n)=1+2+3+⋯+n dots
• It follows that S(n)=((n+1)2−(n+1))/2
• Let n be a positive integer. Explain why
1+3+5+⋯+2n−1=n2 using combinatorics.(???)
The Ubiquitous Nature of Binomial
Coefficients
• In this section, we will see several combinatorial problems
that can be solved by using binomial coefficients.
• Example2.21 : The office assistant is distributing supplies.
In how many ways can he distribute 18 identical folders
among four office employees: A, B, C and D with the
additional restriction that each will receive at least one
folder?
• Imagine the folders are placed in a row. Then there are 17
gaps between them. Of these gaps, choose three and place
a divider in each. Then this choice divides the folders into
four non-empty sets. The first goes to A, the second to B,
etc. Thus the answer is C(17,3). In follow fig , we illustrate
this scheme with A receiving 6 folders, B getting 1, C 4 and
D 7.
• Suppose we redo the preceding problem but drop the
restriction that each of the four employees gets at least one
folder. Now how many ways can the distribution be made?
• This is accomplished by artificially inflating everyone's
allocation by one. Hence if B will get 7 folders, we say that
he will get 8. Also, artificially inflate the number of folders
by 4, one for each of the four persons.
• So now imagine a row of 22=18+4 folders. Again, choose 3
gaps.
• This determines a non-zero allocation for each person.
• The actual allocation is one less—and may be zero. So the
answer is C(21,3).
• Again we have the same problem as before,
but now we want to count the number of
distributions where only A and C are
guaranteed to get a folder. B and D are
allowed to get zero folders. Now the trick is to
artificially inflate B and D's allocation, but
leave the numbers for A and C as is.
• So the answer is C(19,3).
• How many integer solutions are there to the
equation x1+x2+x3+x4+x5 =13.
• (An integer solution to an equation is a
solution in which the unknown must have an
integer value.)
• where xi≥0 for each xi?
• where xi>0 for each xi?
• where xi≥2 for each xi?
• This problem is just like giving 13 cookies to 5 kids. We
need to say how many of the 13 units go to each of the 5
variables.
• If xi can be 0 or greater, we are in the standard case with no
restrictions. So 13 cookies and 4 bars can be arranged in
C(17,4)ways.
• Now each variable must be at least 1. So give one unit to
each variable to satisfy that restriction. Now there are 8
cookies left, and still 4 bars, so the number of solutions is
C(12,4).
• Now each variable must be 2 or greater. So before any
counting, give each variable 2 units. We now have 3
remaining cookies and 4 bars, so there are C(7,4) solutions.
Lattice Path
• A lattice path is one of the shortest possible
paths connecting two points on the lattice,
moving only horizontally and vertically. For
example, here are possible lattice paths
two paths through a 1×1 lattice

Six paths through a 2×2 lattice:

20 paths through a 3×3 lattice:


Lattice Path
• A lattice path in the plane is a sequence of ordered
pairs of integers: (m1,n1),(m2,n2),(m3,n3),…,(mt,nt) so
that for all i=1,2,…,t−1,either
1. mi+1=mi+1 and ni+1=ni, or
2. mi+1=mi and ni+1=ni+1.

• The number of lattice paths from (m,n) to (p,q) is


C((p−m)+(q−n),p−m).(why??)
• Note that a lattice path is just an X-string with X={H,V},
where H stands for horizontal and V stands for vertical.
In this case, there are exactly (p−m)+(q−n) moves, of
which p−m are horizontal.
Lattice Path
• Let n be a non-negative integer. Then the
number of lattice paths from (0,0) to (n,n)
which never go above the diagonal line y=x is
the Catalan number C(n)=1/n+1C(2n,n).
The Binomial Theorem
• Binomial Theorem
– Let x and y be real numbers with x, y and x+y non-zero. Then for every
non-negative integer n

Proof : View (x+y)n as a product

Each term of the expansion of the product results from choosing either x
or y from one of these factors. If x is chosen n−i times and y is chosen i
times, then the resulting product is xn−iyi. Clearly, the number of such
terms is C(n,i), i.e., out of the n factors, we choose the element y from i
of them, while we take x in the remaining n−i.
• The Binomial Theorem helps in finding coefficient
of any term in given expansion
• Eg : coefficient of x5y8 in (2x−3y)13 is
C(13,5)25(−3)8.
• It can also be used for expansion of terms :
• (x+y)1= x+y
• (x+y)2=x2+2xy+y2
• (x+y)3=x3+3x2y+3xy2+y3(x+y)3
• (x+y)4=x4+4x3y+6x2y2+4xy3+y4
Examples of binomial coefficients
• How many subsets of {1,2,3,4,5}contain exactly 3 elements? We must choose
3 of the 5 elements to be in our subset. There are C(5,3) ways to do this.
• How many bit strings have length 5 and weight 3? We must choose 3 of the 5
bits to be 1's. There are C(5,3) ways to do this, so there are C(5,3) such bit
strings.
• How many lattice paths are there from (0,0) to (3,2)? We must choose 3 of the
5 steps to be towards the right. There are C(5,3) ways to do this, so there are
C(5,3) such lattice paths.
• When we arrange binomial coefficients we get Pascal’s Triangle
• Observations about Pascal’s Triangle:
1. The entries on the border of the triangle are all 1.
2. Any entry not on the border is the sum of the two entries above it.
3. The triangle is symmetric. In any row, entries on the left side are mirrored on
the right side.
4. The sum of all entries on a given row is a power of 2.
Multinomial Coefficients
• General form is

• For example, the number of distinct permutations of the letters of the


word MISSISSIPPI, which has 1 M, 4 Is, 4 Ss, and 2 Ps is
11
• 1442
= 11 !/ 1 ! 4 ! 4 ! 2 ! = 34650.
• One can use the multinomial theorem to generalize Pascal’s triangle
Multinomial Theorem
Example :

Das könnte Ihnen auch gefallen