BFC 34303 CIVIL ENGINEERING STATISTICS Chapter 2 Probability Faculty of Civil and Environmental Engineering Universiti Tun Hussein Onn Malaysia 1 What is a ‘probability’? A probability is a number (between zero and one) that describes the chance or likelihood that something will happen. The following three key words are used in the study of probability: Experiment • A process that leads to the occurrence of one and only one of several possible observations Outcome • A particular result of an experiment Event • A collection of one or more outcomes of an experiment 2 1 Example: Rolling a die Experiment Basic Outcomes Possible Events Rolling a die 1 2 3 4 5 6 • Observe an even number • Observe an odd number • Observe a number less than 3 3 Sample Space Sample space is the set of all basic or possible outcomes. It is denoted by the letter S. Example: What is the size of the sample space when two dice are rolled? Sample space, S = { (1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6) } n(S) = 36 4 2 Event An event is the subset of basic outcomes from the sample space. Example: Observing odd numbers when rolling a die. The basic outcomes are 1, 2, 3, 4, 5 and 6 Thus, the sample space, S = { 1, 2, 3, 4, 5, 6 } If A is the event of observing odd numbers, then A = { 1, 3, 5 } A 2 4 6 1 3 5 5 Mutually Exclusive If only one of several events can occur at one time, we refer to the events as mutually exclusive. In other words, the occurrence of one event means that none of the others can occur at the same time. Example: In a die tossing experiment, the event ‘getting an even number’ and the event ‘getting an odd number’ are mutually exclusive. They can never happen together. 6 3 In a die tossing experiment, let A = getting an odd number and B = getting an even number. A = { 1, 3, 5 } A B = { 2, 4, 6 } B 1 5 3 2 4 6 A∩B=∅ Empty set because the two events do not intersect A and B are mutually exclusive 7 Collectively Exhaustive If an experiment has a set of events that includes every possible outcome, then the set of events is collectively exhaustive. Example: In a die tossing experiment, every outcome (1, 2, 3, 4, 5, 6) will be either even or odd. So the set is collectively exhaustive. Note: If the set of events is collectively exhaustive and the events are mutually exclusive, the sum of the probabilities equals to 1. 8 4 In a die tossing experiment, let A = getting an odd number and B = getting an even number. A = { 1, 3, 5 } A B 1 5 4 2 B = { 2, 4, 6 } 6 3 A∪B=S A and B are collectively exhaustive 9 Example: In a die tossing experiment, let C = getting an odd number and D = getting a multiple of 3. Are C and D mutually exclusive? Are C and D collectively exhaustive? C = { 1, 3, 5 } 2 C D = { 3, 6 } D 1 5 3 6 C∩D={3}≠∅ 4 Not mutually exclusive C ∪ D = { 1, 3, 5, 6 } ≠ S Not collectively exhaustive 10 5 Probability of an Event The probability of an event A happening is denoted by P(A), where P(A) = Number of possible outcomes in A Number of possible outcomes in S = n(A) n(S) P(A) satisfies the following conditions: 0 < P(A) < 1 If P(A) = 1, event A is a sure event. If P(A) = 0, event A is an impossible event. The complement of an event A is denoted by A’ or A. This means that the event A does not happen. P(A’) = 1 – P(A) 11 Example: Two dice are tossed. What is the probability of getting the sum of 6? Also, what is the probability of not getting the sum of 6? We know that n(S) = 36 Let X be the event of getting the sum of 6 So, X = { (1,5), (2,4), (3,3), (4,2), (5,1) } n(X) = 5 Therefore, the probability of getting the sum of 6, P(X) = n(X) / n(S) P(X) = 5 / 36 = 0.139 The probability of not getting the sum of 6 P(X’) = 1 – 0.139 = 0.861 12 6 Rules of Probability Rules of Addition For two events A and B, if their probabilities are written as P(A) and P(B) then the rules of addition can be written as follows: Mutually Exclusive Events Non-mutually Exclusive Events P(A 𝑜𝑟 B) = P(A) + P(B) P(A ∪ B) = P(A) + P(B) P(A 𝑜𝑟 B) = P(A) + P(B) − P(A 𝑎𝑛𝑑 B) P(A ∪ B) = P(A) + P(B) − P(A ∩ B) 13 Rules of Multiplication For two events A and B, if their probabilities are written as P(A) and P(B) then the rules of multiplication can be written as follows: Mutually Exclusive Events Independent Events Dependent Events P(A 𝑎𝑛𝑑 B) = 0 P(A ∩ B) = 0 P(A 𝑎𝑛𝑑 B) = P(A) × P(B) P(A ∩ B) = P(A) × P(B) P(A 𝑎𝑛𝑑 B) = P(A) × P(B|A) P(A ∩ B) = P(A) × P(B|A) P(B|A) means the probability event B occurs when event A has occurred. 14 7 Example: An integer is randomly selected from a set of integers, S = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }. Find the probability that the integer (a) is an even number and a factor of 10. (b) is an even number or a factor of 10. Let E = even number and F = factor of 10 E = { 2, 4, 6, 8, 10, 12 } n(E) = 6 F = { 1, 2, 5, 10 } n(F) = 4 We know that n(S) = 12 Therefore, P(E) = 6 / 12 = 0.50 and P(F) = 4 / 12 = 0.33 15 E and F are not mutually exclusive. (a) (b) P(E ∩ F) = P(E) × P(F) = 0.50 × 0.33 = 0.17 P(E ∪ F) = P(E) + P(F) − P(E ∩ F) = 0.50 + 0.33 − 0.17 = 0.66 16 8 Probability Tree Diagrams We can construct a probability tree diagram to solve probability problems. A probability tree diagram shows all the possible events. The first event is represented by a dot. From the dot, branches are drawn to represent all possible outcomes of the event. The probability of each outcome is written on its branch. P(G) P(H) P(G) Outcome G P(H) Outcome H P(G) Outcome G P(H) Outcome H Outcome G Outcome H 17 Multiply P(G) P(H) P(G) Outcome G P(G) × P(G) = a P(H) Outcome H P(G) × P(H) = b P(G) Outcome G P(H) × P(G) = c P(H) Outcome H P(H) × P(H) = d Outcome G Add Outcome H a + b + c + d = 1.0 When using the tree diagram, the following rules apply: 1. Multiply probabilities along the branch 2. Add probabilities down the column 3. All probabilities should total up to 1.0 18 9 Example: A bag contains 2 apples and 6 oranges. Jane picks a fruit at random from the bag and returns it to the bag. She mixes the fruits in the bag and then picks another fruit at random from the bag. Calculate the probability of Jane picking (a) the same fruit (b) at least one apple (c) an orange in her second pick 19 Let A = apple and O = orange P(A) = 2/8 = 0.25, P(O) = 6/8 = 0.75 0.25 0.75 0.25 A 0.25 × 0.25 = 0.0625 0.75 O 0.25 × 0.75 = 0.1875 0.25 O 0.75 × 0.25 = 0.1875 0.75 O 0.75 × 0.75 = 0.5625 A O Total = 1.0 20 10 (a) Probability of Jane picking the same fruit P(A ∩ A) + P(O ∩ O) = 0.0625 + 0.5625 = 0.625 (b) Probability of Jane picking at least one apple P(A ∩ A) + P(A ∩ O) + P(O ∩ A) = 0.0625 + 0.1875 + 0.1875 = 0.4375 (c) Probability of Jane picking an orange in her second pick P(A ∩ O) + P(O ∩ O) = 0.1875 + 0.5625 = 0.75 21 Conditional Probability When an event occurs with the condition that another event has occurred, then the event is a conditional event or dependent event. The probability that an event will occur given that another event has already occurred is called conditional probability. For events A and B in sample space S, the probability of “A occurring given that B has occurred” or simply mentioned as the probability of “A given B” is denoted by P(A|B). P(A|B) = P(A ∩ B) P(B) where P(B) ≠ 0 22 11 Example: Rajesh travels to work by either route A or route B. The probability that he chooses route A is 0.6. The probability that he is late for work if he uses route A is 0.3 while the probability that he is late for work if he uses route B is 0.2. Given that Rajesh is not late for work, what is the probability he had chosen route B? 23 Let A = route A, B = route B and L = late for work. 0.6 0.4 0.3 L 0.6 × 0.3 = 0.18 0.7 L’ 0.6 × 0.7 = 0.42 0.2 L 0.4 × 0.2 = 0.08 0.8 L’ 0.4 × 0.8 = 0.32 A B Total = 1.0 24 12 The probability of being late for work P(L) = P(A ∩ L) + P(B ∩ L) = 0.18 + 0.08 = 0.26 The probability of not being late for work P(L’) = P(A ∩ L’) + P(B ∩ L’) = 0.42 + 0.32 = 0.74 or P(L’) = 1 - P(L) = 1 – 0.26 = 0.74 The probability of choosing route B given that Rajesh is not late for work P(B|L’) = P(B ∩ L’) = P(L’) 0.32 = 0.43 0.74 25 Note: If A and B are independent events, it means that the outcome of one event does not affect the outcome of the other. Therefore: P(A|B) = P(A) P(B|A) = P(B) 26 13 Question: If P(A|B) is 0.2, what is P(B|A)? Bayes’ Theorem Bayes’ Theorem (formulated by Thomas Bayes) describes the probability of an event, based on prior knowledge of conditions that might be related to the event. Bayes’ Theorem is useful when we have to “reverse the conditions” in a problem. P(A|B) = P(B|A) × P(A) P(B) 27 Example: From a survey conducted on employees in a company, it was found that 90% of the employees living more than 5 km from work travel to work by car. Of the remaining employees, 50% travel to work by car. It is known that 75% of employees live more than 5 km from work. Determine (a) the percentage of employees who travel to work by car. (b) the probability an employee lives more than 5 km from work who travels to work by car. 28 14 D1 = lives more than 5 km from work D2 = lives not more than 5 km from work C = travels to work by car We know the following: P(D1) = 0.75 therefore, P(D2) = 0.25 P(C|D1) = 0.90 P(C|D2) = 0.50 29 0.75 0.25 0.9 C 0.75 × 0.9 = 0.675 0.1 C’ 0.75 × 0.1 = 0.075 0.5 C 0.25 × 0.5 = 0.125 0.5 C’ 0.25 × 0.5 = 0.125 D1 D2 Total = 1.0 30 15 (a) Percentage of employees who travel to work by car P(C) = P(D1) × P(C|D1) + P(D2) × P(C|D2) = (0.75 × 0.9) + (0.25 × 0.5) = 0.675 + 0.125 = 0.80 80% of employees travel to work by car 31 (b) Probability an employee lives more than 5 km from work who travels to work by car, which is P(D1|C) We know that P(C|D1) = 0.90 Using Bayes’ Theorem P(D1|C) = P(C|D1) × P(D1) = P(C) 0.90 × 0.75 0.80 = 0.844 32 16