1 / 26

CS 199: Discrete Math Bonus!

CS 199: Discrete Math Bonus!. Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 9:30-11:30a. CS 199 Announcements. Lectures available at: http://www.cs.uiuc.edu/class/cs173 under the cs199 tab.

bebe
Download Presentation

CS 199: Discrete Math Bonus!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 199:Discrete Math Bonus! Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 9:30-11:30a

  2. CS 199 Announcements • Lectures available at: http://www.cs.uiuc.edu/class/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 Cs173 - Spring 2004

  3. 6 3 CS 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? Cs173 - Spring 2004

  4. 8C4, now 4 spots are left 4C2, now 2 spots are left 2C2, now 0 spots are left CS 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? Cs173 - Spring 2004

  5. CS 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? Cs173 - Spring 2004

  6. CS 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? Cs173 - Spring 2004

  7. CS 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)? Cs173 - Spring 2004

  8. CS 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? Cs173 - Spring 2004

  9. CS 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!) Cs173 - Spring 2004

  10. CS 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 we’re going to ask. Often convenient to choose a sample space of equally likely events. {(1,1),(1,2),(1,3),…,(6,6)} Cs173 - Spring 2004

  11. CS 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 Cs173 - Spring 2004

  12. Inclusion-Exclusion CS 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? Cs173 - Spring 2004

  13. Experiment CS 173 Probability Choose a door to win a prize! Monte Hall puzzle. Cs173 - Spring 2004

  14. Questions? CS 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) Cs173 - Spring 2004

  15. CS 173 Probability Which is more likely: • Rolling an 8 when 2 dice are rolled? • Rolling an 8 when 3 dice are rolled? • No clue. Cs173 - Spring 2004

  16. 36 5 CS 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. Cs173 - Spring 2004

  17. 216 C(7,2) CS 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. Cs173 - Spring 2004

  18. CS 173 Conditional Probability Let E and F be events with Pr(F) > 0. The conditional probability of E given F, denoted by Pr(E|F) is defined to be: Pr(E|F) = Pr(EF)/Pr(F). F E Cs173 - Spring 2004

  19. CS 173 Conditional Probability Pr(E|F) = 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(E|F) = 5/8 Cs173 - Spring 2004

  20. No CS 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? Cs173 - Spring 2004

  21. Yes CS 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? Cs173 - Spring 2004

  22. No CS 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? Cs173 - Spring 2004

  23. No CS 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? Cs173 - Spring 2004

  24. No Yes No No CS 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? Cs173 - Spring 2004

  25. 23 183 365 730 CS 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 > 1/2. Cs173 - Spring 2004

  26. .58 C(n,k)pk(1-p)n-k CS 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 Cs173 - Spring 2004

More Related