Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, 2002. L9-2.1 Mathematics for Computer Science MIT 6.042J/18.062J.

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advanced Piloting Cruise Plot.
Extension Principle Adriano Cruz ©2002 NCE e IM/UFRJ
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 1 Embedded Computing.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 5 Author: Julia Richards and R. Scott Hawley.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 5 second questions
Year 6 mental test 10 second questions
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
1 Combination Symbols A supplement to Greenleafs QR Text Compiled by Samuel Marateck ©2009.
ABC Technology Project
EU market situation for eggs and poultry Management Committee 20 October 2011.
1 Combinations & Counting II Samuel Marateck © 2009.
Basic Permutations and Combinations
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
VOORBLAD.
15. Oktober Oktober Oktober 2012.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Measurements and Their Uncertainty 3.1
BIOLOGY AUGUST 2013 OPENING ASSIGNMENTS. AUGUST 7, 2013  Question goes here!
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
© 2012 National Heart Foundation of Australia. Slide 2.
Adding Up In Chunks.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
LO: Count up to 100 objects by grouping them and counting in 5s 10s and 2s. Mrs Criddle: Westfield Middle School.
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Slippery Slope
Copyright © Cengage Learning. All rights reserved.
H to shape fully developed personality to shape fully developed personality for successful application in life for successful.
Januar MDMDFSSMDMDFSSS
Week 1.
Analyzing Genes and Genomes
1 Let’s Recapitulate. 2 Regular Languages DFAs NFAs Regular Expressions Regular Grammars.
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Essential Cell Biology
Intracellular Compartments and Transport
PSSA Preparation.
Immunobiology: The Immune System in Health & Disease Sixth Edition
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Physics for Scientists & Engineers, 3rd Edition
How Cells Obtain Energy from Food
Immunobiology: The Immune System in Health & Disease Sixth Edition
Energy Generation in Mitochondria and Chlorplasts
CpSc 3220 Designing a Database
Counting for Fun Lecture 18: Nov 21 (based on slides in MIT 6.042)
Presentation transcript:

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.1 Mathematics for Computer Science MIT 6.042J/18.062J Combinatorics II.2

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.2 The Magic Trick 1.The audience chooses 5 cards from a shuffled deck. 2.The assistant reveals 4 cards. 3.The magician correctly guesses the 5th card. Q.What is the role of the assistant?

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.3 What Can the Assistant Do? Decide in which order to reveal the cards: 4 cards 4! orders = 24 orders. Decide which 4 cards to reveal: 5 ways to choose which card to hide.

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.4 Magic Trick Revealed (I) The audience picks 5 cards: At least 2 cards must have the same suit (Pigeonhole Principle). Aha! The first card has the same suit as the hidden card!

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.5 Magic Trick Revealed (II) Aha! Look at the order of the other 3 cards! How do we figure out the value of the hidden card? A < 2 < 3 < < K < A < 2 < 3 < < K Total order on the cards

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.6 Magic Trick Revealed (II) Aha! Look at the order of the other 3 cards! How do we figure out the value of the hidden card? A < A < A < A < 2 < 2 < K < K Another possible order

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.7 Magic Trick Revealed (III) Aha! Of the two cards with the same suit, the choice of which is revealed gives 1 more bit of information! But, wait! There are 12 possible values for the hidden card and only 6 permutations for the other 3 revealed cards. Eliminating the value of the first card gives 13 – 1 = 12 values for the hidden card. Possible orders for the other 3 cards: { SML, SLM, MSL, MLS, LSM, LMS }

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.8 Clockwise Distance 58 AQ 67 K 2J Between any 2 of the 13 values, the smaller clockwise distance is at most 6: 7 6 Hide the card with the smaller offset.

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.9 Magic Trick Revealed (Finally) The offset is determined by the permutation of the other three cards: SML = 1, SLM = 2, MSL = 3, MLS = 4, LSM = 5, LMS = 6. The first card determines the suit ( ) of the hidden card. Hidden-card value = first-card value + offset ( 6).

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Example Hidden:First: Offset = 1 = SML :

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L In-Class Problems Problem 1

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Why the Magic Trick Cannot Work with Only 4 Cards: C(52, 4) > P(52, 3) Assistant can reveal a 3-card permutation: Audience can pick any 4-card combination:

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Combinatorial Argument Since C(52, 4) > P(52, 3), by the Pigeonhole Principle, two 4-card hands must map to the same 3-card permutation. 4-card hands 3-card perms indistinguishable by the revealed permutation

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Card Magic Trick Audience picks a 5-card combination: Assistant picks a 4-card permutation: Combinatorics do not rule out this trick. But, can we always find a consistent mapping between hands and sequences?

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Matching 5-Card Hands with 4-Card Permutations 5-card hands (order does not matter) 4-card perms (order matters)

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Matching 5-Card Hands with 4-Card Permutations 5-card hands (order does not matter) 4-card perms (order matters)

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Matching 5-Card Hands with 4-Card Permutations 5-card hands (order does not matter) 4-card perms (order matters)

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Matching 5-Card Hands with 4-Card Permutations 5-card hands (order does not matter) 4-card perms (order matters)

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Matching 5-Card Hands with 4-Card Permutations 5-card hands (order does not matter) 4-card perms (order matters) ? Which one to pick?

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Matching 5-Card Hands with 4-Card Permutations 5-card hands (order does not matter) 4-card perms (order matters) ? How can we ensure consistency?

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Perfect Matchings WomenMen In a bipartite graph G = (V 1, V 2, E), a perfect matching is a set M E such that every vertex in V 1 is incident on exactly one edge in M and every vertex in V 2 is incident on at most one edge in M.

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Perfect Matchings WomenMen In a bipartite graph G = (V 1, V 2, E), a perfect matching is a set M E such that every vertex in V 1 is incident on exactly one edge in M and every vertex in V 2 is incident on at most one edge in M.

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Neighbor Sets Definition. For a subset S V 1, let N(S) denote the set of Ss neighbors in V 2 : N(S) = { v V 2 : u S such that (u, v) E }. S N(S)

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Halls Marriage Theorem Theorem. A perfect matching exists in a bipartite graph G = (V 1, V 2, E) if and only if for every subset S V 1, we have. No perfect matching exists.

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L In-Class Problems Problem 2

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Dealing with Repetitions

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Permutations with Repetition RAD = 3! permutations RRD = RRD is the same as RRD therefore over-counting permutations Unlimited repetition?

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Combinations with Repetition A = {a,b,c} C 2 = {a,b} {b,c} {c,a} C 2 = {a,a} {b,b} {c,c} {a,b} {b,c} {c,a}

Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L Stars and Bars A = {a,b,c}, C 2 = {a,b} {b,c} {c,a} {a,a} {b,b} {c,c} x x {a,b} x x {b,c} x x {a,a} = 3 – 1 bars, 2 stars = 3 distinct urns, 2 identical balls | a | b | c |