What is Discrete Mathematics? - InSight CruisesWhat is Discrete Mathematics? Continuous Mathematics:...

12
11/20/13 1 Discrete Mathematics: The Math that Counts the Most! What is Discrete Mathematics? Continuous Mathematics: Geometry, Trigonometry, Calculus How things grow and change continuously, like waves in the water, or clouds in the sky. Discrete mathematics looks at quantities that can be broken into neat little pieces: Pixels on your computer screen Letters or numbers in your password Driving directions Deck of cards: Continuous or Discrete? Continuous: Weigh the deck Toss the deck Discrete: How many ways to arrange all 52 cards? How many 5 card poker hands? The probability of being dealt a flush? 2 = 1.41421... π = 3.1415926... Continuous math, uses real numbers like Discrete math uses whole numbers: 0, 1, 2, 3, Continuous math uses functions like e x , sin x, and cos x Discrete math uses functions like 2 n and n! Graphs (Continuous) y = sin x y = x 2

Transcript of What is Discrete Mathematics? - InSight CruisesWhat is Discrete Mathematics? Continuous Mathematics:...

11/20/13

1

Discrete Mathematics: The Math that Counts the Most!

What is Discrete Mathematics? Continuous Mathematics: Geometry, Trigonometry, Calculus How things grow and change continuously, like waves in the water, or clouds in the sky.

Discrete mathematics looks at quantities that can be broken into neat little pieces: Pixels on your computer screen Letters or numbers in your password Driving directions Deck of cards: Continuous or Discrete?

Continuous: Weigh the deck Toss the deck Discrete: How many ways to arrange all 52 cards? How many 5 card poker hands? The probability of being dealt a flush?

2 = 1.41421...π = 3.1415926...

Continuous math, uses real numbers like

Discrete math uses whole numbers:

0, 1, 2, 3, … Continuous math uses functions like ex, sin x, and cos x Discrete math uses functions like

2n and n!

Graphs (Continuous)

y = sin x

y = x2

11/20/13

2

“Or maybe a picture like this?”

(Matt: Find some random statistical graphs)

But in discrete mathematics, when we talk about graphs, we usually mean a very different sort of object. A graph is a collection of points, where two points are connected by a line (an edge) if they are related in some way.

Graphs (Discrete)

a b c

d

e f g

Networked computers Airline routes

1

6

5

4

3

2

The Graph K6

The complete graph with 6 points All points are connected by an edge.

Another graph (used in coding theory)

•  Combinatorics •  Number Theory •  Graph Theory

Combinatorics

The Mathematics of Counting (or Combining) Things

11/20/13

3

13

Rule of Product: If an action can be performed by making A choices followed by B choices, then it can be performed AB ways.

Example: 10 shirts, 5 pants

14

Example: A codeword consists of a letter from {A,B,C} followed by a number from {1,2,3,4,5}. How many codewords?

Answer: 3 x 5 = 15

1 2 3 4 5 A A1 A2 A3 A4 A5 B B1 B2 B3 B4 B5 C C1 C2 C3 C4 C5

Binary Code Words Question: Using only the numbers 0 and 1, how many code words of length n? n = 1: 2 code words 0 and 1 n = 2: 4 code words 00, 01, 10, 11 n = 3: 8 code words: 000, 001, 010, 011, 100, 101, 110, 111 In general, there are 2n different code words of length n. (Why?) 2n grows very quickly!

Q: How many length n code words with no consecutive 0s? n = 1: 2 code words 0 or 1 n = 2: 3 code words 01, 10, or 11 n = 3: 5 code words

010, 011, 101, 110, 111 n = 4: 8 code words 0101, 0110, 0111, 1010, 1011, 1101, 1110,1111

Fibonacci!

Q: How many ways to arrange the numbers 1, 2, 3? A: 6 ways:

123, 132, 213, 231, 312, 321

3 choices for first number 2 choices for the middle number

1 choice for the last number 3 x 2 x 1 = 6

Q: How many ways to arrange 1, 2, 3? A: 6 ways:

123, 132, 213, 231, 312, 321

3 choices for first number 2 choices for the middle number

1 choice for the last number 3 x 2 x 1 = 6

Q: How many ways to arrange 1, 2, 3, 4? A: 4 x 3 x 2 x 1 = 24 ways

11/20/13

4

In general, the number of ways to arrange n objects is n x (n-1) x (n-2) x … x 3 x 2 x 1 We call this number n! (“n factorial”) 5! = 5 x 4 x 3 x 2 x 1 = 120 10! = 10 x 9 x … x 1 = 3,628,800 52! = 52 x 51 x … x 1 ≈ 8 x 1067

