7
CS1800 Discrete Structures Prof. Rachlin Spring 2020 January 31, 2020 Homework #4 Assigned: Friday January 31, 2020 Due: Friday February 7, 2020 @ 11:59pm Instructions: The assignment has to be uploaded to Gradescope by the due date. NO assignment will be accepted after 11:59pm on that day. We expect that you will study with friends and often work out problem solutions together, but you must write up your own solutions, in your own words. Cheating will not be tolerated. Professors, TAs, and peer tutors will be available to answer questions but will not do your homework for you. One of our course goals is to teach you how to think on your own. You must turn in typed work to Gradescope either written in a word processor such as Word, or typeset in LaTeX. To get full credit , show INTERMEDIATE steps leading to your answers, throughout. Problem 1 [25 pts (3,3,3,3,3,4,6)]: Weekend trip to Vegas. i. An American roulette wheel has 38 numbered slots: 2 are green, 18 are red, and 18 are black. When the wheel is spun, a marble, rolling in the opposite direction, will eventually land in one of the slots. We record the sequence of outcomes when the wheel is spun five times. How many 5-spin sequence outcomes are possible? Solution: Thirty-eight possibilities for each spin so 38 5 . ii. How many 5-spin outcomes are all of the same color? Solution: 2 5 + 18 5 + 18 5 for the green, red, and black sequences respectively, or 2 · 18 5 + 32. iii. How many times must the wheel be spun before we can be sure that the marble landed on one of the numbered slots at least five times? Explain your answer. Solution: By the pigeonhole principle, if we spin the wheel 38 · 4 + 1 = 153 times we can be sure that one of the numbered slots came up at least d 153 38 e = d4.02e = 5 times. iv. A standard 52-card deck has four suits (Hearts, Diamonds, Clubs, and Spades) and each suit has 13 ranks (2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace). The face cards are Jack, Queen, and King. How many ways are there to pick a card that is a spade or a face card? Solution: There are 13 spades, 12 face cards, and 3 face cards that are spades, so by inclu- sion/exclusion: 13 + 12 - 3 = 22. 1

Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

CS1800 Discrete Structures Prof. RachlinSpring 2020 January 31, 2020

Homework #4

Assigned: Friday January 31, 2020Due: Friday February 7, 2020 @ 11:59pm

Instructions:

• The assignment has to be uploaded to Gradescope by the due date. NO assignment will be acceptedafter 11:59pm on that day.

• We expect that you will study with friends and often work out problem solutions together, but youmust write up your own solutions, in your own words. Cheating will not be tolerated. Professors,TAs, and peer tutors will be available to answer questions but will not do your homework for you.One of our course goals is to teach you how to think on your own.

• You must turn in typed work to Gradescope either written in a word processor such as Word, or typesetin LaTeX.

• To get full credit , show INTERMEDIATE steps leading to your answers, throughout.

Problem 1 [25 pts (3,3,3,3,3,4,6)]: Weekend trip to Vegas.

i. An American roulette wheel has 38 numbered slots: 2 are green, 18 are red, and 18 are black.When the wheel is spun, a marble, rolling in the opposite direction, will eventually land inone of the slots. We record the sequence of outcomes when the wheel is spun five times. Howmany 5-spin sequence outcomes are possible?

Solution: Thirty-eight possibilities for each spin so 385.

ii. How many 5-spin outcomes are all of the same color?

Solution: 25 + 185 + 185 for the green, red, and black sequences respectively, or 2 · 185 + 32.

iii. How many times must the wheel be spun before we can be sure that the marble landed onone of the numbered slots at least five times? Explain your answer.

Solution: By the pigeonhole principle, if we spin the wheel 38 · 4 + 1 = 153 times we can besure that one of the numbered slots came up at least d15338 e = d4.02e = 5 times.

iv. A standard 52-card deck has four suits (Hearts, Diamonds, Clubs, and Spades) and each suithas 13 ranks (2,3,4,5,6,7,8,9,10,Jack,Queen,King,Ace). The face cards are Jack, Queen, andKing. How many ways are there to pick a card that is a spade or a face card?

