Daniela Stan Raicu School of CTI, DePaul University CSC 323 Quarter: Spring 02/03 Daniela Stan Raicu School of CTI, DePaul University 2/19/2019 Daniela Stan - CSC323
Outline Chapter 4: Probability – The Study of Randomness Randomness Probability Models 2/19/2019 Daniela Stan - CSC323
Random Phenomenon Toss a fair coin, sometimes you get heads sometimes you get tails. Roll a die: the die can land on any of the 6 faces. 3. Waiting time at the dentist: sometimes you wait less than 10 minutes & sometimes you wait longer. In a random phenomenon, individual outcomes are uncertain. 2/19/2019 Daniela Stan - CSC323
Random Phenomenon (cont.) There is still a regular pattern in the phenomenon, that is discovered only after many repetitions. Tossing a coins The proportion of heads in “n” tosses of a coin changes as we make more tosses. Eventually it approaches 0.5 2/19/2019 Daniela Stan - CSC323
Probability or Chance The chance or probability of a certain outcome is the percentage of times the outcome is expected to happen, when the process is repeated over and over again, independently and under the same conditions. Tossing a coin: what is the chance of getting a head? Rolling a die: what is the chance of getting a 3? It is 1 in 2 that is 50% It is 1 in 6, that is 16.7% 2/19/2019 Daniela Stan - CSC323
Probability Models The sample space S of a random phenomenon is the set of all possible outcomes. An event is an outcome or a set of outcomes of a random phenomenon (a subspace of the sample space). Probability Rule A: Chances are between 0% and 100%; equivalently, we say probabilities are between 0 and 1. The impossible event occurs 0% of the time, hence has 0% chance to happen (probability=0) The certain event happens every time, hence has 100% chance to happen (probability=1) 2/19/2019 Daniela Stan - CSC323
Probability Models Probability Rule B: All possible outcomes together must have probability 1. Because some outcome must occur on every trial, the sum of the probabilities for all possible outcomes must be exactly one. If the sum of all of the probabilities is less than one or greater than one, then the resulting probability model will be incoherent. 2/19/2019 Daniela Stan - CSC323
Computing Chances To calculate the chance or probability of an event Count all the possible outcomes of the random process Count the outcomes that are favorable to the event The chance is calculated as the ratio # favorable outcomes chance= # all possible outcomes One deck of cards is shuffled and the top card is placed face down on the table. What is the chance that the card is a king of hearts? How many cards are in a deck? How many king of hearts? 2/19/2019 Daniela Stan - CSC323
Examples on Computing Chances What’s the probability of selecting a female student in this class? # of students = 22 # female students = 5 What’s the probability of choosing a red M&M from a bag containing 10 red, 5 blue and 3 yellow candies? 2/19/2019 Daniela Stan - CSC323
Throwing a pair of dice There are 36 ways of throwing two dice. What is the probability of getting a 7? Count the favorable outcomes and divide by 36. 2/19/2019 Daniela Stan - CSC323
The Complement Rule What is the chance that the first card is not a king of hearts? How many cards are in a deck? How many cards are not king of hearts? The answer is 51/52 =1-1/52, that is 1 minus the chance that the first card is a king of hearts; this is an example of the complement rule. The chance of something happening is equal to 100% minus the chance of the opposite event. This is useful if the chance of the “opposite” event is easier to compute. 2/19/2019 Daniela Stan - CSC323
The Complementary Rule Probability Rule C: The complement rule states that: P(Ac) = 1 – P(A) Example: As a jury member, you assess the probability that the defendant is guilty to be 0.80. Thus you must also believe the probability the defendant is not guilty is 0.20 in order to be coherent (consistent with yourself). 2/19/2019 Daniela Stan - CSC323
Computing Probabilities (cont) A deck of cards is shuffled and the second card is placed faced down on the table: What is the probability for the second card to be a king of hearts? What is the probability of the first card to be a king? How many kings in a deck of cards? How many cards? It is equal to the chance of the first card to be a king of hearts 2/19/2019 Daniela Stan - CSC323
Mutually Exclusive Events If two events cannot occur together, the probability that one or the other occurs is the sum of their individual probabilities. Probability Rule D: P(A or B)=P(A)+P(B) What’s the probability of getting 2 or 3 in a roll of a die? P(2 spot face or 3 spot face) = P(2 spot face)+P( 3 spot face) = 2/19/2019 Daniela Stan - CSC323
Examples All human blood can be typed as one of O, A, B, AB. The distribution of the types varies a bit with the race. The table displays the probabilities of a randomly chosen white American. The probabilities are calculated as the proportion of individuals with a given blood type in a very large sample of white Americans. Blood Type O A B AB Probability 0.45 0.40 0.11 ? What’s the probability that a white American has type AB blood? Judy has type B blood. She can safely receive transfusions from people with type O and type B blood. What is the probability that a randomly chosen white American can donate her blood? 2/19/2019 Daniela Stan - CSC323
Intranet Design The Intranet is a private Internet operating on a company's internal network. It is a convenient vehicle within the company for sharing information, documents and databases. In U.S. companies, Intranet is designed either by IT personnel, graphic artists, consultant IT personnel or consultant graphic artists. The probabilities of selecting a company that has Intranet developed by a given professional is displayed below. Intranet developers Internal IT personnel Internal graphic artists Consultant IT personnel Consultant graphic artists Probability 0.40 0.20 0.25 0.15 What is the probability that a company’s Intranet wasn’t designed by a graphic artist? 2/19/2019 Daniela Stan - CSC323
Avoid Being Inconsistent Suppose you see an elderly couple and you think the probability that they are married is 80%. Suppose you think the probability that the elderly couple is married with children is 95%. These two personal probabilities are not coherent. Why? Unmarried Couples Married Couples All Couples Married with Children 2/19/2019 Daniela Stan - CSC323
Conditional Probabilities You win one dollar if the second card is a queen of spades. I) What is the chance of winning one dollar? Probability of second card being a queen of spades: 1/52=0.0192 II) You know that the first card is an ace, what is the chance of winning one dollar? There are 51 cards left in the deck of cards, and there is just one chance out of 51 to get the queen of spades. So the chance is 1/51=0.0196 A conditional probability is the probability of an event, knowing that another event has occurred. 2/19/2019 Daniela Stan - CSC323
Ex. of conditional probability The lab has 30 pc’s, SAS is installed on 20 pc’s. A student wants to use SAS and chooses a pc at random. What is the probability of choosing a pc that runs SAS? Two students are already using two pc’s and working with SAS. What is the probability of choosing a pc that runs SAS? Pr(SAS| two students use SAS)= 2/19/2019 Daniela Stan - CSC323
Multiplication Rule What is the probability that two students choose two computers that have SAS? Two events need to happen together: the first student selects a pc that has SAS the second student selects another pc that has SAS (given that the first student is using a pc with SAS). The first chance is calculated above = 20/30 The chance of the second event is conditional and is 19/29 The probability of the two students choosing two computers with SAS is the product of I and II. The answer is chance = 20/30*19/29=43.67% 2/19/2019 Daniela Stan - CSC323
P(A occurs & B occurs)=P(A occurs) × P(B occurs | A has occurred) Multiplication Rule The chance of two events happening together is equal to the chance that the first will happen multiplied by the chance that the second will happen given that the first has happened. P(A occurs & B occurs)=P(A occurs) × P(B occurs | A has occurred) given Drawing Straws: Six soldiers have to decide between themselves which one goes on a suicide mission. They decide to draw straws: there are 5 long straws and 1 short one, and they take turns picking one. The guy with the short straw loses. Is it better to pick first or second? 2/19/2019 Daniela Stan - CSC323
Independent Events Two events are independent if the chance for the second event to appear is the same, no matter how the first turns out. For instance, roll a die 3 times. Each time you roll a die, this is independent of the other times. Coin tosses are independent of each other, the probability of getting a head won’t change. Lottery drawings are independent!!! The probability of winning does not change from drawing to drawing!! It is always very very small In the Illinois lotto, what’s the “luckiest” combination between these two? 1 2 3 4 5 6 or 3 56 23 67 32 1. 2/19/2019 Daniela Stan - CSC323
Independent Events If two events are independent, the chance of them happening together is equal to the product of their probabilities. The chance of getting two aces in two rolls of a die is P(1st roll =ace & 2nd roll=ace) = P(1st roll =ace)P(2nd roll=ace) = 1/6 1/6 = 1/36 2/19/2019 Daniela Stan - CSC323
Telephone cable A transatlantic telephone company contains repeaters at at regular intervals to amplify the signal. If a repeater fails it must be replaced by fishing the cable to the surface at great expense. Each repeater has 0.999 probability of functioning without failure for 10 years. Repeaters fail independently from each other. What is the probability that two receivers both last for 10 years? P(No failure for receiver 1 and 2)= A company has 10 receivers, what is the probability that only one receiver will fail in 10 years? P(only one receiver will fail)=P(No failure for 9 receiver & one receiver will fail). The events are all independent, so the probability P(No failure for 9 receiver & one receiver will fail) is the product of individual probabilities. 2/19/2019 Daniela Stan - CSC323