Title: CS 173 A little practice
1CS 173 A little practice
A turtle begins at the upper left corner of an n
x m grid and meanders to the lower right corner.
How many routes could she take if she only moves
right and down?
2CS 173 A little practice
A turtle begins at the upper left corner of a m x
n grid and meanders to the lower right corner.
How many routes could she take if she only moves
right and down, and if she must pass through the
dot at point (a,b)?
3CS 173 A little practice
In how many ways can 11 identical computer
science books and 8 identical psychology books be
distributed among 5 students?
Hint forget about the psychology books for the
moment.
Hint how can you combine your soln for the CS
books with your soln for the Psych books?
4CS 173 A little practice
In an RNA chain of 20 bases, there are 4 As, 5
Us, 6 Gs, and 5Cs. If the chain begins either AC
or UG, how many such chains are there?
Let A denote the set of chains beginning with AC,
and U denote the set of chains beginning with UG.
Count them separately, and then sum.
First find A
18 bases, 3 As, 5 Us, 6 Gs, and 4Cs.
(This is like the MISSISSIPPI problem.)
A 18!/(3!5!6!4!)
5CS 173 Probability
We roll a single die, what are the possible
outcomes?
1,2,3,4,5,6
The set of possible outcomes is called the sample
space.
We roll a pair of dice, what is the sample space?
Depends on what were going to ask.
Often convenient to choose a sample space of
equally likely events.
(1,1),(1,2),(1,3),,(6,6)
6CS 173 Probability
Define a probability measure on a set S to be a
real-valued function, Pr, with domain 2S so that
- For any subset A in 2S, 0 ? Pr(A) ? 1.
- Pr(?) 0, Pr(S) 1.
- If subsets A and B are disjoint, then Pr(A U B)
Pr(A) Pr(B).
Pr(A) is the probability of event A. A sample
space, together with a probability measure, is
called a probability space.
S 1,2,3,4,5,6 For A ? S, Pr(A) A/S
Ex. Prob of an odd A 1,3,5, Pr(A) 3/6
7CS 173 Probability
Some things you already know If A is a subset of
S, let A be the complement of A wrt S.
Then Pr(A) 1 - Pr(A)
If A and B are subsets of S, then
Pr(A U B) Pr(A) Pr(B) - Pr(A ? B)
A thought to ponder What if I asked you to pick
a random positive integer?
8CS 173 Probability
Choose a door to win a prize!
Monty Hall puzzle. http//www.letsmakeadeal.com/
9CS 173 Probability
- Rules of the game
- Pair up and choose one person to be Monty, the
other to be a contestant. - Repeat 5 times, recording 1 point for every win
- Monty secretly choose one door to be the car
(the other two are goats). - Contestant tell Monty which door you choose.
- Monty reveal a goat, and offer to let contestant
switch doors. - Contestant decline the offer.
- Monty reveal the prize!
10CS 173 Probability
- Rules of the game
- Pair up and choose one person to be Monty, the
other to be a contestant. - Repeat 5 times, recording 1 point for every win
- Monty secretly choose one door to be the car
(the other two are goats). - Contestant tell Monty which door you choose.
- Monty reveal a goat, and offer to let contestant
switch doors. - Contestant accept the offer and switch doors.
- Monty reveal the prize!
11CS 173 Probability
What is the probability that a 5 card poker hand
contains a royal flush?
S all 5 card poker hands. A all royal
flushes Pr(A) A/S
Pr(A) 4/C(52,5)
12CS 173 Probability
Which is more likely
- Rolling an 8 when 2 dice are rolled?
- Rolling an 8 when 3 dice are rolled?
- No clue.
13CS 173 Probability
What is the probability of a total of 8 when 2
dice are rolled?
What is the size of the sample space?
How many rolls satisfy our condition of interest?
So the probability is 5/36.
14CS 173 Probability
What is the probability of a total of 8 when 3
dice are rolled?
What is the size of the sample space?
How many rolls satisfy our condition of interest?
So the probability is 21/216.
15CS 173 Conditional Probability
Let E and F be events with Pr(F) gt 0. The
conditional probability of E given F, denoted by
Pr(EF) is defined to be Pr(EF) Pr(E?F)/Pr(F).
F
E
16CS 173 Conditional Probability
Pr(EF) Pr(E?F)/Pr(F).
A bit string of length 4 is generated at random
so that each of the 16 bit strings is equally
likely. What is the probability that it contains
at least two consecutive 0s, given that its first
bit is a 0?
Pr(F) 1/2
Pr(E?F)?
0000 0001 0010 0011 0100
Pr(E?F) 5/16
Pr(EF) 5/8