hw1soln

7
Assignment 1 Due Friday 9/9/11 (by noon to Gayle Travis in ZEC 241) Reading Assignment: 1. Chapter 1: Mathematical Review; 2. Chapter 2: Combinatorics and Intuitive Probability. Problems: 1. Let A = {1, 2, 3, 4, 5}, B = {1, 4, 9, 11, 12}, C = {3, 5, 7, 8, 10, 11}, and D = {2, 4, 6, 7, 8, 9, 10}. Taking the universal set to be Ω = A B C D, find (a) A B Solution: {1, 2, 3, 4, 5, 9, 11, 12} (b) A B Solution: {1, 4} (c) (A B) c Solution: {6, 7, 8, 10} (d) (A B) C Solution: {3, 5, 11} (e) (A B) D c Solution: {1, 3, 4, 5, 11, 12} (f) (A C ) (D C ) Solution: {3, 5, 7, 8, 10} 2. (a) How many different 7-place license plates are possible if the first 2 places are for letters and the other 5 for numbers? Solution: Thre are 26 possibilities for the first letter, 26 for the second. Similarly, there are 10 possibilities for each of the numbers. The number of different 7-place license plates is therefore 26 2 · 10 5 = 67, 600, 000. (b) Repeat part (a) under the assumption that no letter or number can be repeated in a single license plate. Solution: In this case, there are 26 possiblities for the first letter, and 25 for the second one. Also, there are 10 possibilities for the first number, 9 for the second, 8 for the third, 7 for the fourth, and 6 for the fifth one. The number of such 7-place license plates is equal to 26 · 25 · 10 · 9 · 8 · 7 · 6 = 19, 656, 000. 3. Two dice are rolled at the same time. (a) What is the probability that the sum of the dice is equal to 7? Solution: There are six distinct ways in which two dice can have a sum of 7, namely (1, 6), (2, 5), (3, 4), (4, 3), (5, 2) and (6, 1). The probability of getting a sum of 7 is then given by 6 36 = 1 6 . 1

Transcript of hw1soln

Page 1: hw1soln

Assignment 1

Due Friday 9/9/11 (by noon to Gayle Travis in ZEC 241)

Reading Assignment:

1. Chapter 1: Mathematical Review;

2. Chapter 2: Combinatorics and Intuitive Probability.

Problems:

1. Let A = 1, 2, 3, 4, 5, B = 1, 4, 9, 11, 12, C = 3, 5, 7, 8, 10, 11, and D = 2, 4, 6, 7, 8, 9, 10.Taking the universal set to be Ω = A ∪B ∪ C ∪D, find

(a) A ∪B Solution: 1, 2, 3, 4, 5, 9, 11, 12

(b) A ∩B Solution: 1, 4

(c) (A ∪B)c Solution: 6, 7, 8, 10

(d) (A ∪B) ∩ C Solution: 3, 5, 11

(e) (A ∩B) ∪Dc Solution: 1, 3, 4, 5, 11, 12

(f) (A ∩ C) ∪ (D ∩ C) Solution: 3, 5, 7, 8, 10

2. (a) How many different 7-place license plates are possible if the first 2 places are for letters

and the other 5 for numbers?

Solution: Thre are 26 possibilities for the first letter, 26 for the second. Similarly, there

are 10 possibilities for each of the numbers. The number of different 7-place license plates

is therefore 262 · 105 = 67, 600, 000.

(b) Repeat part (a) under the assumption that no letter or number can be repeated in a

single license plate.

Solution: In this case, there are 26 possiblities for the first letter, and 25 for the second

one. Also, there are 10 possibilities for the first number, 9 for the second, 8 for the third,

7 for the fourth, and 6 for the fifth one. The number of such 7-place license plates is

equal to 26 · 25 · 10 · 9 · 8 · 7 · 6 = 19, 656, 000.

3. Two dice are rolled at the same time.

(a) What is the probability that the sum of the dice is equal to 7?

Solution: There are six distinct ways in which two dice can have a sum of 7, namely

(1, 6), (2, 5), (3, 4), (4, 3), (5, 2) and (6, 1). The probability of getting a sum of 7 is then

given by6

36=

1

6.

1

Page 2: hw1soln

(b) What is the probability that the sum of the dice is equal to a prime number?

Solution: The prime numbers between two and twelve are 2, 3, 5, 7, 11. Using a

strategy similar to what was employed above, we get Pr(2) = 1/36, Pr(3) = 2/36,

Pr(5) = 4/36, Pr(7) = 6/36, and Pr(11) = 2/36. Thus, the overall probability of getting

a prime number is 15/36.

