Discrete Mathematics -- Chapter 1: Fundamental Ch t 1 F d t l - - PowerPoint PPT Presentation

discrete mathematics
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

Outline

Preface & Introduction Sum & Product Permutations Combinations: The Binomial Theorem (二項式定理) Combinations: The Binomial Theorem (二項式定理) Combinations with Repetition

Th C t l N b

The Catalan Numbers Summary

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

2

slide-3
SLIDE 3

Take a look …

1 * 8 + 1 = 9 12 * 8 + 2 = 98 12 8 + 2 = 98 123 * 8 + 3 = 987 1234 * 8 + 4 = 9876 12345 * 8 + 5 = 98765 12345 8 5 98765 123456 * 8 + 6 = 987654

Theorem is art, art is theorem.

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

3

slide-4
SLIDE 4

What is Discrete Mathematics?

數學的幾個分支的總稱,以研究離散量的結構和相互

間的關係為主要目標

研究對象 一般地是有限個或可數無窮個元素

研究對象: 一般地是有限個或可數無窮個元素 內容包含:數理邏輯、集合論、代數結構、圖論、組合學、

數論等。(Wikipedia) 數論等 (Wikipedia)

研究有離散結構的系統的學科

e.g, 班級人數, 課程安排, 水,

g, , , ,

離散 v.s. 連續 描述了電腦科學離散性的特點 基礎核心部分: 組合學(計數、排列、組合結構的分

析)和圖論

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

4

slide-5
SLIDE 5

Counting

Capable of solving difficult problems.

Coding theory, probability and statistics

Help the analysis and design of efficient algorithms.

Help the analysis and design of efficient algorithms.

E.g.,

? 3 2 1 + + ? 4 3 ? 3 2 1 = × = + + ? 2 =

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

5

slide-6
SLIDE 6

Counting Example 1

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

slide-7
SLIDE 7

Counting Example 2

Fibonacci Sequence

By Fibonacci an mathematician in the 13th century By Fibonacci, an mathematician in the 13th century Counting rabbits rules: rules:

How many rabbits after some period of time ? How many rabbits after some period of time ?

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

7

slide-8
SLIDE 8

The Fibonacci Sequence

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

slide-9
SLIDE 9

The Fibonacci Sequence

Fn represents the number of rabbits in period n F = 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 =

the number of rabbits (adult and baby) in the previous

⎠ ⎜ ⎜ ⎝ − ⎠ ⎜ ⎜ ⎝ = 2 5 2 5

用無理數算出自然數!

the number of rabbits (adult and baby) in the previous time period

F

th b f b b bbit t ti i d th

Fn-2 : the number of baby rabbits at time period n = the

number of adult rabbits in Fn-1, which is Fn-2

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

1 when m=1

slide-10
SLIDE 10

Counting Example 3

假設有n個人。從中挑選若干人(任意數量)

出來。將挑選出來的人分成若干(任意數量) 出來 將挑選出來的人分成若干(任意數量) 組。將任意一個這樣分出來的組稱之為一個 “系統"。那麼一共可以有多少個兩兩不同的 系統 那麼一共可以有多少個兩兩不同的 系統呢?

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

10

slide-11
SLIDE 11

1.1 The Rules of Sum and Product

Th R l f S

The Rule of Sum

  • If a first task can be performed in m ways, while a second task can be

performed in n ways, and the two tasks cannot be performed simultaneously, then performing either task can be accomplished in any

  • ne of m+n ways.
  • The Rule of Product
  • If a procedure can be broken down into first and second stages, and if

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

  • utcomes, there are n possible outcomes for the second stage, then the

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

slide-12
SLIDE 12

1.2 Permutations

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?

slide-13
SLIDE 13

Permutations with Repeated Objects

If there are n objects with n1 indistinguishable objects

  • f a first type, n2 indistinguishable objects of a second

t d i di ti i h bl bj t f th t type, …, and nr indistinguishable objects of an rth type, where n1+ n2+…+ nr = n.

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.

slide-14
SLIDE 14

Permutations with Repeated Objects

Ex 1.14: Determine the

number of (staircase) paths in the xy-plane from (1, 1) to (4, 3), where each such path is

