CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7

Similar documents
MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology

Chapter 1. Probability

Chapter 1. Probability

Honors Precalculus Chapter 9 Summary Basic Combinatorics

November 6, Chapter 8: Probability: The Mathematics of Chance

November 8, Chapter 8: Probability: The Mathematics of Chance

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

Section 6.1 #16. Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit?

Counting in Algorithms

Probability Theory. Mohamed I. Riffi. Islamic University of Gaza

DISCUSSION #8 FRIDAY MAY 25 TH Sophie Engle (Teacher Assistant) ECS20: Discrete Mathematics

CS1802 Week 3: Counting Next Week : QUIZ 1 (30 min)

Theory of Probability - Brett Bernstein

8.2 Union, Intersection, and Complement of Events; Odds

Week 3 Classical Probability, Part I

Compound Probability. Set Theory. Basic Definitions

Mutually Exclusive Events

Section Summary. Finite Probability Probabilities of Complements and Unions of Events Probabilistic Reasoning

Probability. Ms. Weinstein Probability & Statistics

Combinatorics: The Fine Art of Counting

Discrete Structures Lecture Permutations and Combinations

Fundamental. If one event can occur m ways and another event can occur n ways, then the number of ways both events can occur is:.

Def: The intersection of A and B is the set of all elements common to both set A and set B

LISTING THE WAYS. getting a total of 7 spots? possible ways for 2 dice to fall: then you win. But if you roll. 1 q 1 w 1 e 1 r 1 t 1 y

CSE 21 Mathematics for Algorithm and System Analysis

MAT3707. Tutorial letter 202/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/202/1/2017

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability

2. Nine points are distributed around a circle in such a way that when all ( )

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

Chapter 2. Permutations and Combinations

It is important that you show your work. The total value of this test is 220 points.

CS 237 Fall 2018, Homework SOLUTION

CIS 2033 Lecture 6, Spring 2017

PROBABILITY. 1. Introduction. Candidates should able to:

Unit Nine Precalculus Practice Test Probability & Statistics. Name: Period: Date: NON-CALCULATOR SECTION

Reading 14 : Counting

Section Introduction to Sets

Principle of Inclusion-Exclusion Notes

Introductory Probability

The probability set-up

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

Lecture 6 Probability

November 11, Chapter 8: Probability: The Mathematics of Chance

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

Problem Set 2. Counting

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

3 The multiplication rule/miscellaneous counting problems

Chapter 3: Elements of Chance: Probability Methods

Permutations and Combinations

Topics to be covered

Discrete Structures for Computer Science

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions)

Grade 6 Math Circles Fall Oct 14/15 Probability

Foundations of Computing Discrete Mathematics Solutions to exercises for week 12

Class XII Chapter 13 Probability Maths. Exercise 13.1

INDEPENDENT AND DEPENDENT EVENTS UNIT 6: PROBABILITY DAY 2

The probability set-up

3 The multiplication rule/miscellaneous counting problems

Final Exam, Math 6105

CSC/MATA67 Tutorial, Week 12

Raise your hand if you rode a bus within the past month. Record the number of raised hands.

Algebra 2 Notes Section 10.1: Apply the Counting Principle and Permutations

CSC/MTH 231 Discrete Structures II Spring, Homework 5

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

Exam III Review Problems

4.3 Finding Probability Using Sets

STAT 430/510 Probability Lecture 3: Space and Event; Sample Spaces with Equally Likely Outcomes

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

n r for the number. (n r)!r!

Math 1313 Section 6.2 Definition of Probability

Mat 344F challenge set #2 Solutions

Mathematics 'A' level Module MS1: Statistics 1. Probability. The aims of this lesson are to enable you to. calculate and understand probability

Multiple Choice Questions for Review

4.1 Sample Spaces and Events

Today s Topics. Next week: Conditional Probability

Answer each of the following problems. Make sure to show your work.

Randomized Algorithms

Solutions to Problem Set 7

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

Introduction to Mathematical Reasoning, Saylor 111

Probability MAT230. Fall Discrete Mathematics. MAT230 (Discrete Math) Probability Fall / 37

Combinatorics: The Fine Art of Counting

Discrete mathematics

Unit 9: Probability Assignments

Probability and Counting Techniques

What is counting? (how many ways of doing things) how many possible ways to choose 4 people from 10?

5 Elementary Probability Theory

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC)

RANDOM EXPERIMENTS AND EVENTS

Probability and Randomness. Day 1

CHAPTER 2 PROBABILITY. 2.1 Sample Space. 2.2 Events

Probability: Terminology and Examples Spring January 1, / 22

CISC-102 Fall 2017 Week 8

Chapter 5: Probability: What are the Chances? Section 5.2 Probability Rules

50 Counting Questions

Jong C. Park Computer Science Division, KAIST

In how many ways can the letters of SEA be arranged? In how many ways can the letters of SEE be arranged?

Section 6.5 Conditional Probability

