Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 2: PROBABILITY Part 1: Sample Spaces, Events, and Counting Techniques Section 2.1 Random Experiments • A random experiment is an experiment that can result in a different outcome, even though the experiment is repeated under the same conditions. – Bake cake with a given recipe, at 350◦, in a certain oven, for a certain time length, measure moisture, repeat, ... • Goal is to understand, quantify, and model the type of variations that we encounter. – What might be causing the differences in the levels of moisture for the cakes? 1 • In experiments, some variables are controlled, and others are not. – Sometimes, we realize (after the fact), that we should have controlled some of the variables we left uncontrolled. – But we can’t control everything, so we have to make good choices. 2 • Example process: Catapult a large ball bearing Response: Distance ball bearing travels Controlled variables? – weight of ball bearing – angle of release – force at release Uncontrolled variables? – air resistance/wind/environmental conditionals – small differences in bearings 3 Sample Spaces • A sample space denoted as S is a set or collection of outcomes of a particular random experiment. (Describes all the things that could happen). If we want to discuss which outcomes are more or less likely to occur, we first need to specify all the possible things that could occur, i.e. we should define the sample space. 1. Consider tossing a coin once. S = {H, T } 2. Consider rolling a die. S = {1, 2, 3, 4, 5, 6} 3. Consider an experiment in which you count the number of defects on a molded part. S = {0, 1, 2, 3, . . .} 4. Consider an experiment where you measure the thickness of a part. S = R+ = {x|x > 0} 4 5. Consider an experiment where you measure the thickness of two manufactured parts. S = R+ × R+ 6. A batch contains 4 items: a, b, c, d. Consider the unordered sample space for selecting two items without replacement. S = {ab, ac, ad, bc, bd, cd} (unordered means order doesn’t matter, i.e. we consider ab the same as ba) • A sample space is discrete if it consists of a finite or countable infinite set of outcomes (like the numbers 0, 1, 2, 3,...). • A sample space is continuous if it contains an interval (either finite or infinite) of real numbers. 5 Distinguishing between discrete and continuous sample spaces... Continuous: – The thickness of a part. S = R+ = {x|x > 0} – The weight of a child. S = R+ = {x|x > 0} Discrete: – Tossing a coin once. S = {H, T } – An experiment in which you count the number of defects on a molded part. S = {0, 1, 2, 3, . . .} Note that even though there’s no limit to the number of defects above, it is still discrete. 6 Discrete (continued): – The weight of a child measured by a scale that rounds to the nearest tenth of a pound. S = {0.0, 0.1, 0.2, ..., X} where X is the scale maximum. Even though ‘weight’ is theoretically continuous, the weight provided by the scale is discrete because of the rounding process. 7 • Describing sample spaces graphically with tree diagrams. 1. There are 4 options on vehicles from a manufacturer: (a) (b) (c) (d) With or without automatic transmission With or without air conditioning One of three choices of a stereo system One of four exterior colors Let S represent the set of all possible vehicle types. Every node at the bottom is a different combination. There are 2 × 2 × 3 × 4 = 48 combinations. S is represented by the full set of 48 nodes at the bottom. 8 Events • An event is a subset of the sample space S of a random experiment. It is a set of possible outcomes taken from S. 1. Consider the batch of 4 items: a, b, c, d. Suppose we choose 2 items without replacement and order doesn’t matter, S = {ab, ac, ad, bc, bd, cd}. Let E1 be the subset of outcomes for which a is chosen. E1 = {ab, ac, ad}. E1 is an event. 2. Consider the sample space for rolling a die, S = {1, 2, 3, 4, 5, 6}. • Let E1 = {2, 4, 6}, the subset coinciding with the event of rolling an even number. • Let E2 = {1, 3, 5}, the subset coinciding with the event of rolling an odd number. 9 Looking forward in the course... • We often want to discuss the probability of a certain occurrence (or a set of occurrences with something in common), like... The probability that a randomly chosen object has a defect. The probability that a randomly chosen cell phone is not an iPhone. Thus, we formally define a subset of the possible outcomes (so, we define an event) and then mathematically calculate the probability that the event (or subset) actually occurs. 10 Set Operations • The union of the sets A and B, denoted as A ∪ B, is the set of outcomes in either A or B, or both A and B. Consider E1 (evens) and E2 (odds) that were defined earlier. E1 ∪ E2 = S because putting E1 and E2 together make-up the whole sample space. 11 Continuing the roll of a die, let Ei = {1, 2} and Ej = {2, 6}. Then, Ei ∪ Ej = {1, 2, 6}. More Set Operations • The intersection of the sets A and B, denoted as A ∩ B, is the set of outcomes that are common in A and B. Using our previously defined events E1 (evens) and E2 (odds)... E1 ∩ E2 = ∅ These events have nothing in common. ∅ represents the empty set or null set used when there are no elements in a defined set. And Ei ∩ Ej = {2} 12 • The complement of A, denoted as Ac or A0, is the set of outcomes in S that are not in A. For the odds and evens, E10 = E2 E2 is the complement of E1. E1 ∩ E2 = ∅ E1 ∪ E2 = S and Using Ei = {1, 2} and Ej = {2, 6}, Ei0 = {3, 4, 5, 6} and Ej0 = {1, 3, 4, 5} 13 • Venn Diagrams – Used to visually describe relationships between events. In the following Venn diagrams, the shaded region represents the set stated at the upper right of the last 3 boxes (or sample spaces). 14 • Example: 1. An engineering firm is hired to determine if certain waterways in Iowa city are safe for fishing. Samples are taken from three rivers. Let G represent an outcome where a river was found to be safe for fishing, and F represent an outcome where a river failed to be safe for fishing. i) List the elements of the (ordered) sample space S. ii) Let E1 be the event that at least two of the rivers are safe for fishing. List the elements of E1. 15 iii) Define (in words) an event E2 that has the elements... {GGF, GF G, F GG, GF F, F F G, F GF, F F F }. iv) Define (in words and symbol) the complement of E2. 16 • Example: Exercise 2-6 p.26 2. An ammeter that displays three digits is used to measure current in milliamperes. Give the sample space. • Example: Exercise 2-13 p.26 3. The time of a chemical reaction is recorded to the nearest millisecond. Give the sample space. 17 Counting Techniques - Sometimes, instead of writing out all the outcomes for a sample space, we instead consider the counts of the number of outcomes for analysis. • Multiplication Rule (for counting techniques) – If an operation can be described in a sequence of k steps, and the number of ways to complete step 1 is n1, and the number of ways to complete step 2 is n2, and so forth, then the total number of ways of complete the operation is... n1 × n2 × · · · × nk – Example: As in the automobile maker example, there were 2 × 2 × 3 × 4 = 48 possible vehicles 18 – Example: In the game Guitar Hero, you get to choose a character/guitar/venue combination. You have 8 characters to choose from, 6 guitars, and 4 venues to choose from. There are 8 × 6 × 4 = 192 possible options. 19 • Permutations – A permutation of elements is an ordered sequence of the elements (order matters). – Example: Consider the set of three numbers {1, 2, 3}. Here are the possible permutations of the elements in the set: (1,2,3),(1,3,2),(2,1,3),(2,3,1),(3,1,2),(3,2,1) – The number of permutations of n different elements is n! (pronounced “n factorial”) where n! = n × (n − 1) × · · · × 2 × 1 In the above example, there are 3! = 3 × 2 × 1 = 6 permutations of the set of 3 unique elements. 20 3! = 3 × 2 × 1 = 6 Another way to think of it... There are 3 ways to ‘fill’ the first slot. After you choose the first, there are 2 ways to ‘fill’ the second slot. And then there is only 1 way left to fill the last slot. – Example: Five people stand in line at a movie theater. Into how many different orders can they be arranged? Ans: 21 • Permutations of subsets – Sometimes we are interested in counting the number of permutations of subsets of a certain size chosen from a larger set. – Example: Five lifeguards are available for duty. There are three lifeguard stations. In how many ways can three lifeguards be chosen and ordered among the stations? Five ways to choose the first, 4 ways to choose the second, 3 ways to choose the last station. – In general, the number permutations of r objects chosen from a group of n objects is Prn = n × (n − 1) × · · · × (n − r + 1) 22 – Or this can be stated in factorial notation as Prn = n(n − 1) · · · (n − r + 1) n(n−1)···(n−r+1)(n−r)(n−r−1)···(3)(2)(1) (n−r)(n−r−1)...(3)(2)(1) n! = (n−r)! = Example: Find the number of ways of selecting a president, vice president, secretary, and treasurer in a club of 15 people. 23 • Permutations of Similar Objects – Sometimes we are interested in counting the number of ordered sequences for objects when not all the objects are considered different (i.e. are indistinguishable). – Example: A part is labeled with a bar code such that 2 thin lines (t) and 3 fat lines (f) will be used (for example, |||||). How many distinct patterns can be created if the thick and thin lines can be put in any order? ANS: There are 10 distinct labelings... ttfff, tftff, tfftf, tffft, fttff, ftftf, ftfft, ffttf, fftft, ffftt It might be tempting to answer 5! = 120, but this would over count the number of unique scanning bar codes. 24 – In general, the number of permutations of n = n1 + n2 + · · · nr objects of which n1 are of one type, n2 are of a second type, . . ., and nr are of an rth type is... n! n1!n2!···nr ! (This is also called the multinomial coefficient.) 5! = 10 For the bar code example we have 2!3! • Combinations – In many problems we are interested in the number of ways of selecting r objects from n without regard to order (i.e. order doesn’t matter). These selections are called combinations. 25 – The number of combinations, subsets of size r that can be selected from a set of n n elements, is denoted as or Crn and r pronounced “n choose r” and n n! = r!(n−r)! r – Example: At a company with 35 engineers, the boss will be choosing 5 to go to a conference. How many different groups of 5 members are there to choose from? ANS: 26 If you’re looking for the number of arrangements, you’re probably considering a permutation... order matters. Cabinet members where each position is unique, like president, treasurer, secretary, etc. If you’re choosing a subset where the order doesn’t matter (like in a team of equal players or a committee), then you’re probably considering a combination. Choosing committee members where all members are of equal standing and essentially exchangeable. 27