How many different Rubik’s cube positions are possible? From a disassembled cube:

8! 38 12! 212 = 519,024,039,293,878,272,000

Achievable positions:

(8! 38 12! 212)/12 = 43,252,003,274,489,856,000

A randomly assembled cube has a 1/12 chance of being solvable. Where does 1/12 come from? ①  Arrangement of the pieces: 1/2 ②  Orientation of the corners: 1/3 ③  Orientation of the edges: 1/2

1/2 x 1/3 x 1/2 = 1/12

Fewest number of moves How many moves are required to solve any legal Rubik’s cube position? (A half-twist like R2 counts as one move.)

Claim: There are some positions that require at least 17 moves. Proof: With 16 moves, the number of possible positions is at most

18 x 1515 ≈ 7.8 x 1018

16 moves or fewer: 18 x (1515 + 1514 + … + 1)

= 8.4 x 1018 < 43 quintillion

Can’t create every position.

In 1995, Michael Reed found a position that provably required 20 moves to solve. Superflip: RLU2FU’DF2R2B2LU2F’B’UR2DF2UR2U Features: Every cube is in its proper position. Every corner has proper orientation. But every edge is flipped.

11/20/13

5

In 2010, it was proved that every legal cube can be solved within 20 moves. The proof took a few weeks with the help of Google background computing, using about 35 years of CPU. (A lot of clever mathematics was used to simplify the number of computations as well.)

Cruising applications: Number of 5-card poker hands: (52 x 51 x 50 x 49 x 48)/5! = 2,598,960. $25,000 Bingo challenge. 46 numbers chosen. If your card is covered, you win! P(Win) = 51! 46!/(75! 22!) ≈ 0.0000003 < 1 in 3 million

SIMPLE DICE GAME…. Played with 6-sided dice, but not with the traditional numbers.

A = 6, 6, 2, 2, 2, 2 B = 3, 3, 3, 3, 3, 3 C = 4, 4, 4, 4, 0, 0 D = 5, 5, 5, 1, 1, 1

We each pick a die. Whoever rolls the higher number wins. Which die would you like?

A = 6, 6, 2, 2, 2, 2 B = 3, 3, 3, 3, 3, 3 C = 4, 4, 4, 4, 0, 0 D = 5, 5, 5, 1, 1, 1

If you pick A, then I’ll pick B since

P(B > A) = 2/3

A = 6, 6, 2, 2, 2, 2 B = 3, 3, 3, 3, 3, 3 C = 4, 4, 4, 4, 0, 0 D = 5, 5, 5, 1, 1, 1

If you pick B, then I’ll pick C since

P(C > B) = 2/3

11/20/13

6

A = 6, 6, 2, 2, 2, 2 B = 3, 3, 3, 3, 3, 3 C = 4, 4, 4, 4, 0, 0 D = 5, 5, 5, 1, 1, 1

If you pick C, then I’ll pick D since

P(D > C) = 2/3

Why?

A = 6, 6, 2, 2, 2, 2 B = 3, 3, 3, 3, 3, 3 C = 4, 4, 4, 4, 0, 0 D = 5, 5, 5, 1, 1, 1

D can win in 2 ways. Either: D = 5, with probability 1/2

OR D = 1 & C = 0 w.p. (1/2)(1/3)=1/6

P(D > C) = 1/2 + 1/6 = 2/3

A = 6, 6, 2, 2, 2, 2 B = 3, 3, 3, 3, 3, 3 C = 4, 4, 4, 4, 0, 0 D = 5, 5, 5, 1, 1, 1

A = 6, with probability 1/3

OR A = 2 & D = 1, wp (2/3)(1/2) = 1/3

P(A > D) = 1/3 + 1/3 = 2/3

To summarize, we have A loses to B, B loses to C, C loses to D, and yet D loses to A, each with probability 2/3. Non-transitive probabilities.

Sounds impossible. Most competitive situations are transitive. If A is faster than B and B is faster than C, then A is faster then C.

Penney Ante Flip a coin 3 times. 8 equally likely outcomes:

HHH HHT HTH HTT THH THT TTH TTT

Whichever sequence shows up first is the winner. Which one would you like?

11/20/13

7

Suppose you pick the pattern HHH. Then I’ll pick the pattern THH and I’m an enormous favorite. Why?

For any sequence of coin flips, and look for when the sequence HHH first appears.

HTTTHTHHHTTHH….

For any sequence of coin flips, and look for when the sequence HHH first appears.

HTTTHTHHHTTHH…. HTTTHTHHHTTHH….

How can you win? Only if the coin flips immediately starts with

HHH…. which happens only 1/8 of the time. Thus P(THH beats HHH) = 7/8