Chapter 3: Probability (Part 1)

Transcription:

CSCI 00 Foundations of Computer Science (FoCS) Solutions for Homework 7 Homework Problems. [0 POINTS] Problem.4(e)-(f) [or F7 Problem.7(e)-(f)]: In each case, count. (e) The number of orders in which a traveling salesman can visit the 50 states. Solution: In this problem, since order does matter, we are counting the number of k- orderings or k-permutations, where k = 50 and the number of elements we are ordering is n = 50. Therefore, we can calculate q as the number of k-orderings as q = n! (n k)! = 50! = 50! 0! This is a very large number! If you happen to have used a calculator for this, the answer is.044090778040805 0 4 (yikes). (f) The number of poker hands with a card in every suit. Solution: A poker hand consists of exactly five cards. The problem requires four cards to be in the four different suits. This implies that two cards will be of the same suit; in this case, there are ways to select the two cards. For the other suits, there are ways to select each card. Finally, we multiply the by 4, one for each suit: q = 4 ( )( )( )( ) = 4!!( )! (!!( )! ) = 85, 44. [0 POINTS] Problem.8(b) [this problem is not in the F7 textbook]: What is the coefficient of x in the expansion of: (b) ( x) Solution: We need to find the () i ( x) i term that produces the x term. Here, i =. From the Binomial Theorem, the x term is then () i ( x) i = () ( ) x =!!! (7)( 8)x = 40x The coefficient of x in the expansion of ( x) is 40.. [8 POINTS] Problem 4.8 [or F7 Problem 4.5]: Sets A, B, C have sizes,, 4. What are the min and max for A B C? Solution: 4 A B C 9

4. [8 POINTS] Problem 4.9(a) [this problem is not in the F7 textbook]: Consider the binary strings consisting of 0 bits. (a) How many contain fewer s than 0 s? Solution: Overall, there are 0 = 04 binary strings consisting of 0 bits. We must find x, the number of 0-bit binary strings containing fewer s than 0 s. There are at least two approaches here: i. Observe that the answer will be symmetric with the number of 0-bit binary strings containing fewer 0 s than s. Therefore, first calculate the number of 0-bit binary strings with the same number of 0 s and s as ( 0) 5 = 0! 5!5! = 5. Then, based on symmetry, x = 04 5 = 8. ii. Observe that to have fewer s than 0 s, a 0-bit binary string must contain n 0 s, where n takes on values {, 7, 8, 9, 0}. Therefore, we can calculate x = 0 0 7 0 8 0 9 0 = 0 0 45 0 = 8 0 5. [0 POINTS] Problem 4.9(f)-(g) [or F7 Problem 4.(f)-(g)]: In each case, count the number of objects/arrangements of the given type: (f) US Social Security numbers (see Problem. [or F7 Problem.5]) with digits in strictly increasing order. Solution: This problem is essentially asking you to count x as the number of 9-digit sequences (i.e., leading zeroes are fine) in which each subsequent digit going from left to right increases. This is actually a rather small set of values: {04578, 04579, 04589, 045789, 04789, 05789, 045789, 045789, 045789, 45789} The number of sequences is therefore x = 0. (g) US Social Security numbers with digits in non-decreasing order. Solution: This problem is asking you to count y as the number of 9-digit sequences (i.e., leading zeroes are fine) in which each subsequent digit going from left to right does not decrease. A good way to tackle this problem is to come up with a simpler representation. In this case, use delimiters between each digit, in order from 0 up to 9. Let each represent a digit, and each represent a change from digit n to digit n. There will always be exactly 9 characters (because we require a 9-digit sequence) and exactly 9 delimiters, for an overall total of 8 characters. As an example, represents the 9-digit sequence 00077. Given the above representation, we need to count the number of ways we can place 9 delimiters before/among/after 9 digits. To accomplish this, we need to choose 9 spots out of 8. Therefore, y = ( 8 9 ) = 48, 0.

. [ POINTS] Problem 4. [or F7 Problem 4.]: Use inclusion-exclusion to count the integer solutions to x x x = 0 where x 0, x 8, and 0 x 5. Solution: Start by adjusting the ranges of x and x to be non-negative integers, so let y = x with 0 y, y = x with 0 y, and simply y = x with 0 y 5. From this, we use inclusion-exclusion to count the integer solutions of y y y = 0. This is a k-subset with repetition problem. From Chapter, we can make use of n k Q(n, k) = k More specifically, we start by counting the number of solutions with y, y, y 0; here, with n = 0 and k =, we have n k Q(n, k) = Q(0, ) = = = k Next (the exclusion part), let S be the set of solutions that violate the upper bound constraint on y. Therefore, S contains solutions to y y y = 0 with y. Similarly, let S be the set of solutions with y 7, and let S be the set of solutions with y. Given these sets, the number of solutions that satisfy y y y = 0 is Using inclusion-exclusion, we have Q(0, ) S S S S S S = S S S S S S S S S S S S To obtain S, observe that solutions to y y y = 0 with y are solutions to z y y = 7, where z = y and z 0. Therefore, S = Q(7, ) = ( 9 ) =. Using a similar approach, S = Q(, ) = ( 5) = 05 and S = Q(4, ) = ( ) = 5. To determine S S, we observe that this intersection contains solutions with both y and y 7. Therefore, S S = Q(0, ) = ( ) =. Similarly, S S = Q( 9, ) = 0 and S S = Q(, ) = 0. Finally, the cardinality of the intersection of all three, i.e., S S S = Q(, ) = 0. Putting this all together yields S S S = 05 5 0 0 0 = 55 Therefore, our answer is 55 = 7.

