Discrete Mathematics
Ch t 1 F d t l
- - Chapter 1: Fundamental
Principles of Counting
Hung-Yu Kao (高宏宇) Department of Computer Science and Information Engineering, N l Ch K U National Cheng Kung University
Discrete Mathematics -- Chapter 1: Fundamental Ch t 1 F d t l - - PowerPoint PPT Presentation
Discrete Mathematics -- Chapter 1: Fundamental Ch t 1 F d t l Principles of Counting Hung-Yu Kao ( ) Department of Computer Science and Information Engineering, N National Cheng Kung University l Ch K U Outline Preface
Hung-Yu Kao (高宏宇) Department of Computer Science and Information Engineering, N l Ch K U National Cheng Kung University
Preface & Introduction Sum & Product Permutations Combinations: The Binomial Theorem (二項式定理) Combinations: The Binomial Theorem (二項式定理) Combinations with Repetition
The Catalan Numbers Summary
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
2
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
3
數學的幾個分支的總稱,以研究離散量的結構和相互
研究對象 一般地是有限個或可數無窮個元素
研究對象: 一般地是有限個或可數無窮個元素 內容包含:數理邏輯、集合論、代數結構、圖論、組合學、
數論等。(Wikipedia) 數論等 (Wikipedia)
研究有離散結構的系統的學科
e.g, 班級人數, 課程安排, 水,
g, , , ,
離散 v.s. 連續 描述了電腦科學離散性的特點 基礎核心部分: 組合學(計數、排列、組合結構的分
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
4
Capable of solving difficult problems.
Coding theory, probability and statistics
Help the analysis and design of efficient algorithms.
E.g.,
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
5
How many rectangles in this graph? squares Ans # 2 6 * 2 4 − ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
6
Fibonacci Sequence
By Fibonacci an mathematician in the 13th century By Fibonacci, an mathematician in the 13th century Counting rabbits rules: rules:
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
7
1 pair 1 pair 1 pair 1 pair 2 pairs 2 pairs 3 pairs 3 pairs 5 pairs 5 pairs 8 pairs 8 pairs
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
8
p p p p p p F1 F2 F3 F4 F5 F6
Fn represents the number of rabbits in period n F = F
n n
⎞ ⎜ ⎜ ⎛ − − ⎞ ⎜ ⎜ ⎛ + = 5 1 1 5 1 1
用無理數算出自然數!
Fn = Fn-1 + Fn-2
Fn-1 : the number of adult rabbits at time period n =
⎠ ⎜ ⎜ ⎝ − ⎠ ⎜ ⎜ ⎝ = 2 5 2 5
用無理數算出自然數!
F
Fn-2 : the number of baby rabbits at time period n = the
Q: can you model the rabbit number if the adult rabbit will die : can you model the rabbit number if the adult rabbit will die
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
9
after m periods when they create a new pair of rabbits ? after m periods when they create a new pair of rabbits ?
e.g., Fn = Fn e.g., Fn = Fn-
1 when m=1
假設有n個人。從中挑選若干人(任意數量)
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
10
Th R l f S
The Rule of Sum
performed in n ways, and the two tasks cannot be performed simultaneously, then performing either task can be accomplished in any
there are m possible outcomes for the first stage and if for each of these there are m possible outcomes for the first stage and if, for each of these
total procedure can be carried out, in the designated order, in mn ways.
Ex 1.6: If a license plate consists of two letters followed by four digits,
how many different plates are there? 26×26×10×10×10×10
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
11
Rule combination
Permutation: counting linear arrangements of distinct objects If there are n distinct objects and r is an integer, with 1 ≤ r ≤ n,
then by the rule of product then by the rule of product,
The number of permutations of size r for the n objects is
) 1 ( ) 2 )( 1 ( ) ( r n n n n r n P + ) 1 )( 2 )( 3 ( ) 1 )( ( ) 1 )( 2 )( 3 ( ) 1 )( ( ) 1 ( ) 2 )( 1 ( ) 1 ( ) 2 )( 1 ( ) , ( r n r n r n r n r n n n n r n n n n r n P ⋅ ⋅ ⋅ − − − ⋅ ⋅ ⋅ − − − × + − ⋅ ⋅ ⋅ − − = + − ⋅ ⋅ ⋅ − − = )! ( ! ) 1 )( 2 )( 3 ( ) 1 )( ( r n n r n r n − =
n factorial
Ex 1.9: Given 10 students, three are to be chosen and seated in a row.
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
12
How many such linear arrangements are possible?
If there are n objects with n1 indistinguishable objects
the number of (linear) arrangements of the given n objects the number of (linear) arrangements of the given n objects
= ! !... ! !
2 1 r
n n n n
Ex 1.13: Arranging all of the letters in MASSASAUGA, we
2 1 r
g g , find there are possible arrangements, t hil ll f A’ t th
! 1 ! 1 ! 1 ! 3 ! 4 ! 10
! 1 ! 1 ! 1 ! 3 ! 7
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
13
arrangements while all four A’s are together.
Ex 1.14: Determine the
3 R
R U R U U U
As for xyz-space, from (1,1,1)
to (4 3 2)?
1 R U R U R R
to (4, 3, 2)?
1 4
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
14
(Exercise in textbook P45)
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
15
k)! 2 (
Prove that is an integer.
Consider 2k symbols x1, x1, x2, x2,…, xk, xk.
k
k 2 )! 2 (
The number of ways they can be arranged is
)! 2 ( )! 2 ( = k k
k
It must be an integer.
! 2 ! 2 ! 2 2 ⋅ ⋅ ⋅
k
Prove that is also an integer. k
m mk ) ! ( )! ( m ) ! (
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
16
Consider n distinct objects Two arrangements are considered the same when one can
How many different circular arrangements?
Thinking distinct linear arrangements for 4 objects, e.g., ABCD,
BCDA, CDAB, and …
So, the number of circular arrangements is?
A B C D 4!/4 = 3! A B D B C A D B D A C
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
17
C D A B
Ex 1.17: arrange six people (3 males, 3 females)
No constraint 6!/6 = 5! = 120 Sexes alternate 3 x 2 x 2 x 1 x 1 = 12
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
18
If there are n distinct objects and r is an integer, with
The number of combinations (selections without
⎞ ⎛
ti d “ h ”
)! ( ! ! 1 ) 1 ( ) 1 ( ) 1 ( ! ) , ( ) , ( r n r n r r r n n n r r n P r n r n C − = ⋅ ⋅ ⋅ − + − ⋅ ⋅ ⋅ − = = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
are sometimes read “n choose r”.
C(n, 0)= C(n, n)= 1, for all n ≥ 0. C(n, r)= C(n, n-r), for all n ≥ 0.
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
19
Ex 1.18
960 , 167 ! 9 ! 11 ! 20 11 20 ) 11 , 20 ( = ⋅ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = C
dining table is an arrangement problem.
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
20
Ex 1.19 To win the grand prize for PowerBall one must
match five numbers selected from 1 to 49 match five numbers selected from 1 to 49 inclusive and then must also match the powerball, an integer from 1 to 42 inclusive.
Consequently, by the rule of product, they can
l h i b i
⎞ ⎛ ⎞ ⎛
select the six numbers in ways.
128 , 089 , 80 1 42 5 49 = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
How about the case in Taiwan?
448 , 085 , 22 1 8 6 38 = ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
21
1 6 ⎠ ⎝ ⎠ ⎝
Ex 1.20 A student taking a history examination is directed to answer
any seven of 10 essay questions. There is no concern about
She can answer the examination in
ways
120 10 = ⎞ ⎜ ⎜ ⎛ She can answer the examination in ways If the student must answer three questions from the first five
and four questions from the last five.
7 ⎠ ⎜ ⎝
q
If the student must answer at least three questions from the
50 10 5 4 5 3 5 = × = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
first five.
⎞ ⎛ ⎞ ⎛ = + + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
5
5 5 110 10 50 50 2 5 5 5 3 5 4 5 4 5 3 5
窮舉 反例
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
22
∑
=
⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
5 3
7 5 5 ,
i
i i also
Ex 1.23 The number of arrangements of the letters in TALLAHASSEE
is? 600 , 831 ! 1 ! 1 ! 2 ! 2 ! 2 ! 3 ! 11 =
Permutations with Repeated Objects
How many of these arrangements have no adjacent A’s?
360 , 423 84 5040 3 9 ! 1 ! 1 ! 2 ! 2 ! 2 ! 8 = × = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ T L L H S S E E ⎠ ⎝ ⎠ ⎝ A A A
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
23
Ex 1.25 How many ways to draw five cards from a standard deck of 52
cards with no clubs?
⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ 5 39
How many ways to draw five cards with at least one club?
⎠ ⎜ ⎝ 5 C2 C5 D6 C9 H3
39 52 700 , 248 , 3 4 51 1 13 ⎞ ⎜ ⎛ ⎞ ⎜ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
What are the repetition cases ? C2 – C5 D6 C9 H3 C5 – C9 H3 C2 D6 C9 – D6 C2 H3 C5
例
203 , 023 , 2 5 39 13 39 5 13 1 39 4 13 2 39 3 13 3 39 2 13 4 39 1 13 203 , 023 , 2 5 5
5
= ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
∑
i i
窮舉 反例
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
24
5 5 1 4 2 3 3 2 4 1
1
⎠ ⎜ ⎝ − ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ ⎠ ⎜ ⎝ i i
窮舉
= − −
⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = +
n k k n k n n n n
y x k n y x n n y x n y x n y x
1 1
... 1 ) (
There are C(n, k) ways to choose k x’s and n-k y’s.
⎠ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝
k 0
C(n, k) is often referred to as a binomial coefficient.
y x +
In case (x+y)2
2 2
y xy y x + +
2 1 1 2 2
2 y x y x y x xy x + + +
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
25
2 y x y x y x + +
the coefficient of x2y2 in the expansion of (x+y) 4
6 4⎞ ⎜ ⎜ ⎛
6 2 = ⎠ ⎜ ⎜ ⎝
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
26
⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = +
= − − n k k n k n n n n
y x k n y x n n y x n y x n y x
1 1
... 1 ) (
Ex 1.26
7 2 5
7 is ) ( in
t coefficien the a) y x y x ⎞ ⎜ ⎜ ⎛ + 3 , 2 ) 5 is ) ( in
t coefficien the a) b y a x Set b y x y x − = = ⎠ ⎜ ⎜ ⎝ +
2 5 2 5 2 5 2 5 2 5
6048 ) 3 ( ) 2 ( 5 7 ) 3 ( ) 2 ( 5 7 5 7 b a b a b a y x = − ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = − ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
27
Corollary 1.1:
n
Proof
Part (a) set x=y=1
(b) d
Part (b) set x=-1 and y=1
∑ ⎞ ⎜ ⎜ ⎛ = ⎞ ⎜ ⎜ ⎛ + + ⎞ ⎜ ⎜ ⎛ + ⎞ ⎜ ⎜ ⎛ = +
− − n k n k n n n n
y x n y x n y x n y x n y x
1 1
... ) ( ∑ ⎠ ⎜ ⎜ ⎝ ⎠ ⎜ ⎜ ⎝ ⎠ ⎜ ⎜ ⎝ ⎠ ⎜ ⎜ ⎝
= k
y x k y x n y x y x y x ... 1 ) (
2
n k
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
28
The coefficient of in the expansion of
⎞ ⎜ ⎜ ⎛ = n n!
t n t n n
2 2 1 1
is ) (
n
x x x + + +
⎠ ⎜ ⎜ ⎝ ⋅ ⋅ ⋅ =
t t
n n n n n n , , , ! !... !
2 1 2 1
is ) (
2 1 t
x x x + ⋅ ⋅ ⋅ + +
i 1 2 t
Proof
The number of ways we can select x1 from n1 of the n factors, x2
1 2
y
1 1
,
2
from n2 of the n - n1 remaining factors, …
⎞ ⎜ ⎜ ⎛ ⎞ ⎜ ⎜ ⎛ − − − − ⎞ ⎜ ⎜ ⎛ − ⎞ ⎜ ⎜ ⎛
−
n n n n n n n n n
t
! ...
1 2 1 1 3
⎠ ⎜ ⎜ ⎝ ⋅ ⋅ ⋅ = ⋅ ⋅ ⋅ = ⎠ ⎜ ⎜ ⎝ ⎠ ⎜ ⎜ ⎝ ⎠ ⎜ ⎜ ⎝
t t
n n n n n n n n n
t t
, , ! ! ! ...
, 2 2 1
1 1 2 1 2 1 1
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
29
Ex 1.27 What is the coefficient of x5y2 in the expansion of (x + y+z)7?
! 7 7 ⎞ ⎛
What is the coefficient of a2b3c2d5 in the expansion of (a +2b-
3 +2d+5)16?
21 ! ! 2 ! 5 ! 7 2 5 7 = = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
3c+2d+5)16?
5 2 3 2 v z d y c x b w a Set = = = = =
16 4 5 2 3 2
4 , 5 , 2 , 3 , 2 16 is ) ( in
t coefficien the 5 , 2 , 3 , 2 , v z y x w v z y x w v z d y c x b w a Set ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + + + + = = − = = =
5 2 3 2 5 2 3 2 4 5 2 3 2 4 5 2 3 2
d c 00 000 456 891 435 d c (5) (2) (-3) ) 2 ( ) 1 ( 4 , 5 , 2 , 3 , 2 16 (5) (2d) (-3c) ) 2 ( ) ( 4 , 5 , 2 , 3 , 2 16 b a b a b a = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
30
d c 00 , 000 , 456 , 891 , 435 b a =
P ibl A th
Ex 1.28 How many different purchases
are possible for seven students
Possible way Another way c,c,h,h,t,t,f xx|xx|xx|x
are possible for seven students each having one of the following, a cheeseburger, a hot dog,
c,c, , , , , c,c,c,c,h,t,f c,c,c,c,c,c,f | | | xxxx|x|x|x xxxxxx|||x
a taco, or a fish sandwich?
)! 1 7 4 ( ! 10 10 − + = = ⎞ ⎜ ⎜ ⎛
h,t,t,f,f,f,f |x|xx|xxxx
7 ’ + 3 |’ The number of combinations of n objects taken r at a
)! 1 4 ( ! 7 ! 3 ! 7 7 − = = ⎠ ⎜ ⎜ ⎝
7 x’s + 3 |’s
⎞ ⎜ ⎜ ⎛ − + = − + = − + r n r n r r n C 1 )! 1 ( ) , 1 (
(foods) (students)
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
31
⎠ ⎜ ⎜ ⎝ − + r n r r r n C )! 1 ( ! ) , 1 (
Ex 1.31 In how many ways can we distribute seven bananas and six
Remaining bananas: 7-4=3
Distribute 3
g
3 bananas was distributed 4 children: (n=4, r=3)
C(4+3-1, 3) = C(6, 3) =20
Distribute 3 bananas to 4 children b|b|b|
6 oranges was distributed 4 children: (n=4, r=6)
C(4+6-1, 6)= C(9, 6)=84
Thus 20×84 1680
c1, c2, c3 c1, c3, c3 c3 c4 c4 b|b|b| b||bb| ||b|bb
Thus, 20×84=1680
c3, c4, c4 c4, c4, c4 ||b|bb |||bbb
3 b’s + 3 |’s
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
32
3 b s 3 | s
E 1 33
x1+ x2 + x3 + x4= 7, where xi ≥ 0 for all 1 ≤ i ≤ 4. 4 7 C(4 7 1 7)
q ( )
x1+ x2 +… + xn= r, where xi ≥ 0 for all 1 ≤ i ≤ n.
p
containers. =the number of ways r distinct objects be distributed among n identical containers ?
distributed among n identical containers ?
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
33
the number of ways r objects be distributed among n containers
See Chapt er 9
See Chapt er 5 See Chapt er 9
n
i S ) (
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
34
= i
i r S
1
) , (
r=3, distinct, n=3, distinct 3x3x3=27
ABC BC A BC A AB C B AC B C A AB C B AC B C A AB C B A C B AC =3x2=6 r distinct, n identical AC B C AB C B A A BC ABC BC A =3x2x1=6 Ans: 5 (=S(3,1)+S(3,2)+S(3,3)) A B C AB C B AC AC B C A B C AB r identical, n distinct
{{ABC},{AB,C},{AC,B},{BC,A},{A,B,C}}
AC B C A B C AB A C B AC B C AB A BC A BC ABC =C(3,2)=3 Ans: C(3+3-1, 3)=10 A BC A BC ABC n1 n2 n3 n1 n2 n3 n1 n2 n3 r identical, n identical Ans: 3
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
35
Ans: 3
Ex 1.35 How many nonnegative integer solutions to the inequality
x + x + + x < 10 ? x1+ x2 + … + x6 < 10 ?
Transform the problem to x1+ x2 +… + x6 + x7 = 10,
xi ≥ 0 for all 1 ≤ i ≤ 6, but x7 > 0.
i
,
7
y1+ y2 +… + y6 + y7 = 9, where y1 = xi for all 1 ≤ i ≤ 6,
and y7 = x7 -1.
C(7+9-1, 9) = 5050.
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
36
Ex 1.36 In the binomial expansion for (x + y)n, each term is of the form
C(n k)xkyn-k C(n, k)x y
The total number of terms in the expansion is the number of
nonnegative integer solutions of n1+ n2 = n. g g
1 2
C(2 + n - 1, n) = C(n+1, n)= n+1 . How many terms are there in the expansion of (w+x+y+z)10?
C(4+10 -1, 10)
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
37
Ex 1.39
k j i 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 k j i (i, j, k) = (13, 8, 6) (i, j, k) = (13, 8, 11) x (I, j, k)=(8, 4, 4)
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
38
|||xx||||x||||||||||||, 3 x’s 19|’s combinations = C(22, 3)=C(22, 9)=1540
Ex 1.39 Summation formula counter = C(n+2-1, 2)=C(n+1, 2) Also counter = ∑
+ ⎞ ⎜ ⎛ +
n
n n n ) 1 ( 1
Also, counter = ∑
=
+ = ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = + + + + =
i
n n n n i
1
2 ) 1 ( 2 3 2 1 L
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
39
Count paths from (0,0)(5,5) but never rise over the
No constraint C(10,5) With constraint With constraint
C(10,5)-C(10,4)
Exchange R,U after
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
40
From (0,0)(n,n)
n
which can determine the number of ways to
E.g., n=4, #parenthesis = b3 = ¼*C(6,3) = 5
n
4 3 2 1
4 3 2 1 4 3 2 1 4 3 2 1
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
41
4 3 2 1 4 3 2 1
Fundamental techniques in counting:
f di t d bi t i l th ti for discrete and combinatorial mathematics.
Order Is Relevant Repetitions Are Allowed Type of Result Formula Location in Text Relevant Are Allowed in Text Yes Yes Arrangement Page 7
r
n
Yes No No No Permutation Combination Page 7 Page 15
)! ( ! ) , ( r n n r n P − =
)! ( ! ! ) , ( n n r n C = ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ =
No Yes Combination with repetition g Page 27
)! ( ! ) , ( r n r r − ⎠ ⎜ ⎝
)! 1 ( ! )! 1 ( 1 ) , 1 ( − − + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − + = − + n r r n r r n r r n C
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
42
The previous 4 cases are not answers by themselves.
It is often not immediately clear which tool to use Experiences
try a small example and solve it by “brute force” try a small example and solve it by brute force . Verify your answers in the special cases (e.g., k=0 or n=k). More Practice, more experiences
, p
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
43
1-1~1-2: 22 28 36 1 1 1 2: 22, 28, 36 1-3: 8, 18 1 4: 14 19 26 1-4: 14, 19, 26 Supplementary: 16, 18 Due: One week after the end of Ch2
1-4.26
Let n m k be positive integers with n=mk How many Let n, m, k be positive integers with n mk. How many
Check example 3.11
Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring
44