Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  ·...

48
Discrete Mathematics Lecture Notes Prof. Yuh-Dauh Lyuu Dept. Computer Science & Information Engineering and Department of Finance National Taiwan University c 2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 1

Transcript of Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  ·...

Page 1: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Discrete Mathematics Lecture Notes

Prof. Yuh-Dauh Lyuu

Dept. Computer Science & Information Engineering

and

Department of Finance

National Taiwan University

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 1

Page 2: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Class Information

• Grimaldi. Discrete and Combinatorial Mathematics.

– An excellent book for undergraduate students.

– All odd-numbered exercises have an answer.

– We more or less follow the topics of the book.

– More “advanced” materials may be added.

• Subjects on probability theory, algorithms, boolean

circuits, and information theory will be skipped as they

are covered by other classes.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 2

Page 3: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Class Information (concluded)

• More information and lecture notes (in PDF format) can

be found at

www.csie.ntu.edu.tw/~lyuu/dm.html

– Homeworks, exams, solutions and teaching assistants

will be announced there.

• Please ask many questions in class.

– The best way for me to remember you in a large

class.a

a“[A] science concentrator [...] said that in his eighth semester of

[Harvard] college, there was not a single science professor who could

identify him by name.” (New York Times, September 3, 2003.)

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 3

Page 4: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Grading

• Homeworks.

– Do not copy others’ homeworks.

– Do not give your homeworks for others to copy.

• Two to three exams.

• You must show up for the exams in person.

• If you cannot make it to an exam, please email me or a

TA beforehand (there should be a legitimate reason).

• Missing the final exam will automatically earn a “fail”

grade.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 4

Page 5: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Fundamental Principles of Counting

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 5

Page 6: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

And though the holes were rather small,

they had to count them all.

— The Beatles,

A Day in the Life (1967)

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 6

Page 7: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Counting

• Capable of solving difficult problems.

• Sometimes useful in reproving difficult theorems in

mathematics in an elementary way.

• Very useful in establishing the existence of solutions.

• Occasionally helps design efficient algorithms.

• Essential for the analysis of algorithms.

• Exact counts may not be necessary in many applications.

• Maybe the only method available to solve some open

problems in complexity theory.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 7

Page 8: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Founder of Combinatoricsa

• Archimedes (287BC–212BC) is the founder.b

• Archimedes in his Stomachion tried to find the number

of ways we put the 14 pieces together to make a square

(see next page).

• The answer was 17,152.

aGina Kolata, “In Archimedes’ Puzzle, a New Eureka Moment,” New

York Times, December 14, 2003.bReviel Netz (2003).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 8

Page 9: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 9

Page 10: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Permutation and Combination

• n! = n · (n− 1) · · · 1.

• 0! = 1.

•C(n, k) ≡

(n

k

)=

n!

k! (n− k)!

for 0 ≤ k ≤ n.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 10

Page 11: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Permutations with Repetition

• Suppose there n distinct objects and r is an integer,

0 ≤ r.

• The number of permutations (linear arrangements of

these objects) of size r is

nr

when repetitions are allowed.

– There are n choices for the 1st position, n for the

2nd, etc.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 11

Page 12: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

The Proof (concluded)

?

nchoices

2

?

nchoices

2

?nchoices

2

?

nchoices

2

· · ·

?

nchoices

2

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 12

Page 13: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Palindromes

• A palindrome is a sequence of symbols that reads the

same left to right as right to left.

– For example, abccba (even length) and abcdcba

(odd length).

– For numbers, the leading digit should be nonzero

(015 is not allowed).

• A key observation: The first half mirrors the second half.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 13

Page 14: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Palindromic Decimal Numbers

Lemma 1 The number of palindromic decimal numbers of

even length n is 9× 10(n/2)−1.

• A palindromic decimal number of length n = 2k looks

like1st half︷ ︸︸ ︷

a2ka2k−1 · · · ak+1

mirror half︷ ︸︸ ︷ak+1 · · · a2k−1a2k,

where 0 ≤ ak+1, ak+2, . . . , a2k−1 ≤ 9 and 1 ≤ a2k ≤ 9.

• The count is therefore 9× 10k−1 = 9× 10(n/2)−1.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 14

Page 15: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Palindromic Decimal Numbers (continued)

Corollary 2 A palindromic decimal number of even length

