COM2023 Mathematics Methods for Computing II Lecture 5& 6 Gianne Derks Department of Mathematics (36AA04) http://www.maths.surrey.ac.uk/Modules/COM2023 Autumn 2010 Use channel 04 on your EVS handset Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Probability Some definitions . . . . . . . . . . . . . . More definitions . . . . . . . . . . . . . . Example: Throwing an unbiased die . Throwing a fair dodecahedron die . . Rules Rules of Probability . . . . . . . . Exercise on rules of probability Partition Law . . . . . . . . . . . . Exercise on Partition Law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 5 6 7 . . . . . . . . . . . . 8 . 9 10 11 12 Overview Probability ● Introduction: notation, definitions and an example ● Recall definitions and example ● Rules of probability and Venn diagrams ● Conditional probability Introduction to probability (§3.1) Some definitions ● The sample space is the set of all possible outcomes. For example the sample space related to observations of a traffic light is S = {red, orange, green, red-orange}. ● An event is a collection of some outcomes in the sample space. For example, for the sample space above, a possible event would be the event A = {orange, red-orange}. ● The complement of the event A are all outcomes in S, that are not in A. The complement of A is denoted by Ac . For example, with S and A as defined above, Ac = {red, green}. A A 2 c More definitions ● ● The union union of two events A and B is denoted by A ∪ B. It contains all outcomes in A or in B or in both. For example, if B = {red, orange}, then A ∪ B = {red, orange, red-orange}. The intersection of two events A and B is denoted by A ∩ B. It contains all outcomes which are both in A and in B. In the example, A ∩ B = {orange}. A B A B ● The events A and B are said to be disjoint if they have no common outcome, i.e., A ∩ B is empty. ● The probability that the event A happens is denoted by P (A). Example: Throwing an unbiased die Sample space: S = {1, 2, 3, 4, 5, 6}. First some events: • Event A = {2, 4, 6} ⇒ P (A) = • Event B = {5, 6} ⇒ P (B) = 1 2 1 3 Related events: 1 2 2 3 • Event Ac = {1, 3, 5} ⇒ P (Ac ) = • Event B c = {1, 2, 3, 4} ⇒ P (B c ) = • Event A ∪ B = {2, 4, 5, 6} ⇒ P (A ∪ B) = • Event (A ∪ B)c = {1, 3} ⇒ P ((A ∪ B)c ) = • Event A ∩ B = {6} ⇒ P (A ∩ B) = • Event (A ∩ B)c = {1, 2, 3, 4, 5} ⇒ P ((A ∩ B)c ) = 3 2 3 1 3 1 6 5 6 Throwing a fair dodecahedron die Sample space: S = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}. Some events: • Event A = {1, 3, 5, 7, 9, 11} ⇒ P (A) = • Event B = {2, 3, 5, 7, 11} ⇒ P (B) = 1 2 5 12 Related events: 1 2 7 12 • Event Ac = {2, 4, 6, 8, 10, 12} ⇒ P (Ac ) = • Event B c = {1, 4, 6, 8, 9, 10, 12} ⇒ P (B c ) = • Event A ∪ B = {1, 2, 3, 5, 7, 9, 11} ⇒ P (A ∪ B) = • Event (A ∪ B)c = {4, 6, 8, 10, 12} ⇒ P ((A ∪ B)c ) = • Event A ∩ B = {3, 5, 7, 11} ⇒ P (A ∩ B) = • Event (A ∩ B)c = {1, 2, 4, 6, 8, 9, 10, 12} ⇒ P ((A ∩ B)c ) = 7 12 5 12 1 3 2 3 Rules of Probability (§3.2) Rules of Probability General rules ● P (S) = 1, where S is the sample space; ● P (∅) = 0, where ∅ is an empty event; ● 0 ≤ P (A) ≤ 1, for any event A; ● P (Ac ) = 1 − P (A), for any event A; Addition law ● P (A ∪ B) = P (A) + P (B), whenever A ∩ B = ∅; ● P (A ∪ B) = P (A) + P (B) − P (A ∩ B). A B 4 Exercise on rules of probability Manufactured components can have two types of common defect, call them defect I and defect II. Sampling has shown that ● 5% of the components have defect I; ● 2% of the components have defect II; ● 0.5% of the components have both defects. A component is selected randomly. What is the probability that this component does not have defect I nor defect II? Answer: P ((A ∪ B)c ) = 1 − [P (A) + P (B) − P (A ∩ B)] = 93.5% Partition Law ● Partition the sample space S into two events B and B c : P (A) = P (A ∩ B) + P (A ∩ B c ). ● Partition the sample space S into three events B1 , B2 , and B3 : P (A) = P (A ∩ B1 ) + P (A ∩ B2 ) + P (A ∩ B3 ). ● Partition sample space S into k events B1 , B2 , . . . Bk : P (A) = k X i=1 5 P (A ∩ Bi ). Exercise on Partition Law Light bulbs are produced in four colours: blue, green, red and orange and equal amounts of each colour are produced. Sampling has shown that 0.25*98% ● 2% of the blue bulbs is faulty; ● 5% of the green bulbs is faulty; ● 7% of the red bulbs is faulty; Blue 0.25*95% Green 0.25*2% 0.25*5% 0.25*7% 0.25*1% Red Orange 1% of the orange bulbs is faulty. 0.25*93% 0.25*99% Make a Venn diagram with all colours and indicate the proportion of faulty ones in each colour. ● ● If you get an arbitrary light bulb, what is the change of getting a faulty blue one? 2% × 0.25 = 0.5% ● How about the other colours? gr: 1.25%, red: 1.75%, or: 0.25% ● Take an arbitrary light bulb; what is the change of getting a faulty one? P(faulty)= 0.5% + 1.25% + 1.75% + 0.25% = 3.75% 6