Download HW 9 solutions

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Probability wikipedia , lookup

Transcript
CS 173
Homework 9 Solutions
Fall 2008
CS 173: Discrete Mathematical Structures, Fall 2008
Homework 9
1. [10 points] ”It’s not the voting that’s democracy; it’s the counting.”– Tom Stoppard
(a) Suppose 10 candidates run in an election in which 5 of the candidates will be selected
to serve as the City Council for Urbana. How many different City Councils are possible?
Answer. We need to find the number of subsets of 5 elements from a set of 10 elements,
that is C(10, 5) = 252.
(b) Suppose the City Council for Champaign is chosen slightly differently: imagine that
the Champaign City Council is elected to 3 specific seats with each seat representing a
different ward in the city. In other words, a candidate is chosen for Ward 1, another for
Ward 2, and another for Ward 3. If there are 8 candidates running for City Council, how
many different ways are there to seat them?
Answer. We have 8 different choices for Ward 1, 7 for Ward 2, and 6 for Ward 3. There
are 8 · 7 · 6 = 336 different ways to seat them.
(c) Suppose the people counting the votes get very hungry and order 12 donuts from a shop
that sells 18 different kinds. How many ways are there to choose the 12 donuts?
Answer. We need to compute the number of ways 12 donuts can be chosen from 18
kinds, when repetitions are allowed and order does not matter. Remember that C(k +
n − 1, k) is the number of ways to pick k objects with possible duplicates from a list of
n types. In this case, we want k donuts from n different types, or C(k + n − 1, k) =
C(12 + 18 − 1, 12) = C(29, 12) = 51895935.
2. [10 points] Modular Pigeonholes
Let d be a positive integer. Prove that in any set d + 1 integers {x 1 , ..., xd+1 } there will be
a pair of integers xi and xj whose difference xi − xj is a multiple of d. Excessively extensive
hints: Use the Pigeonhole Principle (section 5.2) and modular arithmetic in your proof.
Answer. For x ∈ IN+ consider r = x mod d. Observe 0 ≤ r < d. There are d possible different
values r can take. There are d + 1 numbers in the set {x 1 , ..., xd+1 }. Let ri = xi mod d, with
xi ∈ {x1 , ..., xd+1 }. By the pigeonhole principle, at least two numbers, say x i and xj , have
the same remainder. (d possible remainders for d + 1 numbers). If we denote the repeated
remainder with r, we can write xi = qi d + r and xj = qj d + r, for some qi , qj ∈ ZZ. Observe
xi − xj = d(qi − qj ), which is clearly a multiple of d.
3. [10 points] There Will Be Induction
Use induction to prove that for all integers n > 1
n X
j
n+1
=
2
3
j=2
Answer.
• Base case: For n = 2:
1
CS 173
Homework 9 Solutions
Fall 2008
2 X
2
j
= 1,
=
2
2
j=2
and
2+1
3
=
3
3
= 1.
• Induction assumption. Assume
n X
n+1
j
=
3
2
j=2
is true for n.
• Inductive step. Assuming the claim is true for n, we need to prove is true for n + 1. First
observe:
n+1
X
j=2
j
2
n X
j
n+1
+
=
.
2
2
j=2
Using the induction assumption in this last step:
n+1
X
j=2
j
2
=
n+1
3
+
n+1
2
n+2
3
.
Finally, with the Pascal’s identity we finish our proof:
n+1
X
j=2
j
2
=
n+1
3
+
n+1
2
=
.
If you do not remember Pascal’s identity, review Lecture 27. In Lecture 27 we proved
Pascal’s identity by induction, and also by manipulating directly the factorial equations.
4. [10 points] ”That’s the spirit! You can do this! But, to be more accurate, you probably
can’t.” - Barney Stinson
Actually, you probably can do this problem if you’ve read section 6.2 of the textbook, which
includes examples suspiciously like the following questions:
(a) What is the conditional probability that a randomly generated bit string of length 5
contains exactly 4 zeroes given that the first bit is a one? Assume the probabilities of a
zero and one being generated are the same.
Answer. Given that the first bit is known to be one, the only bit string that remains
possible with exactly 4 zeroes is 10000. Let A represent the event of a bit string with
1 as the first bit, and let B be the event of a bit string with exactly 4 zeroes. For
p(B|A), the probability of B given A we need to find p(A) (the probability of A), and
p(A ∩ B) (the probability of A and B occurring at the same time). Half of the possible
bit strings start with 1, therefore p(A) = 1/2. There are 2 5 possible bit strings, thus
the probability of having exactly the bit string 10000 is p(A ∩ B) = 1/2 5 . Computing
p(B|A) = p(A ∩ B)/p(A) = 1/24 = 1/16.
2
CS 173
Homework 9 Solutions
Fall 2008
(b) Let the event E be that a randomly generated bit string of length 3 contains an odd
number of ones. Let F be the event that the string starts with a one. Assume that the
probability of a bit being zero is the same as the probability of a bit being one. Are E
and F independent? Justify your answer.
Answer. Remember that E and F are independent if and only if p(E ∩ F ) = p(E)p(F ).
Consider the possible bit strings:
000
001
E
010
E
011
100 EF
101
F
110
F
111 EF
We observe that half the bit strings have an odd number of ones, and that half of them
start with 1. Thus p(E) = 1/2 and p(F ) = 1/2. Furthermore, two bit strings of the
eight possible correspond to the events E and F occurring at the same time, giving
p(E ∩ F ) = 2/8 = 1/4. Observe that p(E)p(F ) = (1/2)(1/2) = 1/4 = p(E ∩ F ), from
which we conclude E and F are independent.
5. [10 points] The Problem of Points
First solved almost four centuries ago, the problem of points involves both probability and
expectation. Imagine you and Fermat are sitting in a cafe in Paris and decide to play a simple
game based on flipping a coin. If the coin comes up heads, Fermat gets a point. If it comes
up tails, you get a point. The first to get 3 points wins. The winner receives the equivalent
of 100 Euros while the loser receives no money at all. Suppose Fermat is winning, 2 points
to 0, when he suddenly has to leave before the game completes. We need to decide how the
money should be divided.
(a) The first step is to determine the sample space. It should be clear that there is some
number n such that the game will take at most n flips to win at this point. It may seem
counter intuitive, but we will consider the sample space to be all possible ways for n
flips to occur. We do this so that the outcomes all have the same length and so are
clearly all equally likely. What is n in this problem and what is the sample space (list the
outcomes)?
Answer. Note that after three more flips, we guarantee to have at least three heads, or
three tails. To see this, observe that we only need one more flip with heads. Thus, either
at least one of the extra three flips is heads, or the three are tails. The sample space for
the remaining of the game is the possible sequences of flips of length 3 (given that the
first previous two were heads):
H H T T T
H H T T H
H H T H T
H H T H H
H H H T T
H H H T H
H H H H T
H H H H H
3
CS 173
Homework 9 Solutions
Fall 2008
(b) What is the Random Variable in the problem that maps outcomes from the sample space
to the amount of money you receive? You can describe this function by explicitly writing
out the outcomes and the amount of money to which they map.
Answer. Observe that the question specifically asks for a mapping to the money you
receive, ignoring Fermat’s possible earnings:
H H T T T 100 Euros
H H T T H
0 Euros
0 Euros
H H T H T
H H T H H
0 Euros
H H H T T
0 Euros
H H H T H
0 Euros
H H H H T
0 Euros
H H H H H
0 Euros
(c) What are your expected winnings from the game?
Answer. Each of the possible 8 sequences have a probability of 1/8 of occurring. Following the definition of expected value of a random variable, we have:
(1/8) · 100 + (1/8) · 0 + . . . + (1/8) · 0 = 100/8 = 12.5
Your expected winnings are 12.5 Euros.
(d) What are Fermat’s expected winnings?
Similarly, we can define a random variable for Fermat’s winnings:
H H T T T
0 Euros
H H T T H 100 Euros
H H T H T 100 Euros
H H T H H 100 Euros
H H H T T 100 Euros
H H H T H 100 Euros
H H H H T 100 Euros
H H H H H 100 Euros
(1/8) · 0 + (1/8) · 100 + . . . + (1/8) · 100 = 100 · (7/8) = 87.5
Fermat’s expected winnings are 87.5 Euros.
Alternatively, observe that our expected winnings are 12.5 Euros, and since there is a
total of 100 Euros, Fermat’s expected winnings are 100 − 12.5 = 87.5 Euros.
4