is a multiple of 11.

• A palindromic decimal number of length n = 2k looks

like1st half︷ ︸︸ ︷

a2ka2k−1 · · · ak+1

mirror half︷ ︸︸ ︷ak+1 · · · a2k−1a2k .

• It equals

a2k102k−1 + a2k−110

2k−2 + · · ·+ ak+110k

+ak+110k−1 + · · ·+ a2k−110 + a2k

= a2k(102k−1 + 100) + a2k−1(10

2k−2 + 10) + · · ·

+ak+1(10k + 10k−1).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 15

Page 16: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Palindromic Decimal Numbers (continued)

Lemma 3 The number of palindromic decimal numbers of

odd length n is 9× 10(n−1)/2.

• A palindromic decimal number of length n = 2k + 1

looks like︷ ︸︸ ︷a2k+1a2k · · · ak+2 ak+1

︷ ︸︸ ︷ak+2 · · · a2ka2k+1,

where 0 ≤ ak+1, ak+2, . . . , a2k ≤ 9 and 1 ≤ a2k+1 ≤ 9.

• The count is therefore 9× 10k = 9× 10(n−1)/2.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 16

Page 17: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Palindromic Decimal Numbers (concluded)

Combine the above two lemmas to obtain

Theorem 4 The number of palindromic decimal numbers of

length n is 9× 10⌊(n−1)/2⌋.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 17

Page 18: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Permutations

• Suppose there are n distinct objects and r is an integer,

1 ≤ r ≤ n.

• The number of permutations (linear arrangements of

these objects) of size r is

P (n, r) = n(n− 1) · · · (n− r + 1) =n!

(n− r)!.

• In particular,

P (n, n) = n!.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 18

Page 19: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Permutations with Repeated Objects

• Suppose there n objects with n1 of a first type, n2 of a

second type, . . ., and nr of an rth type, where∑

i ni = n

and 1 ≤ r ≤ n.

• Objects of the same type are indistinguishable.

• The number of permutations of these objects is

n!

n1!n2! · · ·nr!. (1)

– 10!4!3!1!1! = 25, 200 permutations of MASSASAUGA.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 19

Page 20: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proofs

Lemma 5 (2k)!2k

is an integer.

• Consider 2k symbols x1, x1, x2, x2, . . . , xk, xk.

• The number of ways they can be permuted is

(2k)!

2! 2! · · · 2!=

(2k)!

2k.

• It must be an integer.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 20

Page 21: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Arrangement around a Circle

• Consider n distinct objects.

• Consider two circular arrangements to be equivalent if

one can be obtained from the other by rotation.

• The number of circular arrangements is

n!

n= (n− 1)!.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 21

Page 22: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

A

B

C

D

D

A

B

C

C

D

A

B

B

C

D

A

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 22

Page 23: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Two Proofs

• First proof:

– For each linear arrangement, n− 1 others can be

rotated to give the same linear arrangement.

• Second proof:

– Fix say the first object to a particular position.

– The problem becomes that of permuting n− 1

distinct objects.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 23

Page 24: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Circular Arrangement with Restrictions

• There are 2 types of objects.

• Consider n/2 distinct objects of type one and n/2

distinct objects of type two.

• The number of circular arrangements where object types

alternate is

(n/2)! [(n/2)− 1]!.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 24

Page 25: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

The Proof

• Fixing say the first object of type one to a particular

position.

• Clockwise:

– There are n/2 ways to fill the next position with a

type-two object.

– There are (n/2)− 1 ways to fill the next position

with a type-one object.

– And so on.

• So the desired number is

(n/2)[(n/2)− 1][(n/2)− 1] · · · 1 · 1 = (n/2)! [(n/2)− 1]!.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 25

Page 26: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinations

• Suppose there n distinct objects and r is an integer,

1 ≤ r ≤ n.

• The number of combinations (selections without

reference to order) of r of these objects is

C(n, r) =

(n

r

)=

n(n− 1) · · · (n− r + 1)

r(r − 1) · · · 1.

– C(n, r) = P (n, r)/r! because order is irrelevant.

• C(n, 0) = 1 for all n ≥ 0.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 26

Page 27: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinations (concluded)

• It is easy to check that

C(n, r) = C(n, n− r)

for all n ≥ 0.

• We shall adopt the convention that(n

i

)= 0

