Demystifying Computing with Magic 2012-03-01 Raleigh, NC.

Slides:



Advertisements
Similar presentations
This trick relies on three nice ideas from discrete mathematics: pigeonhole principle 5 pigeons (cards) in 4 holes (suits) means at least two pigeons are.
Advertisements

ICAMP: Game Simulation and Analysis Analysis of the Game “Poison” Sarah Eichhorn University of California Irvine iCAMP Overview Meeting, 5/5/10.
4/16/2015 MATH 224 – Discrete Mathematics Counting Basic counting techniques are important in many aspects of computer science. For example, consider the.
Transformations We want to be able to make changes to the image larger/smaller rotate move This can be efficiently achieved through mathematical operations.
Probability Three basic types of probability: Probability as counting
Recursively Defined Functions
The Binary Numbering Systems
Techniques for Dealing with Hard Problems Backtrack: –Systematically enumerates all potential solutions by continually trying to extend a partial solution.
NUMBER TRICKS.
College of Information Technology & Design
Discrete Structures & Algorithms Counting Counting I: One-To-One Correspondence and Choice Trees.
Midterm Review Solutions Math 210G-04, Spring 2011.
CSE115/ENGR160 Discrete Mathematics 02/07/12
1 Section 5.1 Discrete Probability. 2 LaPlace’s definition of probability Number of successful outcomes divided by the number of possible outcomes This.
Longfield Primary School
Information Theory and Security
VOCABULARY  Deck or pack  Suit  Hearts  Clubs  Diamonds  Spades  Dealer  Shuffle  Pick up  Rank  Draw  Set  Joker  Jack 
Hamming Codes 11/17/04. History In the late 1940’s Richard Hamming recognized that the further evolution of computers required greater reliability, in.
What are some of the ways you that that we can categorise numbers?
NCTM Conference April  Domain: Operations & Algebraic ThinkingOperations & Algebraic Thinking  K.OA.3  Decompose numbers less than or equal to.
Demystifying Computing with Magic, continued Denver, CO.
The Game of Algebra or The Other Side of Arithmetic The Game of Algebra or The Other Side of Arithmetic © 2007 Herbert I. Gross by Herbert I. Gross & Richard.
Warm-up Problem 2 Write three positive integers in a line. In the space just below and between each pair of adjacent integers, write their difference.
Lecture for Week Spring.  Numbers can be represented in many ways. We are familiar with the decimal system since it is most widely used in everyday.
1 9/8/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
The Hat Game 11/19/04 James Fiedler. References Hendrik W. Lenstra, Jr. and Gadiel Seroussi, On Hats and Other Covers, preprint, 2002,
MATH 224 – Discrete Mathematics
Digital Logic Chapter 4 Presented by Prof Tim Johnson
1 9/23/2015 MATH 224 – Discrete Mathematics Basic finite probability is given by the formula, where |E| is the number of events and |S| is the total number.
Lecture Discrete Probability. 5.1 Probabilities Important in study of complexity of algorithms. Modeling the uncertain world: information, data.
Introduction to Counting Discrete Structures. A Multiplication Principle.
Basic Counting Lecture 12: Oct 28. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations,
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
EXIT NEXT Click one of the buttons below or press the enter key BACKTOPICSProbability Mayeen Uddin Khandaker Mayeen Uddin Khandaker Ph.D. Student Ph.D.
1 A Lesson Without the Opportunity for Learners to Generalise …is NOT a Mathematics lesson! John Mason ‘Powers’ Norfolk Mathematics Conference Norwich.
“ONE HUNDRED TEKS BASED IDEAS WITH ONE DECK OF CARDS”! BY: DEIDRE HANNIBLE DESOTO ISD.
Section 3.1: Proof Strategy Now that we have a fair amount of experience with proofs, we will start to prove more difficult theorems. Our experience so.
Extending the Definition of Exponents © Math As A Second Language All Rights Reserved next #10 Taking the Fear out of Math 2 -8.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
Math Games Compiled By: Joan Bartlett and Heather Bartlett.
Praxis I Math Review By: Professor Peter Eley. Question 1 Text answers to A scientist has a very sophisticated microscope and laser cutting tool.
1 Lecture 4 (part 1) Combinatorics Reading: Epp Chp 6.
Quiz 10-1, Which of these are an example of a “descrete” set of data? 2.Make a “tree diagram” showing all the ways the letters ‘x’, ‘y’, and ‘z’
First of all, pick the number of times a day that you would like to have chocolate (more than once but less than 10) Multiply this number by 2 (just to.
Homework Homework due now. Reading: relations
Mathematics (for all) for Tomorrow: How to start a job we can’t finish from and Harcourt School Publishers With support from Vail Symposium, 2006 Some.
Ch. 11: Cantor’s Infinity!. N = {1, 2, 3, 4, 5, 6, …} “the natural numbers” Z = {…, –3, –2, –1, 0, 1, 2, 3, …} “the integers” Q = {all quotients “a/b”
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
© 2010 Pearson Prentice Hall. All rights reserved. CHAPTER 13 Mathematical Systems.
Lecture Coursework 2 AGAIN. Rectangle Game Look at proof of matchsticks A rectangular board is divided into m columns by n rows. The area of the board.
PROBLEM-SOLVING TECHNIQUES Rocky K. C. Chang November 10, 2015.
Algebra-2 Counting and Probability. Quiz 10-1, Which of these are an example of a “descrete” set of data? 2.Make a “tree diagram” showing all.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
Section Basic Counting Principles: The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n 1.
Oregon’s Second Annual GED Summit Creating Promise, Designing Success Thank you to our sponsors:
Chance We will base on the frequency theory to study chances (or probability).
By: Megan Funk. I will: 1. Explain the binary number system How to: -Generate binary from a number -Add binary 2. Explain the base-b number system 3.
COUNTING Discrete Math Team KS MATEMATIKA DISKRIT (DISCRETE MATHEMATICS ) 1.
CPSC 121: Models of Computation 2008/9 Winter Term 2
Discrete Structures for Computer Science
Using Algebra Tiles to Solve Equations, Combine Like Terms, and use the Distributive Property Objective: To understand the different parts of an equation,
Discrete Structures for Computer Science
Pre-K and Kindergarten
Basic Counting.
Fundamentals of Data Representation
Representations of Integers
6.4b The Piano Method (aka: Sticks and Stones Method)
DIVISION 10 ÷ 2 = 5 Quotient LET’S LEARN
Presentation transcript:

Demystifying Computing with Magic Raleigh, NC

2/53 Demystifying Computing with Magic Special Session Overview  Motivation  The 5 magic tricks  The 21 Card Trick  Magic Hats  Guess the Value  Josephus Flavius Circle Game  Fitch Cheneys Five Card Trick  Reflection  Other References  YOU contribute your tricks

3/53 Demystifying Computing with Magic Magic is Fun!

4/53 Demystifying Computing with Magic but Magic Can be much more than fun

5/53 Demystifying Computing with Magic Magic May be Used to Motivate, Illustrate, and Elaborate on: - Computing notions - Computing notions - Problem solving - Problem solving - Creativity - Creativity

6/53 Demystifying Computing with Magic Computing Notions - Discrete math terms: e.g., permutations, - Discrete math terms: e.g., permutations, - Problem representation: e.g., binary digits - Problem representation: e.g., binary digits - Algorithmic patterns: e.g., sorting - Algorithmic patterns: e.g., sorting - General notions: e.g., symmetry - General notions: e.g., symmetry

7/53 Demystifying Computing with Magic Problem Solving Heuristics - Problem decomposition - Problem decomposition - Simplification, Generalization - Simplification, Generalization - Backward reasoning - Backward reasoning - Analogy (transfer) - Analogy (transfer) - Problem representation - Problem representation

8/53 Demystifying Computing with Magic Creativity In mathematics education, e.g. [Silver 1997]: - Fluency: diverse directions - Fluency: diverse directions - Flexibility: adaptation to the task at hand - Flexibility: adaptation to the task at hand - Originality: unfamiliar utilization of familiar notions - Originality: unfamiliar utilization of familiar notions - Awareness of possible fixations - Awareness of possible fixations

9/53 Demystifying Computing with Magic  21 cards in 7x3 grid  Volunteer picks card, tells column  Dealer puts that column in middle, redeals by row  Twice repeated  Dealer chooses card behind back! 11 th Variation, aka the “21 card trick”

10/53 Demystifying Computing with Magic  After the 1 st redeal, the cards are #8-14  Redealt by rows, they’re in middle 7  After the 2 nd redeal, they’re in #10-12  Redealt by rows, they’re in the middle 3  After the 3 rd gather, it’s card #11!  Count 10, and that’s it!! How it works…

11/53 Demystifying Computing with Magic  Computing Notions  Intro to Algorithms  Permutations  Markov Chains  Convergence  Ternary search  Correctness proof  Problem Solving  Analysis, simulation  Creativity  Visualization with arrows  Talking points  Max # cards? What students learn…

12/53 Demystifying Computing with Magic Calling the Color of my Hat Three people, a hat is put on each of them. Each can see the other two hats but not his own Each hat may be: Gold, Silver, or Green. Each person looks at the other two hats. A the same time each person calls his hat color. At least one of them is right!

13/53 Demystifying Computing with Magic Task Reduction – 2 Hats 4 cases: G G S S G S S G Asymmetric rules: - Person-1: Call the color that you see - Person-2: Call the opposite of what you see Each person “covers” two cases

14/53 Demystifying Computing with Magic But, how to extend to 3 hats? In the 2-hat case one person “went for” equal colors, and the other – for different colors So, maybe we’ll do the same here … But, each person sees two hats … maybe they will be of the same color, or – of different colors … so, if “same color” then perhaps one will call this color … and if “different colors” … then will call … ???

15/53 Demystifying Computing with Magic Beware of Fixation

16/53 Demystifying Computing with Magic The Magic Again, Differently Version-1: 4 people, 4 hats Version-2: All of the people are right, or all of them are wrong

17/53 Demystifying Computing with Magic Task Reduction – 2 Hats 4 cases: G G S S G S S G Asymmetric rules: - Person-1: Call the color that you see - Person-2: Call the opposite of what you see Each person “covers” two cases

18/53 Demystifying Computing with Magic Fluency Seek diverse, relevant observations: - Asymmetric rules - Each rule “covers” 2 separate cases - All the 4 cases are “covered” - Binary representation of the colors (?)

19/53 Demystifying Computing with Magic 3 Hats: 3 colors, 27 cases Each color may be 0, 1, or 2 Therefore, 27 cases: 0 0 0, 0 0 1, … Each person will “cover” 9 cases (?) How to split the cases between them?

20/53 Demystifying Computing with Magic Originality Manipulate the three numbers that represent the hats … but, according to what feature? - Equality of numbers (?) - Differences between pairs of numbers (?) - Sums of numbers (?) - Modulo of numbers (?)

21/53 Demystifying Computing with Magic How to manipulate? Perhaps look at sums? In the 2-hat case the sum could be 0, 1, or 2: - Person-1 “covered” the integers: 0 and 2 - Person-2 “covered” the integer: 1 Here there are 7 options for the sum: 0, 1, 2, … 6. How to split them?

22/53 Demystifying Computing with Magic How to divide {0,1,2,3,4,5,6} ? One person will “cover” 3 integers, and the other two people – will “cover” 2 integers each What should be the integers of the 1 st person? {1, 2, 3}? Or: {1, 3, 5}? Or: {0, 3, 6}?

23/53 Demystifying Computing with Magic Learn from the 2-Hat case In the 2-hat case one “went for odd” and the other “went for even” So, maybe the 1 st person here will “go for” {1, 3, 5}? How will the other two split {0, 2, 4, 6}? Maybe: {0 2} and {4 6}? Or: {0 6} and {2 4}?

24/53 Demystifying Computing with Magic Flexibility We may transfer the “odd/even” in the 2-hat case into here not just as “odd/even”, but as the remainders of 2. So, in the 3-hat case we may look at remainders of 3. The 1 st person may “go for” {0, 3, 6} The 2 nd – to {1, 4} And the 3 rd – to {2,5}

25/53 Demystifying Computing with Magic How will each play his part? Person-1 will “go for” 0 modulo 3 Person-2 will “go for” 1 modulo 3 Person-3 will “go for” 2 modulo 3

26/53 Demystifying Computing with Magic Example 1 We define: Gold = 0, Silver = 1, Green = 2 Example: Three Hats: Gold, Gold, Green Person-1 sees: 0, 2 calls: 1 (Silver) Person-2 sees: 0, 2 calls: 2 (Green) Person-3 sees: 0, 0 calls: 2 (Green)

27/53 Demystifying Computing with Magic Example 2 We define: Gold = 0, Silver = 1, Green = 2 Example: Three Hats: Gold, Green, Silver Person-1 sees: 2, 1 calls: 0 (Gold) Person-2 sees: 0, 1 calls: 0 (Gold) Person-3 sees: 0, 2 calls: 0 (Gold)

28/53 Demystifying Computing with Magic Reflection Computing notions: Numeric representation, disjoint sets, complement, modulo arithmetic Problem solving: Simplification and generalization, problem representation Creativity: Diverse attempts, sum utilization, observation of “odd/even” as remainders

29/53 Demystifying Computing with Magic  Remove N cards  Remaining turned face down in piles from top card to 10  E.g., “7, 8, 9, 10”  (4 cards)  E.g., “9, 10”  (2 cards)  Audience keeps 3 piles, # cards picked = sum 3 top cards Guess the Value

30/53 Demystifying Computing with Magic  3 Piles, top cards  X, Y, Z  # cards in Piles?  (11-X), (11-Y), (11-Z)  33 – X – Y – Z  Remaining Cards R?  R = 52 – Removed – Piles  R = 52 – N – (33-X-Y-Z)  R = 19 – N + X + Y + Z  What N s.t. R = X+Y+Z?  N = 19 How it Works X Y Z R … … N … …

31/53 Demystifying Computing with Magic  Computing Notions  Intro to Algorithms  Correctness proof  Error-handling  What happens when you see a face card?  Problem Solving  Importance of a good problem representation  Notion of complement  Number of cards = 11 – top  Creativity  Algebraic representation What students learn… X Y Z R … … N … …

32/53 Demystifying Computing with Magic The Josephus Problem N people in a circle, numbered 1..N. Starting with person-2, every second person leaves the circle. What is the number of the (last) survivor?

33/53 Demystifying Computing with Magic Fluency Seek diverse, relevant observations: - All the even numbers leave first - If the circle is of an even number of people, then person-1 survives the next cycle - The answers for N=2, 3, 4, 5, 6, … may help - Binary representation (?)

34/53 Demystifying Computing with Magic Decompose the Problem Separate between: N is a power of 2, or not If N is a power of 2: each cycle will leave an even amount of people; person-1 will always be skipped, and remain last If N is not a power of 2: person-1 will not remain last … but how can we tell the last?

35/53 Demystifying Computing with Magic Flexibility Flexibility Solve the general case by capitalizing on the special case, of “N is a power of 2” Reason backwards: if we knew the number of the person whose deletion yields a power-of-2 remaining people … then we can tell the last survivor

36/53 Demystifying Computing with Magic Telling the Survivor’s Number Telling the Survivor’s Number D = the difference between N and the closest power-of-2 smaller-than or equal-to N After D people will leave, the circle will include a power-of-2 people Thus, the number of the last survivor is 2D+1

37/53 Demystifying Computing with Magic Examples Examples Example-1: N=41  D=9 The 9 th person to leave is number 18. At this point, 32 people will remain, so the 1 st person in this remaining cycle will survive. The survivor: number 19. Example-2: N=60  D=28 The survivor:2×D+1 = 2×28+1 = 57

38/53 Demystifying Computing with Magic Binary Representation Binary Representation Example-2: N=60  D=28 The survivor: 2×D+1 = 2×28+1 = 57 N=60 in binary: D=28 in binary: D in binary: (shift left) 2D+1 in binary: (cyclic shift left)

39/53 Demystifying Computing with Magic Reflection Computing notions: Binary representation, powers-of-2, complementing cases Problem solving: Problem decomposition, backward reasoning Creativity: Capitalizing on case-1’s solution for solving case-2, 2D = binary shift left

40/53 Demystifying Computing with Magic 1. (assistant off-stage) 2. Audience chooses 5 cards from deck, gives to Dan 3. Dan picks 1, gives back to audience 4. Dan puts his 4 in some order, leaves 5. Assistant enters, says audience card Fitch Cheneys Five Card Trick ?

41/53 Demystifying Computing with Magic Aha! #1 : This is encoding / decoding!  Just like Pig Latin to confuse parents  This is really information passing between mathemagician and assistant  But how did they pass on that info? J 5  A  4 

42/53 Demystifying Computing with Magic Aha! #2 : All cards are fully ordered  This isn’t as easy with 52 random objects  How should we order cards?  Ranks are ordered 2-10, J, Q, K (A?)  Suits are already ordered:     But, which first?  A A  A  A  2 2  or A 2 3 4

43/53 Demystifying Computing with Magic Aha! #3 : Independently find rank, suit  With the four cards, we can either…  Use all 4 cards to choose that card (this is what often comes to mind first!)  Use some to choose rank, some for suit.  Big idea: decouple hidden card into 2 dimensions, rank and suit

44/53 Demystifying Computing with Magic Aha! #4 : Pigeon-hole the suit (5 > 4)  With 5 cards, but only 4 suits, at least 2 have to have the same suit!  Thus, the suit of the hidden card same as suit of, say, leftmost card  But that only leaves us with 3 cards for encoding the rank (1 out of 13!) J 5  A  4 

45/53 Demystifying Computing with Magic Aha! #5 : Hidden card is 1 of 12, not 13  Since the suit-revealing card is up, then there are only 12 cards left  Hmm, how do I specify from among 12 cards by reordering the other 3? J 5  A  4 

46/53 Demystifying Computing with Magic Aha! #6 : Permutation is n!, 3! = 6  With 3 cards left, can choose 3! = 6 things by reordering them…Aha! #2  But there are 12 cards there!  All we need is 1 bit, Rodney…  Do we backtrack or continue? 1=123 2=132 3=213 4=231 5=312 6=321 J 5  A  4  3 1 2

47/53 Demystifying Computing with Magic Aha! #7 : 1 bit = which card we hide!  We had a choice of that bit in step 3  Which card did Dan give to audience?  Which card should we hide?  If we know that we’ll be able to specify an additional number from 1 through 6, say as an offset.

48/53 Demystifying Computing with Magic Aha! #8 : See a (mod) 13-hr clock  Same-suit cards are hands on a clock  Find acute angle  Show “earlier” card  Hide “later” card  (Earlier + [1-6]) mod 13  Later A J Q K 5

49/53 Demystifying Computing with Magic Let’s do one together, shall we?  Audience hands us J A  4  5  3 1. Which two same suit? J & 3 2. Which do we hide among J & 3? 3 3. Place J on the left, reorder others 4. Want 5 (312), so J 5  A  4 

50/53 Demystifying Computing with Magic What do students learn from this?  Computing Notions 1. Information theory, compression 2. Full ordering of a set (52 cards) 3. Decomposition (rank, suit) 4. Pidgeon-hole principle (5 > 4) 5. Off-by-one matters (12 not 13) 6. Permutation and combinatorics (3! = 6) 7. Constraints (1 bit left) 8. Modulo arithmetic (modulo 13)  Problem Solving  Solution decomposition into 8 aha stages  Creativity  Recognition that two same-suit cards are no more than 6 away ?

51/53 Demystifying Computing with Magic 1. (assistant off-stage) 2. Audience chooses 5 cards from deck, gives to Dan 3. Dan picks 1, gives back to audience 4. Dan throws 1 away 5. Dan puts his 3 in some order, makes it “harder” by flipping some, leaves 6. Assistant enters, says audience card Fitch Cheneys Five Card Trick Variant ?

52/53 Demystifying Computing with Magic  Paul Curzon, Peter McOwan, Jonathan Queen Mary, University of London  CS4FN magazine  Two free books on Magic and CS!  Some online apps  If you’d like to contribute tricks, contact them… Tremendous Resource : CS4FNwww.cs4fn.org/magic

53/53 Demystifying Computing with Magic And in conclusion… Magic May be Used to Motivate, Illustrate, and Elaborate on: - Computing notions - Computing notions - Problem solving - Problem solving - Creativity - Creativity Audience Participation Do YOU have any magic to share?