4. After playing 5-card stud and 7-card stud for a while, a group of poker players decide to try

6-card stud. In this game, each player is dealt a hand of 6 cards from a standard 52 card

deck and the player with the highest 5-card poker hand wins.

(a) How many distinct hands are there?

Solution: Since the ordering of the cards does not change the “hand”, there are(526

)hands.

(b) How many hands are ranked “three-of-a-kind”?

Solution: We can count the number of hands with three-of-a-kind by choosing in order:

the number of the matching cards, the suits of the matching cards, the numbers of the

remaining cards, and the suits of the remaining cards. Therefore, the number of hands

in given by (13

1

)(4

3

)(12

3

)(4

1

)3

= 732160.

(c) How many hands make a “full house”? (Hint: this includes hands with two triplets)

Solution: We can count the number of hands that make a full house by choosing in

order: the number of the triple, the suits of the triple, the number of the pair, the suits

of the pair, and the last card. Therefore, the number of hands in given by(13

1

)(4

3

)(12

1

)((4

2

)(11

1

)(4

1

)+

1

2

(4

3

))= 165984.

5. Fix two sets A and C. If C ⊂ A, show that for every set B,

(A ∩B) ∪ C = A ∩ (B ∪ C). (1)

Also show that if (1) holds for some set B, then C ⊂ A (and thus (1) holds for all sets B).

Solution: To prove the first part, we use set operations

(A ∩B) ∪ C = (A ∪ C) ∩ (B ∪ C)

= A ∩ (B ∪ C).

The last step follows from the fact that A ∪ C = A since C ⊂ A. For the second part,

suppose that C is not a subset of A. Then there exists an element e ∈ C − A. By definition

e ∈ (A∩B)∪C, since e ∈ C. However, e /∈ A and therefore e /∈ A∩ (B ∪C). In other words,

if C is not a subset of A then (1) does not hold (for any set B).

2

Page 3: hw1soln

6. Following the argument presented in the notes, prove that(⋂α∈A

)c

=⋃α∈A

Scα.

Solution: Suppose that x belongs to(⋂

α∈I Sα)c

. That is, there exists an α′ ∈ I such that

x is not an element of Sα′ . This implies that x belongs to Scα′ , and therefore x ∈

⋃α∈I S

cα.

Thus, we have shown that(⋂

α∈I Sα)c ⊂ ⋃α∈I S

cα. The converse is obtained by reversing

the argument. Suppose that x belongs to⋃α∈I S

cα. Then, there exists an α′ ∈ I such that

x ∈ Scα′ . This implies that x /∈ Sα′ and, as such, x /∈

(⋂α∈I Sα

). Alternatively, we have

x ∈(⋂

α∈I Sα)c

. Putting these two inclusions together, we get the desired result.

Programming Challenges (Optional):

1. Write a short C program that, upon request, generates a random number between 1 and 10.

Solution: Below, you will find a subroutine that selects two problems from a homework

assignments. You can easily modify this program to generate a random number between one

and ten.

#include <stdio.h>

#include <stdlib.h>

#include <ctype.h>

/*

Ran is from "Numerical Recipes: The Art of Scientific Computing"

by William H. Press, Saul A. Teukolsky, William T. Vetterling,

and Brian P. Flannery, 2007.

*/

struct Ran

unsigned long long int u,v,w;

Ran(unsigned long long int j) : v(4101842887655102017LL), w(1)

u = j ^ v; int64();

v = u; int64();

w = v; int64();

inline unsigned long long int int64()

u = u * 2862933555777941757LL + 7046029254386353087LL;

v ^= v >> 17; v ^= v << 31; v ^= v >> 8;

w = 4294957665U*(w & 0xffffffff) + (w >> 32);

unsigned long long int x = u ^ (u << 21); x ^= x >> 35; x ^= x << 4;

return (x + v) ^ w;

3

Page 4: hw1soln

inline double doub() return 5.42101086242752217E-20 * int64();

inline unsigned int int32() return (unsigned int)int64();

;

main()

int index;

unsigned long int numero;

Ran myran(18);

for (index = 1; index <= 10; index++)

numero = (myran.int32() % 6) + 1;

printf("Random number: %10lu\n", numero);

;

;

Optional Problems:

1. Consider rolling a six-sided die. Let A be the set of outcomes where the roll is an even number.

Let B be the set of outcomes where the roll is greater than 3. Calculate and compare the

sets on both sides of De Morgan’s laws

(A ∪B)c = Ac ∩Bc, (A ∩B)c = Ac ∪Bc.

Solution: Here, we have the following sets A = 2, 4, 6 and B = 4, 5, 6. For the first

equation, we have