Solution: There are 13 spades, 12 face cards, and 3 face cards that are spades, so by inclu-sion/exclusion: 13 + 12− 3 = 22.

1

Page 2: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

v. How many ways are there to be dealt Blackjack? To be dealt Blackjack, either the first cardis an Ace and the second card is a face card, or the first card is a face card and the secondcard is an Ace.

Solution: There is no overlap between 4 Aces and 12 face cards, and the two cards could bereceived in either order so (4 · 12) + (12 · 4) = 96 ways. If you include 10’s, then 128 ways(also an acceptable answer.)

vi. How many ways can you be dealt two cards such that the first card is a spade and the secondcard is a face card?

Solution:

1. First card is a face card spade: 3 · 11 = 33

2. First card is a non-face card spade: 10 · 12 = 120

So 153 ways altogether.

vii. How many ways can you pick three cards such that the first card is a spade, the second cardis a one-eyed Jack, and the third card is a face card? (There are two one-eyed Jacks in astandard deck: the Jack of Hearts and the Jack of Spades.

Solution:

Break the problem down into disjoint cases for the type of card received 1st, 2nd, and 3rd.

1. (Non-Face Spade, Any one-eyed Jack, Face): 10 · 2 · 11 = 220

2. (Face Spade non-one-eyed-Jack, Any one-eyed Jack, Face): 2 · 2 · 10 = 40

3. (Face Spade one-eyed Jack, other one-eyed Jack, Face): 1 · 1 · 10 = 10

So 270 ways altogether.

2

Page 3: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the partyYou are making a song playlist for a party. The playlist will consist of songs by your two favorite

artists: Regina Spektor and Ingrid Michaelson. You have 6 Spektor songs and 5 Michaelson songsto choose from. We consider the same songs played in a different order to be a different playlist.

i. Suppose your playlist contained 7 songs and you were allowed to play the same song morethan once. How many playlists could you create?

Solution: 11 choices for each of the 7 songs in the playlist, so 117.

ii. What if the playlist could contain 7 to 10 songs by either artist. Now how many playlists arepossible?

Solution: The playlists of different lengths are disjoint so 117 + 118 + 119 + 1110.

iii. What if we stick to 7 songs in our playlist, but we require at least one song by Spektor andone by Michaelson? Now how many playlists could you construct?

Solution: {All playlists} - {All Spektor} - {All Michaelson} = 117 − 67 − 57.

iv. What if we require every song to be different in a 7-song playlist?

Solution: 11 · 10 · 9 · 8 · 7 · 6 · 5 = 1, 663, 200 playlists.

v. Suppose your favorite song is “Us” by Regina Spektor. ”Us” is one of your available Spectorsongs. How many playlists could you create where ”Us” is played six times and the remaining7th song is any song by either artist except ”Us”? The 7th song can be played at any pointin the playlist.

Solution: {7th song choices} · {7th song position} = 10 · 7 = 70.

vi. What if we require every song to be different in our 7-song playlist AND we must alternatethe artist with each song?

Solution:

1. Pattern SMSMSMS = 6 · 5 · 5 · 4 · 4 · 3 · 3 = 21, 600

2. Pattern MSMSMSM = 5 · 6 · 4 · 5 · 3 · 4 · 2 = 14, 400

So 36,000 playlists altogether.

vii. Let’s have only five songs in our playlist but we require all songs by Spektor and all songs byMichaelson to be grouped together in the play list. For example, you could play 3 Spektorsongs followed by 2 Michaelson songs, or 1 Michaelson song followed by 4 Spektor songs. Youcould even play 5 Spektor songs! How many playlists are possible now? You are allowed torepeat songs.

Solution: Enumerate the disjoint song patterns:

1. SSSSS: 50 · 65 = 7, 776

3

Page 4: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

2. MSSSS or SSSSM: 2 · 51 · 64 = 12, 960

3. MMSSS or SSSMM: 2 · 52 · 63 = 10, 800

4. MMMSS or SSMMM: 2 · 53 · 62 = 9, 000

5. MMMMS or SMMMM: 2 · 54 · 61 = 7, 500

6. MMMMM: 55 · 60 = 3, 125

So 51,161 playlists altogether.

Problem 3 [25 pts (5,10,10)]: A plethora of pigeons and a dearth of holes.

i. A child places 0 or more pennies in her piggy bank each day, for 15 consecutive days. Shethen cracks open the piggy bank and finds that she has accumulated one dollar. (1 dollar =100 pennies.) Explain how we know that on at least two days she placed the same numberof pennies in her piggy bank.

Solution: Lets call the amounts each day x1, x2, x3, ..., x15; we know these are positive inte-gers and sum to 100.We prove the problem statement by contradiction: assume (hypothetically) that the x amountsare all distinct. Then they should be (in sorted order) at least as large as 0,1,2,...,13,14 whichmeans in total at least 0+1+2+...+13+14 =105 or more than 100! Contradiction. So the xvalues cannot be distinct.

ii. Five friends are at a party. Show that at least two people shook the same number of hands.

Solution: The possible number of shaken hands for a person is {0, 1, 2, 3, 4} since the maxi-mum corresponds to shaking hands with all other 4 people.Prove by contradiction: assume the 5 people did have a distinct number of shaken hands.The only numerical possibility for 5 people to get 5 different values in set {0, 1, 2, 3, 4} is thata person did 0 shook hands, another did 1 shook hands, another did 2, a person did 3, and thelast person did 4. But that is impossible due to the reciprocal nature of hand shaking: theperson who shook 4 hands (all others) must have shook hands with person who did no handshaking at all. Contradiction. So among the 5 must be some who shook the same number.

iii. An equilateral triangle measures 3 centimeters on each side and is marked up with 100 dots.Show that you can find 12 or more dots that can be covered by an equilateral trianglemeasuring 1 centimeter on each side regardless of how the dots are placed. See, for example,the diagram below. (The small triangle is drawn at random for illustration. You might findother 1cm-side triangles containing at least 12 points.

4

Page 5: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

Solution: A 3cm-side equilateral triangle can be partitioned into 9 1cm-side triangles (seefigure below). Since its a partion, the 9 triangles cover the whole big triangel with no overlap.Now applying Pigeonhole Principle we have 100 points into 9 triangles, so at least one of thetriangles must contain at least d100/9e = 12 points.

iv. (optional, no credit FFF) In the previous problem setup, is it possible to arrange the 100points in the 3cm-side triangle, such that any 1cm-side triangle contains at most 12 points?

Solution:

NOT A SOLUTION. As a starting point, we look at a points distributed on a grid, and atriangle big enough to contain 100 points (the one drawn is slightly bigger than necessary,and in there we have small triangles containing more than 12 points)

v. (optional, no credit FF) Reformulate the original 3cm-triangle question in 3D, by replacingthe equilateral triangle with a regular tetrahedron.

Solution: Contrary to intuition, 27 regular 1cm-side tetrahedra dont pack themselves perfectlyinto a 3cm-side one, even though their volumes add up to that! Aristotle thought so, and ittook a long time until someone proved him wrong (https://www.ams.org/notices/201211/

5

Page 6: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

rtx121101540p.pdf). But they pack at least with density 80%, so we can formulate theproblem knowing we can cover he big tetrahedra with say k=40 small ones that somewhatoverlap. Overlap is still allowing us to use PP for lower bound.

Problem 4 [25 pts (8,8,9)]: Thought problems

i. How may divisors does the the number 1800 have? A divisor is a number that dividesinto another number without a remainder. (Hint: find the prime factors. for example,12 = 2× 2× 3 = 22 × 31 and its divisors are 1, 2, 3, 4, 6, 12.)

Solution: 1800 = 18 ∗ 100 = 2 ∗ 32 ∗ 22 ∗ 52 = 23 ∗ 32 ∗ 52

The factors are 2p ∗ 3q ∗ 5r, with p ∈ {0, 1, 2, 3}, q ∈ {0, 1, 2}, r ∈ {0, 1, 2}, Since any combi-nation of exponents p, q, r in these sets is valid, AND gives a unique factor, the number offactors comes down to a product rule of choices for p with choices for q and choices for r, thatis 4x3x3 = 36 factors.

ii. Consider the 6-bit binary numbers for 0..63. Without listing every binary number, determinehow many 6-bit binary numbers have 2 or more 1-bits in a row. For example, 0111012 isone such number because two 1-bits occur next to each other (twice). A brute force solutionthat lists all 64 strings and counts manually the valid ones is worth only half credit. Hint:Try breaking it up into disjoint cases that cover every possibility. It might be easier to thinkabout cases where there are no adjacent 1-bits.

Solution:

Sequences that don’t have adjacent 1-bits will have either 0,1,2,or three 1-bits.

1. 0 1-bits: 1 possibility: 000000

2. 1 1-bit: 6 possibilities: 100000, 010000, etc.

3. 2 1-bits: 10 possibilities: 10XXXX (4) + 010XXX (3) + 0010XX (2) + 000101 (1)

4. 3 1-bits: 4 possibilities: 010101, 100101, 101001, 101010

So there are 21 6-bit numbers without adjacent 1-bits. Therefore 64 - 21 = 43 6-bit numberswith adjacent ones.

Alternatively, we split into disjoint cases by the first (form left to right) pair of “11” bits:(1,2) or 11xxxx : 24 possibilities(2,3) or 011xxx : 23 possibilities(3,4) or x011xx : 23 possibilities(4,5) or x0011x + 01011x : 22 + 21 possibilities(5,6) or x0x011 + 010011 : 22 + 20 possibilitiesTotal 16+8+8+6+5 = 43 numbers.

iii. F Given three sets A,B,C. Prove |A| + |B| + |A ∩ B ∩ C| ≥ |A ∩ B| + |A ∩ C| + |B ∩ C|.Hint: partition the Venn diagram into disjoint “visual” regions, and show the inequality foreach region separately.

Solution: The easiest way is to draw the Venn diagrams and observe the counts for elementson RHS, partitioned in groups as follows; LHS counts each group at least that many times as

6

Page 7: Homework #4...Problem 2 [25 pts (3,3,3,3,3,5,5)]: Playlists for the party You are making a song playlist for a party. The playlist will consist of songs by your two favorite artists:

counted on the RHS.

Group LHS count RHS count

A ∩B ∩ C 3 3(A ∩B) \ C 2 1(A ∩ C) \B 1 1(B ∩ C) \A 1 1

Set-Algebra solution: First we want to prove that |A|+ |A ∩B ∩ C| ≥ |A ∩B|+ |A ∩ C|.|A|+ |A ∩B ∩ C|≥ |A ∩ (B ∪ C)|+ |A ∩B ∩ C|= |(A ∩B) ∪ (A ∩ C)|+ |(A ∩B) ∩ (A ∩ C)|= |A ∩B|+ |A ∩ C|To that inequality we add that |B| ≥ |B ∩ C|, which gives the result.

iv. (optional, not for credit F) Five real unit-intervals [a, a+1]; [b, b+1]; [c, c+1]; [d, d+1]; [e, e+1]cover the real range [0, 2], that is every element in [0,2] is in the union of the intervals. Showthat no matter how a, b, c, d, e are set up, there is at least one that can be removed such thatthe other four still form a cover.For example, in the figure either b or c or d or e can be removed and the remaining fourintervals are a cover of [0,2].

Solution: Sort the intervals by starting point, lets say a < b < c < d < e. Clearly a ≤ 0,otherwise they dont form a cover. If b ≤ 0 then we can remove the [a, a+1] interval as [b, b+1]covers the for it in the range [0,2] (done). So lets look into the complement b > 0 case, whichmeans [a, a + 1] cannot be removed. We must have b ≤ a + 1, or there would be a uncoveredgap between intervals [a, a + 1] and [b, b + 1].By a symmetric argument from the right side we have e + 1 ≥ 2 in order to provide cover. Ifd+1 ≥ 2 then [e, e+1] can be removed (done!), so lets look into the remaining case d+1 < 2.Now we are in the case a ≤ 0, b > 0, e + 1 ≥ 2, d + 1 < 2, b ≤ a + 1, d + 1 ≥ e. In this casethe intervals given by a, b, d, e form a cover, so [c, c + 1] can be removed.

7