peer to peer network properties

20
Extensible Networking Platform 1 1 - CSE 240 – Logic and Discrete Mathematics Review: Mathematical Induction Use induction to prove that the sum of the first n odd integers is n 2 . Base case (n=1): the sum of the first 1 odd integer is 1 2 . Yes, 1 = 1 2 . Assume P(k): the sum of the first k odd ints is k 2 . 1 + 3 + … + (2k - 1) = k 2 Prove that 1 + 3 + … + (2k - 1) + (2k + 1) = (k+1) 2 1 + 3 + … + (2k-1) + (2k+1) = k 2 + (2k + 1) = (k+1) 2

Upload: nguyentruc

Post on 02-Jan-2017

227 views

Category:

Documents


5 download

TRANSCRIPT

Page 1: Peer to Peer network properties

Extensible Networking Platform 1 1 - CSE 240 – Logic and Discrete Mathematics

Review: Mathematical Induction

Use induction to prove that the sum of the first n odd integers is n2.

Base case (n=1): the sum of the first 1 odd integer is 12. Yes, 1 = 12.

Assume P(k): the sum of the first k odd ints is k2. 1 + 3 + … + (2k - 1) = k2

Prove that 1 + 3 + … + (2k - 1) + (2k + 1) = (k+1)2

1 + 3 + … + (2k-1) + (2k+1) =

k2 + (2k + 1)= (k+1)2

Page 2: Peer to Peer network properties

Extensible Networking Platform 2 2 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

Deficient TilingA 2n x 2n sized grid is deficient if all but one cell is tiled.

2n

2n

Page 3: Peer to Peer network properties

Extensible Networking Platform 3 3 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

• We want to show that all 2n x 2n sized deficient grids can be tiled with tiles, called triominoes, shaped like:

Page 4: Peer to Peer network properties

Extensible Networking Platform 4 4 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

• Is it true for all 21 x 21 grids?

Page 5: Peer to Peer network properties

Extensible Networking Platform 5 5 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

Inductive Hypothesis:We can tile any 2k x 2k

deficient board using our fancy designer tiles.

Use this to prove:We can tile any 2k+1 x 2k+1

deficient board using our fancy designer tiles.

Page 6: Peer to Peer network properties

Extensible Networking Platform 6 6 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

2k

2k 2k

2k

2k+1

OK!! (by IH)

???

Page 7: Peer to Peer network properties

Extensible Networking Platform 7 7 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

2k

2k 2k

2k

2k+1

OK!! (by IH)

OK!! (by IH)

OK!! (by IH)

OK!! (by IH)

Page 8: Peer to Peer network properties

Extensible Networking Platform 8 8 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - a cool example

Page 9: Peer to Peer network properties

Extensible Networking Platform 9 9 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - why does it work?

Definition:A set S is “well-ordered” if every non-

empty subset of S has a least element.

Given (we take as an axiom): the set of natural numbers (N) is well-ordered.

Is the set of integers (Z) well ordered?No.

{ x Z : x < 0 } has no least

element.

Page 10: Peer to Peer network properties

Extensible Networking Platform 10 10 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - why does it work?

Is the set of non-negative reals (R) well ordered?

Page 11: Peer to Peer network properties

Extensible Networking Platform 11 11 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - why does it work?

Proof of Mathematical Induction:

We prove that (P(0) (k P(k) P(k+1))) (n P(n))

Assume1. P(0)2. k P(k) P(k+1)3. n P(n) n P(n)

Page 12: Peer to Peer network properties

Extensible Networking Platform 12 12 - CSE 240 – Logic and Discrete Mathematics

Mathematical Induction - why does it work?

Assume1. P(0)2. n P(n) P(n+1)3. n P(n) n P(n)

Let S = { n : P(n) }

What do we know? -P(k) is false because it’s in S. -k 0 because P(0) is true. -P(k-1) is true because P(k) is the least

element in S.

Page 13: Peer to Peer network properties

Extensible Networking Platform 13 13 - CSE 240 – Logic and Discrete Mathematics

Strong Mathematical Induction

If P(0) and n0 (P(0) P(1) … P(n)) P(n+1)

Thenn0 P(n) In our proofs, to show P(k+1), our

inductive hypothesis assumes that ALL of P(0), P(1), … P(k)

are true, so we can use ANY of them to make the inference.

Page 14: Peer to Peer network properties

Extensible Networking Platform 14 14 - CSE 240 – Logic and Discrete Mathematics

Game with Matches• Two players take turns removing any

number of matches from one of two piles of matches. The player who removes the last match wins

• Show that if two piles contain the same number of matches initially, then the second player is guaranteed a win

Page 15: Peer to Peer network properties

Extensible Networking Platform 15 15 - CSE 240 – Logic and Discrete Mathematics

Strategy for Second Player• Let P(n) denote the statement “the second

player wins when they are initially n matches in each pile”

• Basis step: P(1) is true, because only 1 match in each pile, first player must remove one match from one pile. Second player removes other match and wins

• Inductive step: suppose P(j) is True for all j 1<=j <= k.

• Prove that P(k+1) is true, that is the second player wins when each piles contains k+1 matches

Page 16: Peer to Peer network properties

Extensible Networking Platform 16 16 - CSE 240 – Logic and Discrete Mathematics

Strategy for Second Player• Suppose that the first player removes

r matches from one pile, leaving k+1 –r matches there

• By removing the same number of matches from the other pile the second player creates the situation of two piles with k+1-r matches in each. Apply the inductive hypothesis and the second player wins each time.

Page 17: Peer to Peer network properties

Extensible Networking Platform 17 17 - CSE 240 – Logic and Discrete Mathematics

Postage Stamp Example• Prove that every amount of postage

of 12 cents or more can be formed using just 4-cent and 5-cent stamps

• P(n) : Postage of n cents can be formed using 4-cent and 5-cent stamps

• All n >= 12, P(n) is true

Page 18: Peer to Peer network properties

Extensible Networking Platform 18 18 - CSE 240 – Logic and Discrete Mathematics

Postage Stamp Proof• Base Case: n = 12, n = 13, n = 14, n = 15

– We can form postage of 12 cents using 3, 4-cent stamps– We can form postage of 13 cents using 2, 4- cent stamps

and 1 5-cent stamp– We can form postage of 14 cents using 1, 4-cent stamp

and 2 5-cent stamps– We can form postage of 15 cents using 3, 5-cent stamps

• Induction Step– Let n >= 15– Assume P(k) is true for 12 <= k <= n, that is postage of

k cents can be formed with 4-cent and 5-cent stamps (Inductive Hypothesis)

– Prove P(n+1)– To form postage of n +1 cents, use the stamps that form

postage of n-3 cents (from I.H) with a 4-cent stamp

Page 19: Peer to Peer network properties

Extensible Networking Platform 19 19 - CSE 240 – Logic and Discrete Mathematics

Recursive Definitions

We completely understand the function f(n) = n!, right?

As a reminder, here’s the definition:n! = 1 · 2 · 3 · … · (n-1) · n, n 1

But equivalently, we could define it like this:

0 n if 1

1n if )!1(! nnn

Page 20: Peer to Peer network properties

Extensible Networking Platform 20 20 - CSE 240 – Logic and Discrete Mathematics

Recursive Definitions

Another VERY common example:

Fibonacci Numbers

1 if )2()1(1 if 10 if 0

)(nnfnfnn

nf