Title: CS 199: Discrete Math Bonus
1CS 199Discrete Math Bonus!
- Cinda Heeren
- heeren_at_cs.uiuc.edu
- Siebel Center, rm 2213
- Office Hours W 930-1130a
2CS 199 Announcements
- Lectures available at http//www.cs.uiuc.edu/cla
ss/cs173 under the cs199 tab. - Homework 2 available. Please post your solutions
to the cs173 wiki. Solutions are due by next
class period. New policy everyone must
contribute something. - Wiki https//www-s.cs.uiuc.edu/wiki/cs173
3CS 173 Permutations with indistinguishable
objects
- How many different strings can be made from the
letters in the word rat?
How many different strings can be made from the
letters in the word egg?
4CS 173 Permutations with indistinguishable
objects
How many different strings can be made from the
letters in the phrase nano-nano?
Key thoughts 8 positions, 3 kinds of letters to
place.
In how many ways can we place the ns?
In how many ways can we place the as?
In how many ways can we place the os?
5CS 173 Permutations with indistinguishable
objects
How many distinct permutations are there of the
letters in the word APALACHICOLA?
How many if the two Ls must appear together?
How many if the first letter must be an A?
6CS 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?
7CS 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)?
8CS 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?
9CS 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!)
10CS 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)
11CS 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
12CS 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?
13CS 173 Probability
Choose a door to win a prize!
Monte Hall puzzle.
14CS 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)
15CS 173 Probability
Which is more likely
- Rolling an 8 when 2 dice are rolled?
- Rolling an 8 when 3 dice are rolled?
- No clue.
16CS 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.
17CS 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.
18CS 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
19CS 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
20CS 173 Independence
The events E and F are independent if and only if
Pr(E?F) Pr(E) x Pr(F).
Let E be the event that a family of n children
has children of both sexes. Lef F be the event
that a family of n children has at most one
boy. Are E and F independent if
n 2?
21CS 173 Independence
The events E and F are independent if and only if
Pr(E?F) Pr(E) x Pr(F).
Let E be the event that a family of n children
has children of both sexes. Lef F be the event
that a family of n children has at most one
boy. Are E and F independent if
n 3?
22CS 173 Independence
The events E and F are independent if and only if
Pr(E?F) Pr(E) x Pr(F).
Let E be the event that a family of n children
has children of both sexes. Lef F be the event
that a family of n children has at most one
boy. Are E and F independent if
n 4?
23CS 173 Independence
The events E and F are independent if and only if
Pr(E?F) Pr(E) x Pr(F).
Let E be the event that a family of n children
has children of both sexes. Lef F be the event
that a family of n children has at most one
boy. Are E and F independent if
n 5?
24CS 173 Independence
The events E and F are independent if and only if
Pr(E?F) Pr(E) x Pr(F).
Let E be the event that a family of n children
has children of both sexes. Lef F be the event
that a family of n children has at most one
boy. Are E and F independent if
n 4?
n 2?
n 3?
n 5?
25CS 173 Birthdays
How many people have to be in a room to assure
that the probability that at least two of them
have the same birthday is greater than 1/2?
Let pn be the probability that no people share a
birthday among n people in a room.
Then 1 - pn is the probability that 2 or more
share a birthday.
We want the smallest n so that 1 - pn gt 1/2.
26CS 173 Bernoulli Trials
A coin is tossed 8 times. What is the
probability of exactly 3 heads in the 8 tosses?
THHTTHTT is a tossing sequence
How many ways of choosing 3 positions for the
heads?
What is the probability of a particular sequence?
In general The probability of exactly k
successes in n independent Bernoulli trials with
probability of success p, is