3 R

made up of individual steps going one unit to the right or it d

R U R U U U

  • ne unit upward.

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

slide-15
SLIDE 15

Permutations with Repeated Objects

(Exercise in textbook P45)

! 11 ) a ! 4 !* 7 ) a ! 4 * ! 4 ! 11 ) b ! 1 !* 3 * ! 2 !* 2 ! 4 !* 7 ) − b

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

15

slide-16
SLIDE 16

Combinatorial Proofs

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

slide-17
SLIDE 17

Arrangement around a Circle

Consider n distinct objects Two arrangements are considered the same when one can

g be obtained from the other by rotation.

How many different circular arrangements?

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

slide-18
SLIDE 18

Arrangement around a Circle

Ex 1.17: arrange six people (3 males, 3 females)

around the table so that the sexes alternate. around the table so that the sexes alternate.

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

slide-19
SLIDE 19

1.3 Combinations: The Binomial Theorem

If there are n distinct objects and r is an integer, with

1≤ r ≤ n

The number of combinations (selections without

reference to order) of size r for the n objects is

⎞ ⎛

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( 0) C( ) 1 f ll ≥ 0

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

slide-20
SLIDE 20

Combinations

Ex 1.18

  • A hostess is having a dinner party for some members of her charity
  • committee. Because of the size of her home, she can invite only 11
  • committee. Because of the size of her home, she can invite only 11
  • f the 20 committee members.
  • So, how many different ways can she invite “the lucky 11”?

960 , 167 ! 9 ! 11 ! 20 11 20 ) 11 , 20 ( = ⋅ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = C

  • Once the 11 arrive, how to arranges them around her rectangular

dining table is an arrangement problem.

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

20

slide-21
SLIDE 21

Combinations

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 ⎠ ⎝ ⎠ ⎝

slide-22
SLIDE 22

Combinations

Ex 1.20 A student taking a history examination is directed to answer

any seven of 10 essay questions. There is no concern about

  • rder here.

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

slide-23
SLIDE 23

Combinations

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

slide-24
SLIDE 24

Overcounting

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

窮舉

slide-25
SLIDE 25

Theorem 1.1: The Binomial Theorem

= − −

⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = +

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 + +

slide-26
SLIDE 26

Theorem 1.1: The Binomial Theorem

the coefficient of x2y2 in the expansion of (x+y) 4

is

6 4⎞ ⎜ ⎜ ⎛

is

6 2 = ⎠ ⎜ ⎜ ⎝

y x + y x y + y x y x + + y

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

26

slide-27
SLIDE 27

The Binomial Theorem

⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = +

= − − 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

  • a) What is the coefficient of x5y2 in the expansion of (x + y)7?
  • b) What is the coefficient of a5b2 in the expansion of (2a - 3b)7?

7 2 5

7 is ) ( in

  • f

t coefficien the a) y x y x ⎞ ⎜ ⎜ ⎛ + 3 , 2 ) 5 is ) ( in

  • f

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

slide-28
SLIDE 28

Corollaries of The Binomial Theorem

⎞ ⎛ ⎞ ⎛ ⎞ ⎛ n n n

Corollary 1.1:

? ... 1 a) ⎞ ⎛ ⎞ ⎛ ⎞ ⎛ = ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + + ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ n n n n 2n ? ) 1 ( ... 1 b) = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − + + ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ n n n n

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 2 2 2 about how

2

= ⎞ ⎜ ⎜ ⎛ + + ⎞ ⎜ ⎜ ⎛ + + ⎞ ⎜ ⎜ ⎛ + ⎞ ⎜ ⎜ ⎛ + ⎞ ⎜ ⎜ ⎛ n n n n n

n k

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

28

? 2 ... 2 ... 2 2 1 2 about how ⎠ ⎜ ⎜ ⎝ + + ⎠ ⎜ ⎜ ⎝ + + ⎠ ⎜ ⎜ ⎝ + ⎠ ⎜ ⎜ ⎝ + ⎠ ⎜ ⎜ ⎝ n k

slide-29
SLIDE 29

Theorem 1.2 : The Multinomial Theorem

The coefficient of in the expansion of