7. [0 POINTS] Problem 4.50(a)-(b) [or F7 Problem 4.4(a)-(b)]: 8 distinguishable dice are rolled. How many outcomes are there? Solution: First, given 8 dice, there are 8 =, 79, possible outcomes. (a) How many outcomes do not contain a? How many do not contain a or? Solution: To determine how many outcomes do not contain a, each die roll has 5 possible outcomes. Therefore, with 8 dice, we have 5 8 = 90, 5 possible outcomes that do not contain a. Similarly, to determine how many outcomes do not contain a or a, each die roll has 4 possible outcomes. Therefore, with 8 dice, we have 4 8 = 5, 5 possible outcomes that do not contain a or a. (b) How many outcomes contain all numbers? [Hint: Inclusion-exclusion.] Solution: As noted above, with 8 dice, there are 8 =, 79, possible outcomes. Exclude from this the 5 8 = 90, 5 outcomes that do not contain a, the 5 8 = 90, 5 outcomes that do not contain a, etc. More specifically, we exclude 5 8 =, 4, 750 outcomes here. Next, we include (i.e., add back) the 4 8 = 5, 5 outcomes that do not contain a or a, since these were excluded twice in the previous step. To do this for each pair, we add back ( ) 4 8 = 98, 040. Continuing this pattern, we have our answer x calculated as x = 8 5 8 4 8 8 8 4 8 5 =, 79,, 4, 750 98, 040, 0 840 = 9, 50 8. [ POINTS] Problem 5.7(a)-(c) [this problem is not in the F7 textbook]: Randomly roll two dice. Compute the probabilities to roll: (a) One six Solution: Overall, there are = possible outcomes. Of these, 0 outcomes contain exactly one die roll of. Note we do not count a pair of sixes here. Therefore, the probability of rolling a on either die is 0 = 0.777. (b) A sum of Solution: Of the = possible outcomes, 5 outcomes that yield a sum of. Therefore, the probability of rolling a sum of on a pair of dice is 5 = 0.88. (c) A sum that is a multiple of Solution: In this problem, we are looking for dice roll sums in set S = {,, 9, }. Of the = possible outcomes, there are 5 4 = outcomes that yield a sum in set S. Therefore, the probability of rolling a sum that is a multiple of three on a pair of dice is = 0.. 4

9. [0 POINTS] Problem 5.7(a)-(b) [this problem is not in the F7 textbook]: Draw two cards randomly from a 5-card deck. Compute the probabilities: (a) The first is a K and the second a picture-card (i.e., A, K, Q, J). Solution: For the first card drawn, the probability of drawing a K is P[first is K] = 4 5 = 0.079. For the second card drawn, the probability of drawing a picture-card is P[second is picture-card first is K] = 5 5 = 0.94. Combining these two as a product, we have P[answer] = 4 5 5 5 = 5 = 0.0 (b) At least one card is a picture-card (i.e., A, K, Q, J). Solution: Start with all possible ways to select two cards, i.e., 5 5 = 5. Next, determine all possible ways to select no picture-cards. Note that we have 5 = non-picture-cards. Here, all possible ways to select two non-picture-cards is 5 = 0. Therefore, the probability of drawing two cards with at least one card being a picturecard is 5 5 0 = = 0.549 5 5 5 0. [0 POINTS] Problem.(a)-(b) [this problem is not in the F7 textbook]: One in 0 men are colorblind and one in 400 women are colorblind. There are an equal number of men and women. You select a person at random. (a) What is the probability that the person is colorblind? Solution: Given that there are an equal number of men and women, we select each with probability, which we then multiply and combine as follows: 0 400 = 40 800 = 800 = 0.05 (b) The person is colorblind. What is the probability that the person is male? Solution: Here, we are calculating P[person is male person is colorblind]. Using the conditional probability equation with A representing person is male and B representing person is colorblind, we have P[A B] = P[A B] P[B] First, P[A B] = 0 800 = 0.05. And from (a), P[B] = 800 = 0.05. Then, we have P[A B] = P[A B] P[B] = 0 800 800 = 0 = 0.954 5

CMMMMMMMMMMMMMMMMMMMFFFFFFFFFFFFFFFFFFFC