If you choose sequence ABC (where each letter stands for a coin flip) then I choose the sequence

B’AB, where B’ denotes the opposite of B. If you choose THH Then I choose TTH.

ABC loses to B’AB probability HHH THH 7/8 = .875 HHT THH 3/4 = .750 HTH HHT 2/3 = .667 HTT HHT 2/3 = .667 THH TTH 2/3 = .667 THT TTH 2/3 = .667 TTH HTT 3/4 = .750 TTT HTT 7/8 = .875

11/20/13

8

Number Theory

In combinatorics, we naturally deal with numbers as they arise as the solution to the counting problems. In number theory, we study the numbers

0, 1, 2, 3, 4, … for their own intrinsic beauty.

Number Theory

The great, 20th century number theorist, G.H. Hardy was quoted as saying: “A mathematician, like a painter or poet, is a maker of patterns. If his patterns are more permanent than theirs, it is because they are made with ideas.”

Powers of 2 Useful in combinatorics and number theory. Every positive number can be uniquely expressed as the sum of distinct powers of 2.

37 = 32 + 4 + 1 = 25 + 22 + 20

Prime Numbers A number is prime if it has exactly 2 positive divisors: 1 and itself. 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, …

Prime Numbers Primes are the multiplicative building blocks of the integers. Every number has a unique prime factorization. Example: 2013 = 3 x 11 x 61

Theorem (Euclid): There is no largest prime number. Proof: Suppose, to the contrary, there was a largest prime P. Consider P! + 1 (bigger than P). It’s not divisible, by 2, 3, …, P. Thus P! + 1 is prime or has a prime factor that is larger than P. Thus P can’t be the largest prime. ☺

11/20/13

9

Theorem: The square root of 2 is irrational. (It can’t be written as a fraction.) Proof: Suppose, to the contrary, that is rational. Thus = a/b in lowest terms. Thus 2 = (a/b)2 = a2/b2.

2

2

Now since 2 = a2/b2, it follows that a2 = 2b2. (*) Thus a2 is even. Thus a is even. Thus a = 2k, where k is an integer. But by (*), (2k)2 = 2b2. Thus 4k2 = 2b2. Thus b2 = 2k2. Thus b2 is even. Thus b is even. But wait!!!

But wait!!! We’ve just shown that if = a/b is a fraction in lowest terms, then a and b must both be even. But if a and b are both even, then the fraction is not in lowest terms. Hence is irrational.

2

2☺

Number Theory has numerous applications

Error Detecting Codes ISBN Numbers Public Key Cryptography Internet Security

Graph Theory Applications Vehicle Routing Job Scheduling Error Detecting Codes ISBN Numbers Public Key Cryptography Internet Security Social Networks Magic Tricks

Theorem: Among any 6 people, there must be 3 mutual friends or 3 mutual strangers. Proof (using Graph Theory):

1

6

5

4

3

2

11/20/13

10

Theorem: Among any 6 people, there must be 3 mutual friends or 3 mutual strangers. Proof:

1

6

5

4

3

2

The Graph K6. Now color each edge.

Theorem: Among any 6 people, there must be 3 mutual friends or 3 mutual strangers.

1

6

5

4

3

2

Red edges denote friends Blue edges denote strangers.

Same theorem: After coloring the edges red or blue, there must be an all red triangle or an all blue triangle.

1

6

5

4

3

2

Note: blue triangle 236 red triangle 345

Same theorem: After coloring the edges red or blue, there must be an all red triangle or an all blue triangle.

1

6

5

4

3

2

No blue triangles red triangles 135 and 246

Theorem: After coloring the edges red or blue, there must be an all red triangle or an all blue triangle. Proof: Look at every possible coloring?

215 = 32,768 ways

No thanks! But there’s 2N again!

Proof:

Vertex 6 must have either a)  at least 3 red edges or

b) at least 3 blue edges

We’ll just consider a) since the argument for b) is essentially the same

6

1 2

3 4

5

11/20/13

11

If any edge between a, b, or c is red then we have a red triangle.

6

c

b

a

If any edge between a, b, or c is red then we have a red triangle. So, a, c, 6 are 3 mutual friends

6

c

b

a

Or a, b, 6

6

c

b

a

Or b, c, 6

6

c

b

a

On the other hand, if none of the edges are red,…

6

c

b

a

Either way,…

6

c

b

a

11/20/13

12

Transportation Problems

4-color theorem, 3 colors? This map uses 5 colors

So What is Discrete Math?

Sophisticated math for kindergartners •  Counting •  Arithmetic (playing with numbers) •  Connect-the-dots and Coloring