⎞ ⎜ ⎜ ⎛ = n n!

t n t n n

x x x ⋅ ⋅ ⋅

2 2 1 1

is ) (

n

x x x + + +

where 0 ≤ ni ≤ n, and n1+ n2+…+ nt = n.

⎠ ⎜ ⎜ ⎝ ⋅ ⋅ ⋅ =

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

Multinomial coefficient

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

29

Multinomial coefficient t=2 binomal coefficient

slide-30
SLIDE 30

The Multinomial Theorem

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

  • f

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 =

slide-31
SLIDE 31

1.4 Combination with Repetition

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

time, with repetition, is

⎞ ⎜ ⎜ ⎛ − + = − + = − + 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 (

slide-32
SLIDE 32

1.4 Combination with Repetition

Ex 1.31 In how many ways can we distribute seven bananas and six

  • ranges among four children so that each child receives at least
  • ranges among four children so that each child receives at least
  • ne banana?

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

slide-33
SLIDE 33

1.4 Combination with Repetition

E 1 33

  • Ex 1.33
  • Determine all integer solutions to the equation

x1+ x2 + x3 + x4= 7, where xi ≥ 0 for all 1 ≤ i ≤ 4. 4 7 C(4 7 1 7)

  • n=4, r=7 C(4+7-1, 7)
  • Equivalence: C(n + r - 1, r)

q ( )

  • The number of integer solutions of the equation

x1+ x2 +… + xn= r, where xi ≥ 0 for all 1 ≤ i ≤ n.

  • The number of selections, with repetition, of size r from a collection of size n.

p

  • The number of ways r identical objects can be distributed among n distinct

containers. =the number of ways r distinct objects be distributed among n identical containers ?

  • Difference
  • The arrangement of size r from n distinct objects can be obtained in nr ways.

distributed among n identical containers ?

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

33

slide-34
SLIDE 34

1.4 Combination with Repetition

the number of ways r objects be distributed among n containers

r distinct r identical n distinct

nr

C(n+r-1, r) n identical

X

See Chapt er 9

nr/n!X

See Chapt er 5 See Chapt er 9

n /n!

n

i S ) (

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

34

= i

i r S

1

) , (

slide-35
SLIDE 35

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

slide-36
SLIDE 36

1.4 Combination with Repetition

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

slide-37
SLIDE 37

1.4 Combination with Repetition

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

slide-38
SLIDE 38

1.4 Combination with Repetition

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

slide-39
SLIDE 39

1.4 Combination with Repetition

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

slide-40
SLIDE 40

1.5 Catalan Number

Count paths from (0,0)(5,5) but never rise over the

line y=x y

No constraint C(10,5) With constraint With constraint

C(10,5)-C(10,4)

E h R U f

Exchange R,U after

the first “crossing” U RUUURRRUUR RUURUUURRU

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

RUURUUURRU

40

slide-41
SLIDE 41

1.5 Catalan Number

From (0,0)(n,n)

⎞ ⎛ ⎞ ⎛ ⎞ ⎛ ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ + = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ − − ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = = n n n n n n n b path

n

2 1 1 1 2 2 #

which can determine the number of ways to

parenthesize the product

x x x x x L

parenthesize the product .

E.g., n=4, #parenthesis = b3 = ¼*C(6,3) = 5

n

x x x x x L

4 3 2 1

))) ( ( ( )) ) (( ( )), )( (( )), ) ( (( ), ) ) (((

4 3 2 1 4 3 2 1 4 3 2 1

x x x x x x x x x x x x x x x x x x x x

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

41

))) ( ( ( )), ) (( (

4 3 2 1 4 3 2 1

x x x x x x x x

slide-42
SLIDE 42

1.6 Summary

Fundamental techniques in counting:

  • Top-down approach: Divide the problems into subproblems suitable

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

slide-43
SLIDE 43

Observation & Tricks

The previous 4 cases are not answers by themselves.

Instead they are tools that you have to learn to use.

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

slide-44
SLIDE 44

Homework

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

compositions of n have each summand a multiple of k?

Check example 3.11

Discrete Mathematics Discrete Mathematics – – Ch 1 Ch 1 2009 Spring 2009 Spring

44

p