for i < 0 or i > n, where n is a positive integer.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 27

Page 28: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Basic Properties of Combinations

• A finite sequence (a1, a2, . . . , an) of real numbers is

unimodal if there exists a positive integer 1 < j < n

such that

a1 < a2 < · · · < aj−1 ≤ aj > aj+1 > · · · > an.

• (C(n, 0), C(n, 1), . . . , C(n, n)) is unimodal.

– C(n, r + 1)/C(n, r) = (n− r)/(r + 1).

– C(n, n/2) is the maximum element when n is even.

– C(n, (n− 1)/2) and C(n, (n+ 1)/2) are the

maximum elements when n is odd.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 28

Page 29: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

An Example

How many ways are there to arrange TALLAHASSEE with

no adjacent As?

• Rearrange the characters as AAAEEHLLSST.

• AAAEEHLLSST has 11 characters among which there

are 3 As.

• There are 8!2! 2! 2! 1! 1! = 5, 040 ways to arrange the 8

non-A characters.

• For each such arrangement, there are 9 places to insert

the 3 As:

2 T 2 A 2 A 2 E 2 E 2 H 2 L 2 L 2 S 2 S 2 A 2.

• The desired number is hence 5, 040×(93

)= 423, 360.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 29

Page 30: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Pascal’sa Identity

Lemma 6(n+1r

)=

(nr

)+(

nr−1

).

• Algebraic proof.

• Combinatorial proof.

• Generating-function proof (p. 427).

aBlaise Pascal (1623–1662).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 30

Page 31: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Newton’sa Identity

Lemma 7(nr

)(rk

)=

(nk

)(n−kr−k

).

• Here is a combinatorial proof.

• A university has n professors.

• The faculty assembly requires r professors.

• Among the members of the assembly, k serve the

executive committee.

• Let us count the number of ways the executive

committee can be formed.

aIsaac Newton (1643–1727).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 31

Page 32: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

The Proof (continued)

• We can first form the assembly in(nr

)ways.

• Then we pick the executive committee members from

the assembly in(rk

)ways.

• The total count is(nr

)(rk

).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 32

Page 33: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

The Proof (concluded)

• Alternatively, we can pick the executive committee first,

in(nk

)ways.

• Then we pick the remaining r − k members of the

assembly in(n−kr−k

)ways.

• The total count is(nk

)(n−kr−k

).

• As we count the same thing twice, they must be equal.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 33

Page 34: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice

Lemma 8 For m,n ≥ 0,∑n

k=m

(km

)=

(n+1m+1

).

• We want to pick m+1 tickets from a set of n+1 tickets.

• There are(n+1m+1

)ways.

• Alternatively, label the n+ 1 tickets from 0 to n.

• There are(km

)ways to do the selection when the ticket

with the largest number is k (m ≤ k ≤ n).

• Alternative proof: Apply Lemma 6 (p. 30) iteratively.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 34

Page 35: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice (continued)

Corollary 9∑m

k=1 k(k + 1) = 2(m+23

).

Note that

m∑k=1

k(k + 1) = 2

m∑k=1

(k + 1

2

)= 2

(m+ 2

3

)by Lemma 8 (p. 34).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 35

Page 36: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice (continued)

Corollary 10 For m,n ≥ 0,∑m

k=0

(n+kk

)=

(n+m+1

m

).

Note that

m∑k=0

(n+ k

k

)=

m∑k=0

(n+ k

n

)

=n+m∑k=n

(k

n

)=

(n+m+ 1

n+ 1

)by Lemma 8 (p. 34)

=

(n+m+ 1

m

).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 36

Page 37: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice (continued)

Corollary 11 1 + 2 + · · ·+ n = n(n+ 1)/2.

• Set m = 1 in Lemma 8 (p. 34) to obtain

n∑k=1

(k

1

)=

(n+ 1

2

).

• But this is equivalent to

n∑k=1

k = n(n+ 1)/2,

as desired.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 37

Page 38: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice (continued)

Lemma 12(m+n

2

)−

(m2

)−(n2

)= mn.

• Consider m men and n women.

• The number of heterosexual marriages is mn.

• On the other hand, there are(m+n

2

)ways to choose 2

persons.

• Among them,(m2

)+(n2

)are same-sex.

Corollary 13(2n2

)= n2 + 2