(A ∪B)c = (2, 4, 6 ∪ 4, 5, 6)c = 2, 4, 5, 6c = 1, 3

and

Ac ∩Bc = 2, 4, 6c ∩ 4, 5, 6c = 1, 3, 5 ∩ 1, 2, 3 = 1, 3.

Clearly, the equality holds. Similarly, for the second equation, we have

(A ∩B)c = (2, 4, 6 ∩ 4, 5, 6)c = 4, 6c = 1, 2, 3, 5

and

Ac ∪Bc = 2, 4, 6c ∪ 4, 5, 6c = 1, 3, 5 ∪ 1, 2, 3 = 1, 2, 3, 5.

Again, this De Morgan’s law holds, as expected.

2. Prove each of the following identities using Venn diagrams.

4

Page 5: hw1soln

(a) A ∩B ⊆ A ∪B.

Solution:

(b) A = (A ∩B) ∪ (A−B).

Solution:

(c) A ∪B = A ∪ (B −A).

Solution:

(d) If C ⊆ A, then (A ∩B) ∪ C = A ∩ (B ∪ C).

Solution:

3. We deal from a well-shuffled 52-card deck. Calculate the probability that the 13th card is the

first king to be dealt.

Solution: For the 13th card to be the first king, two conditions need to occur. First, there

must not be a king within the first twelve cards. Also, the following card should be a king.

5

Page 6: hw1soln

The probability that there are no kings within the first twelve cards is(4812

)(5212

) =40 · 39 · 38 · 37

52 · 51 · 50 · 49.

Once these twelve cards have been dealt, with no kings showing up, the probability that the

next card is a king is equal to4

40=

1

10.

Altogether, the probability that the 13th card is the first king to be dealt is equal to(4812

)(5212

) · 1

10.

4. In how many ways can 3 novels, 2 mathematics books, and 1 chemistry book be arranged on

a bookshelf if

(a) the books can be arranged in any order;

Solution: If the books can be arranged in any order, then there are 6! book arrange-

ments.

(b) the mathematics books must be together and the novels must be together;

Solution: Under these constraints, there are 3! · 3! · 2! different book arrangements.

First, there are 3! ways to order novels, mathematics books, and the chemistry book.

Within the novels, there are 3! possible arrangements. Similarly, within the mathematics

books, there are 2! possible arrangements.

(c) the novels must be together but the other books can be arranged in any order?

Solution: If only the novels must be together, then there are a total of 4 ·3! ·3! arrange-

ments.

5. Five separate awards (best scholarship, best leadership qualities, ...) are to be presented to

selected students from a class of 30. How many different outcomes are possible if

(a) a student can receive any number of awards;

Solution: In this case, there are 30 possibilities for the first award, 30 for the second,

30 for the third, 30 for the fourth, and 30 for the fifth award. Thus, the total number of

outcomes is 305 = 24, 300, 000.

(b) each student can receive at most 1 award?

Solution: In this alternate scenario, there are 30 possibilities for the first award, 29 for

the second, 28 for the third, 27 for the fourth, and 26 for the fifth award. The total

number of awards then becomes 30 · 29 · 28 · 27 · 26 = 17, 100, 720.

6. An academic department offers 8 lower level courses: L1, L2, . . . , L8 and 10 higher level

courses: H1, H2, . . . ,H10. A valid curriculum consists of 4 lower level courses, and 3 higher

level courses.

6

Page 7: hw1soln

(a) How many different curricula are possible?

Solution: There are(84

)ways to pick 4 lower level courses and

(103

)ways to select 3

higher level courses. As such, the total number of possible curricula is(8

4

)(10

3

).

(b) Suppose that H1, . . . ,H5 have L1 as a prerequisite, and H6, . . . ,H10 have L2 and

L3 as prerequisites, i.e., any curricula which involves, say, one of H1, . . . ,H5 must also

include L1. How many different curricula are there?

Solution: To solve this question, we use a divide and conquer approach. First, there

are exactly(54

)ways to select higher level courses solely from H1, . . . ,H5. When this

is the case, L1 must be included in the lower level courses, which leads to(5

3

)· 1 ·

(7

3

)ways to form admissible curricula. Similarly, there are exactly

(54

)ways to select higher

level courses from H6, . . . ,H10. Under these circumstance, L2 and L3 must be present

in the lower level courses. The number of possible such selection is(5

3

)· 1 · 1 ·

(6

2

)Finally, the remaining possibilities for higher level courses all include at least one course

from H1, . . . ,H5 and one course from H6, . . . ,H10. Then, the number of mixed

curricula is ((10

3

)− 2

(5

3

))· 1 · 1 · 1 ·

(5

1

).

7