Counting for Fun

# Counting for Fun

## Counting for Fun

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. Counting for Fun Lecture 18: Nov 21 (based on slides in MIT 6.042)

2. Guess Your Card (1) http://www.bobjude.co.uk/entertain/layouts/c1.htm

3. Guess Your Card (2) (♠ ♥ ♦ ♣)

4. The Magic Trick • Students choose 5 cards • Assistant reveals 4 of them • Magician announces 5th card

5. The Magic Trick • Decide the order of the 4 cards: 4! = 24 orderings -- but 48 cards remain • Decide which 4 cards to list

6. 4-card lists (ordered) 5-card hands (noorder) ? Match hands with 4-Card lists list must come from hand Which one to pick?

7. 4-card lists (ordered) 5-card hands (noorder) Match hands with 4-Card lists ? How can we ensure consistency?

8. Match hands with 4-Card lists

9. Hall’s Theorem The graph satisfies Hall’s theorem so there is a match that magician and assistant can use even works for bigger decks

10. A Memorable Matching? hands to match to lists How will magician & assistant learn them?

11. Magic Trick Revealed (I) Among 5 cards chosen: at least 2 have the same suit (Pigeonhole Principle) Assistant lists one of them 1st Aha! The first card has the same suit as the hidden card!

12. Magic Trick Revealed (II) How does magician figure out the value of the hidden card? Aha! Look at the order of the other 3 cards!

13. Magic Trick Revealed (II) Fix ordering of the deck A♣ < 2♣ < 3♣ < … < K♣ < A♦ < 2♦ < 3♦ < … < K♦ < A♥ < 2♥ < 3♥ < … < K♥ < A♠ < 2♠ < 3♠ < … < K♠

14. Magic Trick Revealed (II) Possible orders for the remaining 3 cards: { SML, SLM, MSL, MLS, LSM, LMS }

15. Magic Trick Revealed (II) Wait! Only have 6 lists of the remaining 3 cards, but 12possible hidden cards of the known suit! Of two cards with the same suit, choosing which to reveal can give 1 more bit of information! Aha!

16. Reveal the other card Hide card with smaller offset. Clockwise Distance The smaller clockwise distance between 2 card values is at most 6: K Q A J 2 7 10 3 9 4 6 8 5 7 6

17. Magic Trick Revealed (Finally) • The first card determines the hidden suit (♠ ♥ ♦ ♣) . • Hidden value (A … K)= first-card value + offset (≤ 6). • Offset given by order of remaining 3 cards: SML= 1,SLM= 2,MSL= 3, • MLS=4,LSM=5,LMS= 6.

18. Hidden: First: = SML: Example same suit Offset= 1

19. Trick can’t work with 4-card hands Students can pick Assistant can reveal possible 4-card hands possible 3-card lists