(n2

).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 38

Page 39: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice (continued)

Corollary 14 12 + 22 + · · ·+ n2 = n(n+ 1)(2n+ 1)/6.

• From Corollary 13 (p. 38),

n∑k=1

k2 =n∑

k=1

(2k

2

)− 2

n∑k=2

(k

2

)

=n∑

k=1

k(2k − 1)− 2

(n+ 1

3

)by Lemma 8 (p. 34).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 39

Page 40: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Combinatorial Proof: Counting It Twice (concluded)

• Son∑

k=1

k2 = 2n∑

k=1

k2 −n∑

k=1

k − 2

(n+ 1

3

).

• We conclude that

n∑k=1

k2 =n∑

k=1

k + 2

(n+ 1

3

)=

n(n+ 1)

2+

n(n+ 1)(n− 1)

3

=n(n+ 1)(2n+ 1)

6.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 40

Page 41: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Binomial Random Walk

• A particle starting at the origin can move right (up) or

left (down) in each step.

+

• It is a standard model for stock price movements called

the binomial option pricing model.a

aCox, Ross, and Rubinstein (1979).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 41

Page 42: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Dynamics of the Binomial Random Walk

Lemma 15 The number of ways the particle can move from

the origin to position k in n steps is(n

n+k2

). (2)

(Assume that n+ k is even.)

• To reach position k, the number of up moves must

exceed the number of down moves by exactly k.

– UUDUUDUUD reaches position 3 in 9 steps as there

are 6 Us and 3 Ds.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 42

Page 43: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

The Proof (concluded)

• Now

(n+ k)/2 + (n− k)/2 = n,

(n+ k)/2− (n− k)/2 = k.

• So the desired number equals the number of ways

(n+k)/2︷ ︸︸ ︷UU · · ·U

(n−k)/2︷ ︸︸ ︷DD · · ·D

can be permuted.

• The desired number is

n!

[(n+ k)/2]! [(n− k)/2]!=

(n

n+k2

).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 43

Page 44: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Probability of Reaching a Position

• Suppose the binomial random walk has a probability of

p of going up and 1− p of going down.

• The number of ways it is at position k after n steps is(n

n+k2

)by Eq. (2) on p. 42.

• The probability for this to happen is(n

n+k2

)p

n+k2 (1− p)

n−k2 .

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 44

Page 45: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Probability of Reaching a Position (concluded)

• Alternatively, suppose a position is the result of i up

moves and n− i down moves.

– Clearly, the position is i− (n− i) = 2i− n.

• The number of ways of reaching it after n steps is(n

i

).

• The probability for this to happen is(n

i

)pi(1− p)n−i. (3)

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 45

Page 46: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Vandermonde’s Convolutiona(n

i

)=

k∑l=0

(k

l

)(n− k

i− l

).

• Let stateb (i, j) be the result of j up moves and i− j

down moves.

• Suppose the walk starts at state (0, 0) and ends at (n, i).

• There are(ni

)such walks.

• State (k, l) is on (k

l

)(n− k

i− l

)walks that reach (n, i), where 0 ≤ k ≤ n and 0 ≤ l ≤ k.

aAlexandre-Theophile Vandermonde (1735–1796).bNot position. State (i, j) corresponds to position (i, 2j − i).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 46

Page 47: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

Vandermonde’s Convolution (concluded)

• Every walk that reaches (n, i) must go through a state

(k, l) for some 0 ≤ l ≤ k.

• Add up those walks that go through state (k, l) over

0 ≤ l ≤ k to obtaina(n

i

)=

k∑l=0

(k

l

)(n− k

i− l

).

• Applications in artificial neural networks.b

aTechnically, the summation should be over 0 ≤ l ≤ min(k, i). But

recall that(ni

)= 0 for i < 0 or i > n, where n is a positive integer.

bBaum and Lyuu (1991) and Lyuu and Rivin (1992).

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 47

Page 48: Discrete Mathematics Lecture Notes - National Taiwan …lyuu/dm/2012/20120223.pdf ·  · 2012-02-25Discrete Mathematics Lecture Notes ... [Harvard] college, there was not a single

(0,0) ( k , l )=(7,3)

( n , i )=(16,7)

The labels are for states, however, not positions.

c⃝2012 Prof. Yuh-Dauh Lyuu, National Taiwan University Page 48