Download Solution

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 441 Fall 2006 Final exam
Name: ____________________________
There are 13 problems in 2 parts (A and B) on 7 pages with a total score of 80 points.
Do all problems. Calculators are NOT allowed.
Part A: Counting
1. (4 points)
(a) Give a formula for P(n,r).
(b) Compute the value of P(5,2).
(c) Give a formula for C(n,r).
(d) Compute the value of P(7,4).
(a) n! / (n-r)!
(b) 5! / (5-2)! = 5! / 3! = 5*4 = 20
(c) n! / ( (n-r)! r! )
(d) C(7,4) = 7! / ( 3! 4! ) = 7*6*5 / (3*2*1) = 35
2. (6 points) Suppose we want to flip a coin until either
(a) we get 2 more heads than tails,
(b) we get 1 more tails than heads, or
(c) we have flipped the coin 5 times.
How many possible sequences of heads and tails are there? 6 ways
H
H
T
T
H
H
T
T
H
T
1
3. (6 points) There are 4 kinds of donuts at a donut shop. How many ways are there to get a box of 6
donuts from this shop?
Combination with repetitions
n = 4 types of objects
r = 6 number of objects desired.
C(r+n-1, r) = C(6+4-1, 6)
4. (6 points) Suppose we want to generate a string of length 8 from the English alphabet. How many
strings begin with xx (2 consecutive x’s) or ends with yyy (3 consecutive y’s) ?
Let A = the set of strings of length 8 beginning with xx.
Let B = the set of strings of length 8 ending with yyy.
We want to compute |A  B|, the number of strings of length 8 beginning with xx or ending with yyy (or
both).
Use inclusion-exclusion.
|A| = 26^6
|B| = 26^5
|A  B| = the number of strings of length 8 beginning with xx AND ending with yyy = 26^3.
|A  B| = |A| + |B| - |A  B| = 26^6 + 26^5 – 26^3
| A  B | = |A|+|B|+|A  B|
|A|
|A  B|
|B|
2
5. (4 points) How many people do we need to make sure that there are at least 4 people that are born on the
same month?
6. (10 points) Suppose we want to generate a string of length 10 from the English alphabet.
(a) How many strings contain at most one x?
(b) How many strings contain at least two x’s (not necessarily consecutive)?
(a)
Let A = the set of strings of length 10 with at most one x.
Let B = the set of strings of length 10 with no x
Let C = the set of strings of length 10 with exactly one x.
|B| = 25^10
A = B  C.
Also, since B and C are disjoint, |A| = |B| + |C|
To generate a string in C,
1. Choose a position to put x  10 ways
2. Fill the remaining 9 positions with any of the 25 letters (anything except x).  25^9 ways
|C| = 10 * 25^9
Thus, |A| = |B| + |C| = 25^10 + 10 * 25^9
(b)
Let D = the set of strings of length 10 with at least two x’s.
Let E = the set of strings of length 10
|D| = |E| - |A| = 26^10 – (25^10 + 10 * 25^9)
3
Part B: Discrete Probability
7. (6 points) There is a deck of 5 cards which are numbered 1,2,3,4, and 5. Two cards are chosen at
random from the deck.
(a) Determine the size of the sample space of this experiment. (You don’t need to give the sample space
itself)
(b) Compute the probability of each outcome in this experiment.
(c) Let E be the event that BOTH of the chosen cards are odd numbers. Suppose E is represented as a
set. Determine the size of E.
(d) Compute p(E).
(e) Compute the probability that ONE of the chosen cards is an even number.
(a) C(5,2) = 5! / (3! 2!) = 5*4 / (2*1) = 10
(b) 1/10
(c) E = { {1,3}, {1,5}, {3,5} }. |E| = 3
(d) p(E) = |E|/|S| = 3/10
(e) F = event that one (or more) of the chosen cards is an even number.
F is a complement event of E.
Thus, p(F) = 1 – p(E) = 7/10.
8. (5 points) In an experiment, we start by tossing a fair coin. If the coin comes up tails, we stop. If the
coin comes up heads, we flip the coin one more time. Then we stop.
(a) Determine the sample space of this experiment by listing its members.
(b) Determine the probability distribution of this experiment. (Give it some thought).
(c) Let E be the event that tails comes up at least once. Represent E as a set by listing its members.
(d) Compute p(E).
(a) { T, HT, HH }
(b) p(T) = ½. P(HT) = ¼. P(HH) = ¼
(c) E = { T, HT }
(d) p(E) = p(T) + p(HT) = 3/4
4
9. (5 points) Suppose we roll 2 dice, a red die and a blue die. What is the probability that the blue die is 4
given that the sum of the two dice is 9?
E = the event that the blue dis is 4
F = the event that the sum of the two dice is 9.
E = { (1,4), (2,4), (3,4), (4,4), (5,4), (6,4) }
F = { (6,3), (5,4), (4,5), (3,6) }
EF = { (5,4) }
p(E | F) = |EF| / |F| = 1/4
10. (6 points) Suppose that we roll a die 12 times.
(a) What is the expected number of times that 6 comes up? (Your answer must be a number.)
(b) What is the probability that 6 comes up exactly 6 times? (Give a formula that can be evaluated to a
number. However, you don’t need to simplify it.)
(a)
Bernoulli’s trials with n = 12 and p = 1/6 (success is when 6 comes up; failure is when 1,2,3,4,5 come
up).
The expected number of successes = n p = 12 * (1/6) = 2.
(b)
6
1 5
C (12,6)      
6 6
6
5
11. (6 points) The outcome of rolling a die is considered “low” if either 1 or 2 comes up.
(a) Suppose we roll a die 10 times. What is the expected number of times that we have “low”
outcomes?
(b) Suppose we roll a die until we get a “low” outcome. What is the expected number of times we roll
the die?
(a) Bernoulli’s trials with n=10 and p=2/6 (success is when 1 or 2 come up; failure is when 3,4,5, or 6
come up).
The expected number of successes = n p = 10 * (2/6) = 10/3
(b) Geometric distribution with p = 2/6.
The expected number of times we roll the die = 1/p = 3.
12. (8 points) Consider a game where a number between 1 and 120 inclusive is randomly generated. The
player gets 4 points if the number is 30 or less. The player gets 6 points if the number is divisible by 12.
The player loses 3 points if the number is divisible by 3. For example, if the number is 36, then the
player gets a net profit of 6 – 3 = 3 point. What is the expected number of points obtained if the player
plays this game 10 times?
Use linearity of expectation.
Let X be the number of points obtained in 10 games.
Let Y1 be the number of points obtained from rule 1 in a game. (+4 points if number is 30 or less)
Let Y2 be the number of points obtained from rule 2 in a game. (+6 points if number is divisible by 12)
Let Y3 be the number of points obtained from rule 3 in a game. (-3 points if number is divisible by 3)
Let s be the outcome of the experiment
E[Y1] = p(s is < 30) * 4 + p(s is not < 30) * 0
= (30/120)*4 + (90/120)*0 = 1
E[Y2] = p(s is divisibly by 12)*6 + p(s is not divisible by 12)*0
= (10/120) * 6 + (110/120) * 0 = 0.5
E[Y3] = p(s is divisibly by 3)*(-3) + p(s is not divisible by 3)*0
= (40/120) * (-3) + (80/120) * 0 = -1
X = 10Y1+ 10Y2+ 10Y3
E[X] = E[10Y1+ 10Y2+ 10Y3]
= 10E[Y1] + 10E[Y2] + 10E[Y3] by linearity of expectation
= 10* 1 + 10 * 0.5 + 10 * (– 1)
= 0.5
6
13. (8 points) Let X be a random variable that equals the number of heads minus the number of tails when
10 biased coins are flipped. Suppose p(H) = 2/3 and p(T) = 1/3 for each coin. What is the expected
value of X?
Let Y be a random variable that equals the number of heads when one biased coin is flipped.
Let Z be a random variable that equals the number of tails when one biased coin is flipped.
Then X = 10Y – 10Z
E[Y] = p(H) * 1 + p(T) * 0 = (2/3) * 1 + (1/3) * 0 = 2/3
E[Z] = p(H) * 0 + p(T) * 1 = (2/3) * 0 + (1/3) * 1 = 1/3
E[X] = E[10Y – 10Z]
= 10E[Y] – 10E[Z] by linearity of expectation
= 10 * (2/3) – 10 * (1/3)
= 10/3
7