3/28/2017

# Basic Concepts of Probability

An event is a set of possible outcomes of an experiment.The probability of an event is what we expect its relative frequency to approach as we run the experiment a large number of times.These values can arise from several sources.

Probabilities are always numbers in the range $$0$$ to $$1$$.

### Theory

If the elementary outcomes of an experiment are discrete and all equally likely, the theoretical probability of an event is defined as

$\frac{\text{Number of elementary outcomes in the event}}{\text{Total number of elementary outcomes}}$

As an example, consider the probability of getting a head when you flip a fair coin. There are two elementary outcomes of this experiment, a head, or a tail. Since the coin is fair, the outcomes are equally likely. There are two possible outcomes and only one is in our event. So, the probability is $$1/2$$. In everyday language, you may hear “fifty-fifty.” To stick with the language of probability we say that the probability is $$.5$$.

# Choosing a Sample Space

Using equally likely elementary outcomes with discrete experiments is clearly advantageous. Consider the probability of getting a sum of seven dots when rolling a pair of dice. If we think of the elementary outcomes of this experiment as the numbers between two and twelve, the outcomes are not equally likely. There is only one way to get a sum of two and only one way to get sum of twelve, but there are many ways to get a sum of seven. There are 36 possible equally likely elemementary outcome when we consider the orderd pairs of outcomes describing what happened to die 1 and what happened to die 2. These are $$(2,5),(5,2),(3,4),(4,3),(6,1) \text{ and } (1,6)$$. Since there are six of them, the probabiliy of getting a seven is $$6/36$$.

# Empirical

This is really just noting that you can describe some empirical facts using the language of probability. An example or two should help.

Based on the Current Population Survey, about 60% of the US population over the age of 16 meets the definition of participating in the labor force. We can say that if a member of the population over the age of 16 were picked at random, the probability of that person being a labor force participant is about .6.

Based on data from the CDC, there were 2,515,458 deaths in the US in 2010. Of those the primary cause of death was heart disease in 596,577 cases. We can say that if we were to pick a 2010 death certificate at random the probability of the death having a primary cause of heart disease is .237.

# Subjective

This is really just the using the language of probability to express a personal degree of belief. Here are some examples based on my own personal experiences.

• I believe that the probability of having a class cancelled next winter because of snow is about .5.

• I believe that the probability of my laptop having a hardware failure during the next 6 months is less than .05.

# Exercise 1

A family has three children. What is the probability that exactly two of them are girls? Assume that the probability of having a girl for a birth outcome is exactly .5 How do you construct the sample space?

# Exercise 2

Let’s consider the experiment of throwing a pair of dice and recording the number of dots on the upward faces as the outcome. Draw the sample space and find the probability of getting a 5 or a 6.

# Rules

There are several formulas which allow us to compute probabilities of subsets of the sample space defined by the usual set-theoretic constructs, Union, Intersection and complementation.

# Addition Law - General Case

$P(A\text{ or }B)=P(A)+P(B)-P(A\text{ and }B)$ Example Draw a single card from a 52 card deck. What is the probability of a heart or an ace?
$P(\text{Heart or Ace})=P(\text{Heart})+P(\text{Ace})-P(\text{Heart and Ace})$

$P(\text{Heart or Ace})=\frac{13}{52}+\frac{4}{52}-\frac{1}{52}=\frac{16}{52}=\frac{4}{13}$

The subtraction of the third term is necessary because the first two terms would have counted the ace of hearts twice.

# Addition Law - Special Case

If the two events are mutually exclsuive (disjoint), the third term may be omitted since its value is zero. $P(A\text{ or }B)=P(A)+P(B)$ ## Example Draw a single card from a 52 card deck. What is the probability of a heart or a spade?
$P(\text{Heart or Ace})=P(\text{Heart})+P(\text{Spade})$

$P(\text{Heart or Spade})=\frac{13}{52}+\frac{13}{52}=\frac{26}{52}=\frac{1}{2}$ The simpler version is applicable because no card can be both a heart and a spade. We say that these two events are disjoint or mutually exclusive.

# The Complements Law

If A is an event, either it occcurs or does not occur whenever the experiment we are thinking of occurs. If we think of events as subsets of a sample space, then every outcome is in the subset A or not in the subset A. The set of all outcomes not in the event A is called the complement of A, sometimes denoted $$A^{c}$$. No outcome is both in A and in $$A^{c}$$ (mutually exclusive). Also, every outcome is in one of these (exhaustive). In set theoretic terms $$A \cup A^{c} = \text{Sample Space}$$.

The practical consequence is that $P(\text{A}) + P(\text{not A}) = 1.$

# Example

What is the probability of not getting heart when you draw a single card from a 52 card deck?

$P(\text{not Heart}) = 1 - P(\text{Heart}) = 1 -\frac{13}{52} = \frac{3}{4}$

# Multiplication Law - General Case

In considering the probability that a pair of events both occur, we have to consider that the probability of one of these events occuring may depend on whether the other one did or did not occur. That is the events may not be independent.

$P(\text{A and B}) = P(\text{A})*P(\text{B given that A has occured}).$ The phrasing in the second expression is generally replaced with a single vertical bar, ‘|’ between the two event names. The law is then written as $P(\text{A and B}) = P(\text{A})*P(\text{B|A}).$

# Example

What is the probability of drawing two hearts if you draw two cards from a 52 card deck without replacement. There are two events involved, getting a heart on the first draw (H1) and getting a heart on the second draw (H2).

$P(\text{H1 and H2}) = P(\text{H1})*P(\text{H1|H2})$

$P(\text{H1 and H2}) = \frac{13}{52}*\frac{12}{51}=\frac{3}{51}=\frac{1}{17}$

# Multiplication Law - Special Case

$P(\text{A and B}) = P(\text{A})*P(\text{B}).$ If the probability that B will occur does not depend on whether A has occurred or not, we say that the two events are independent. In this case, we use the simple probability rather than the conditional probability.

# Example

What is the probability of drawing two hearts if you draw two cards from a 52 card deck with replacement. There are two events involved, getting a heart on the first draw (H1) and getting a heart on the second draw (H2). However, when we include the stipulation “with replacement,” the condition of the deck on the second draw is the same as it was on the first draw.

$P(\text{H1 and H2}) = \frac{13}{52}*\frac{13}{52}=\frac{1}{4} *\frac{1}{4}=\frac{1}{16}$

# Exercise

Assume that there are 365 days in a year. Imagine a pair of people. What is the probability that they have different dates of birth? If the first two have different dates of birth and a third person joins the group, what is the probability that all three have different dates of birth? What happens as more people join the group?

# Solution in Sage

# When the first person arrives, there are 365 days open on the calendar

DaysOpen = 365
ProbOpenDay = 1

# Observe what happens to the probability of each new person having an unoccupied date of birth.

for person in range(1,366):
print "For person", person, "the probability of an open date is", ProbOpenDay
DaysOpen = DaysOpen - 1
ProbOpenDay = ProbOpenDay * (DaysOpen -1)/365.0
## For person 1 the probability of an open date is 1
## For person 2 the probability of an open date is 0.994520547945
## For person 3 the probability of an open date is 0.986346406455
## For person 4 the probability of an open date is 0.975537130768
## For person 5 the probability of an open date is 0.962173608429
## For person 6 the probability of an open date is 0.946357055961
## For person 7 the probability of an open date is 0.928207742559
## For person 8 the probability of an open date is 0.90786346327
## For person 9 the probability of an open date is 0.885477788834
## For person 10 the probability of an open date is 0.861218123386
## For person 11 the probability of an open date is 0.835263604599
## For person 12 the probability of an open date is 0.807802883352
## For person 13 the probability of an open date is 0.779031821753
## For person 14 the probability of an open date is 0.749151149138
## For person 15 the probability of an open date is 0.718364115612
## For person 16 the probability of an open date is 0.686874181777
## For person 17 the probability of an open date is 0.65488278153
## For person 18 the probability of an open date is 0.622587192304
## For person 19 the probability of an open date is 0.590178543937
## For person 20 the probability of an open date is 0.557839993584
## For person 21 the probability of an open date is 0.525745089844
## For person 22 the probability of an open date is 0.494056344703
## For person 23 the probability of an open date is 0.462924027091
## For person 24 the probability of an open date is 0.432485186954
## For person 25 the probability of an open date is 0.402862913875
## For person 26 the probability of an open date is 0.374165829599
## For person 27 the probability of an open date is 0.346487809327
## For person 28 the probability of an open date is 0.319907922584
## For person 29 the probability of an open date is 0.29449058079
## For person 30 the probability of an open date is 0.270285875519
## For person 31 the probability of an open date is 0.247330088831
## For person 32 the probability of an open date is 0.225646355016
## For person 33 the probability of an open date is 0.205245451686
## For person 34 the probability of an open date is 0.186126697282
## For person 35 the probability of an open date is 0.168278931789
## For person 36 the probability of an open date is 0.151681557695
## For person 37 the probability of an open date is 0.13630561897
## For person 38 the probability of an open date is 0.122114896995
## For person 39 the probability of an open date is 0.109067003891
## For person 40 the probability of an open date is 0.0971144555197
## For person 41 the probability of an open date is 0.0862057084613
## For person 42 the probability of an open date is 0.0762861474877
## For person 43 the probability of an open date is 0.0672990123042
## For person 44 the probability of an open date is 0.0591862546566
## For person 45 the probability of an open date is 0.051889319151
## For person 46 the probability of an open date is 0.0453498433128
## For person 47 the probability of an open date is 0.0395102744478
## For person 48 the probability of an open date is 0.0343144027396
## For person 49 the probability of an open date is 0.0297078116869
## For person 50 the probability of an open date is 0.0256382484421
## For person 51 the probability of an open date is 0.0220559178379
## For person 52 the probability of an open date is 0.0189137048856
## For person 53 the probability of an open date is 0.0161673312995
## For person 54 the probability of an open date is 0.0137754521483
## For person 55 the probability of an open date is 0.0116996990849
## For person 56 the probability of an open date is 0.00990467675954
## For person 57 the probability of an open date is 0.00835791901901
## For person 58 the probability of an open date is 0.00702981133928
## For person 59 the probability of an open date is 0.00589348567074
## For person 60 the probability of an open date is 0.00492469350568
## For person 61 the probability of an open date is 0.00410166253624
## For person 62 the probability of an open date is 0.00340494177666
## For person 63 the probability of an open date is 0.0028172394974
## For person 64 the probability of an open date is 0.00232325777731
## For person 65 the probability of an open date is 0.00190952694025
## For person 66 the probability of an open date is 0.00156424261681
## For person 67 the probability of an open date is 0.00127710767071
## For person 68 the probability of an open date is 0.0010391807622
## For person 69 the probability of an open date is 0.000842732892081
## For person 70 the probability of an open date is 0.000681112885381
## For person 71 the probability of an open date is 0.000548622433704
## For person 72 the probability of an open date is 0.000440401022124
## For person 73 the probability of an open date is 0.000352320817699
## For person 74 the probability of an open date is 0.000280891391645
## For person 75 the probability of an open date is 0.000223173982403
## For person 76 the probability of an open date is 0.000176704879218
## For person 77 the probability of an open date is 0.000139427411547
## For person 78 the probability of an open date is 0.000109631964696
## For person 79 the probability of an open date is 8.59034024741e-05
## For person 80 the probability of an open date is 6.70752594661e-05
## For person 81 the probability of an open date is 5.21900648996e-05
## For person 82 the probability of an open date is 4.04651736071e-05
## For person 83 the probability of an open date is 3.12635039923e-05
## For person 84 the probability of an open date is 2.40686154023e-05
## For person 85 the probability of an open date is 1.84635953771e-05
## For person 86 the probability of an open date is 1.41132687951e-05
## For person 87 the probability of an open date is 1.07492841782e-05
## For person 88 the probability of an open date is 8.15767593798e-06
## For person 89 the probability of an open date is 6.16854399694e-06
## For person 90 the probability of an open date is 4.64753314838e-06
## For person 91 the probability of an open date is 3.48883310316e-06
## For person 92 the probability of an open date is 2.60945599223e-06
## For person 93 the probability of an open date is 1.9445809038e-06
## For person 94 the probability of an open date is 1.44378472583e-06
## For person 95 the probability of an open date is 1.06800513966e-06
## For person 96 the probability of an open date is 7.87105157721e-07
## For person 97 the probability of an open date is 5.77929266491e-07
## For person 98 the probability of an open date is 4.22759216858e-07
## For person 99 the probability of an open date is 3.08093018313e-07
## For person 100 the probability of an open date is 2.236839722e-07
## For person 101 the probability of an open date is 1.61787859344e-07
## For person 102 the probability of an open date is 1.1657590961e-07
## For person 103 the probability of an open date is 8.36791460761e-08
## For person 104 the probability of an open date is 5.98363208928e-08
## For person 105 the probability of an open date is 4.26231326907e-08
## For person 106 the probability of an open date is 3.02449078545e-08
## For person 107 the probability of an open date is 2.13785924013e-08
## For person 108 the probability of an open date is 1.50528719099e-08
## For person 109 the probability of an open date is 1.05576307094e-08
## For person 110 the probability of an open date is 7.37587898878e-09
## For person 111 the probability of an open date is 5.13280346069e-09
## For person 112 the probability of an open date is 3.55780623439e-09
## For person 113 the probability of an open date is 2.45634841388e-09
## For person 114 the probability of an open date is 1.68916014215e-09
## For person 115 the probability of an open date is 1.15695900147e-09
## For person 116 the probability of an open date is 7.89267921553e-10
## For person 117 the probability of an open date is 5.36269711082e-10
## For person 118 the probability of an open date is 3.62900325034e-10
## For person 119 the probability of an open date is 2.44584876598e-10
## For person 120 the probability of an open date is 1.64173410319e-10
## For person 121 the probability of an open date is 1.09748800323e-10
## For person 122 the probability of an open date is 7.30656396671e-11
## For person 123 the probability of an open date is 4.84435199985e-11
## For person 124 the probability of an open date is 3.19859953962e-11
## For person 125 the probability of an open date is 2.10318873838e-11
## For person 126 the probability of an open date is 1.37715646157e-11
## For person 127 the probability of an open date is 8.97981473573e-12
## For person 128 the probability of an open date is 5.83072902018e-12
## For person 129 the probability of an open date is 3.77000561305e-12
## For person 130 the probability of an open date is 2.42726388785e-12
## For person 131 the probability of an open date is 1.55610890345e-12
## For person 132 the probability of an open date is 9.93351710967e-13
## For person 133 the probability of an open date is 6.3139067656e-13
## For person 134 the probability of an open date is 3.99592455576e-13
## For person 135 the probability of an open date is 2.51797985706e-13
## For person 136 the probability of an open date is 1.57977366374e-13
## For person 137 the probability of an open date is 9.86817521461e-14
## For person 138 the probability of an open date is 6.13719390059e-14
## For person 139 the probability of an open date is 3.80001594941e-14
## For person 140 the probability of an open date is 2.34247558525e-14
## For person 141 the probability of an open date is 1.4375740578e-14
## For person 142 the probability of an open date is 8.78298670929e-15
## For person 143 the probability of an open date is 5.34198095743e-15
## For person 144 the probability of an open date is 3.23445970299e-15
## For person 145 the probability of an open date is 1.94953735523e-15
## For person 146 the probability of an open date is 1.16972241314e-15
## For person 147 the probability of an open date is 6.98628728942e-16
## For person 148 the probability of an open date is 4.15349134741e-16
## For person 149 the probability of an open date is 2.4579565234e-16
## For person 150 the probability of an open date is 1.44783740419e-16
## For person 151 the probability of an open date is 8.48869053417e-17
## For person 152 the probability of an open date is 4.95367420213e-17
## For person 153 the probability of an open date is 2.87720255028e-17
## For person 154 the probability of an open date is 1.66325955646e-17
## For person 155 the probability of an open date is 9.56943854404e-18
## For person 156 the probability of an open date is 5.47948672796e-18
## For person 157 the probability of an open date is 3.12255682031e-18
## For person 158 the probability of an open date is 1.77087468988e-18
## For person 159 the probability of an open date is 9.99452564698e-19
## For person 160 the probability of an open date is 5.61336371953e-19
## For person 161 the probability of an open date is 3.13733205147e-19
## For person 162 the probability of an open date is 1.74487234643e-19
## For person 163 the probability of an open date is 9.65655380765e-20
## For person 164 the probability of an open date is 5.31771867216e-20
## For person 165 the probability of an open date is 2.9138184505e-20
## For person 166 the probability of an open date is 1.58862978534e-20
## For person 167 the probability of an open date is 8.61777253417e-21
## For person 168 the probability of an open date is 4.65123613488e-21
## For person 169 the probability of an open date is 2.49765008887e-21
## For person 170 the probability of an open date is 1.33436100638e-21
## For person 171 the probability of an open date is 7.09222014351e-22
## For person 172 the probability of an open date is 3.75013284301e-22
## For person 173 the probability of an open date is 1.97267261879e-22
## For person 174 the probability of an open date is 1.03227526079e-22
## For person 175 the probability of an open date is 5.3734876589e-23
## For person 176 the probability of an open date is 2.78243607543e-23
## For person 177 the probability of an open date is 1.43314515666e-23
## For person 178 the probability of an open date is 7.34241491221e-24
## For person 179 the probability of an open date is 3.74161417444e-24
## For person 180 the probability of an open date is 1.89643458157e-24
## For person 181 the probability of an open date is 9.56010857557e-25
## For person 182 the probability of an open date is 4.79315032693e-25
## For person 183 the probability of an open date is 2.39000920411e-25
## For person 184 the probability of an open date is 1.18518264642e-25
## For person 185 the probability of an open date is 5.84473633852e-26
## For person 186 the probability of an open date is 2.86632275232e-26
## For person 187 the probability of an open date is 1.39782315044e-26
## For person 188 the probability of an open date is 6.77848486654e-27
## For person 189 the probability of an open date is 3.26852968907e-27
## For person 190 the probability of an open date is 1.56710327558e-27
## For person 191 the probability of an open date is 7.47057451921e-28
## For person 192 the probability of an open date is 3.54084764883e-28
## For person 193 the probability of an open date is 1.66856382356e-28
## For person 194 the probability of an open date is 7.81710722818e-29
## For person 195 the probability of an open date is 3.64084446244e-29
## For person 196 the probability of an open date is 1.68576086069e-29
## For person 197 the probability of an open date is 7.75911848209e-30
## For person 198 the probability of an open date is 3.55006242879e-30
## For person 199 the probability of an open date is 1.61454894022e-30
## For person 200 the probability of an open date is 7.29864589413e-31
## For person 201 the probability of an open date is 3.27939157983e-31
## For person 202 the probability of an open date is 1.46449541784e-31
## For person 203 the probability of an open date is 6.49995226549e-32
## For person 204 the probability of an open date is 2.86710223218e-32
## For person 205 the probability of an open date is 1.25681193739e-32
## For person 206 the probability of an open date is 5.4748793985e-33
## For person 207 the probability of an open date is 2.36994779442e-33
## For person 208 the probability of an open date is 1.01940220198e-33
## For person 209 the probability of an open date is 4.35689708245e-34
## For person 210 the probability of an open date is 1.850189172e-34
## For person 211 the probability of an open date is 7.80627760241e-35
## For person 212 the probability of an open date is 3.27222047443e-35
## For person 213 the probability of an open date is 1.36267811538e-35
## For person 214 the probability of an open date is 5.63738069651e-36
## For person 215 the probability of an open date is 2.31673179308e-36
## For person 216 the probability of an open date is 9.4573434841e-37
## For person 217 the probability of an open date is 3.83475845383e-37
## For person 218 the probability of an open date is 1.54440956908e-37
## For person 219 the probability of an open date is 6.1776382763e-38
## For person 220 the probability of an open date is 2.45413027415e-38
## For person 221 the probability of an open date is 9.68204820485e-39
## For person 222 the probability of an open date is 3.79324080355e-39
## For person 223 the probability of an open date is 1.47572655919e-39
## For person 224 the probability of an open date is 5.70075191357e-40
## For person 225 the probability of an open date is 2.18658977507e-40
## For person 226 the probability of an open date is 8.32701311602e-41
## For person 227 the probability of an open date is 3.14829536989e-41
## For person 228 the probability of an open date is 1.18168894706e-41
## For person 229 the probability of an open date is 4.40300539177e-42
## For person 230 the probability of an open date is 1.62850884353e-42
## For person 231 the probability of an open date is 5.97863520639e-43
## For person 232 the probability of an open date is 2.17851639027e-43
## For person 233 the probability of an open date is 7.87847023331e-44
## For person 234 the probability of an open date is 2.82761534401e-44
## For person 235 the probability of an open date is 1.00709587595e-44
## For person 236 the probability of an open date is 3.55932515061e-45
## For person 237 the probability of an open date is 1.24820169665e-45
## For person 238 the probability of an open date is 4.34305795822e-46
## For person 239 the probability of an open date is 1.49924740476e-46
## For person 240 the probability of an open date is 5.1344089204e-47
## For person 241 the probability of an open date is 1.74429234556e-47
## For person 242 the probability of an open date is 5.87802626038e-48
## For person 243 the probability of an open date is 1.9647101473e-48
## For person 244 the probability of an open date is 6.5131487075e-49
## For person 245 the probability of an open date is 2.14130916411e-49
## For person 246 the probability of an open date is 6.98125453504e-50
## For person 247 the probability of an open date is 2.25695352092e-50
## For person 248 the probability of an open date is 7.23461813555e-51
## For person 249 the probability of an open date is 2.29922110609e-51
## For person 250 the probability of an open date is 7.24412129316e-52
## For person 251 the probability of an open date is 2.26254747239e-52
## For person 252 the probability of an open date is 7.0045990241e-53
## For person 253 the probability of an open date is 2.14935641287e-53
## For person 254 the probability of an open date is 6.53639895422e-54
## For person 255 the probability of an open date is 1.96987365744e-54
## For person 256 the probability of an open date is 5.88263640166e-55
## For person 257 the probability of an open date is 1.74061570241e-55
## For person 258 the probability of an open date is 5.10262685364e-56
## For person 259 the probability of an open date is 1.48185875749e-56
## For person 260 the probability of an open date is 4.26288135717e-57
## For person 261 the probability of an open date is 1.21462920862e-57
## For person 262 the probability of an open date is 3.42758379419e-58
## For person 263 the probability of an open date is 9.57845334266e-59
## For person 264 the probability of an open date is 2.65047613043e-59
## For person 265 the probability of an open date is 7.26157843955e-60
## For person 266 the probability of an open date is 1.96957880963e-60
## For person 267 the probability of an open date is 5.2881842012e-61
## For person 268 the probability of an open date is 1.40535306169e-61
## For person 269 the probability of an open date is 3.69627106636e-62
## For person 270 the probability of an open date is 9.62043154258e-63
## For person 271 the probability of an open date is 2.47759058905e-63
## For person 272 the probability of an open date is 6.31276506251e-64
## For person 273 the probability of an open date is 1.59116270069e-64
## For person 274 the probability of an open date is 3.96700837705e-65
## For person 275 the probability of an open date is 9.78166449136e-66
## For person 276 the probability of an open date is 2.38511819105e-66
## For person 277 the probability of an open date is 5.75042194005e-67
## For person 278 the probability of an open date is 1.37064851722e-67
## For person 279 the probability of an open date is 3.22947321865e-68
## For person 280 the probability of an open date is 7.52069105713e-69
## For person 281 the probability of an open date is 1.73078917479e-69
## For person 282 the probability of an open date is 3.9357671646e-70
## For person 283 the probability of an open date is 8.84199746567e-71
## For person 284 the probability of an open date is 1.96219669786e-71
## For person 285 the probability of an open date is 4.3007050912e-72
## For person 286 the probability of an open date is 9.30837540287e-73
## For person 287 the probability of an open date is 1.9891870724e-73
## For person 288 the probability of an open date is 4.19636724861e-74
## For person 289 the probability of an open date is 8.73764139437e-75
## For person 290 the probability of an open date is 1.79540576597e-75
## For person 291 the probability of an open date is 3.640000731e-76
## For person 292 the probability of an open date is 7.280001462e-77
## For person 293 the probability of an open date is 1.43605508292e-77
## For person 294 the probability of an open date is 2.79342221608e-78
## For person 295 the probability of an open date is 5.35724808564e-79
## For person 296 the probability of an open date is 1.01274004907e-79
## For person 297 the probability of an open date is 1.88674858456e-80
## For person 298 the probability of an open date is 3.46334671687e-81
## For person 299 the probability of an open date is 6.26248995379e-82
## For person 300 the probability of an open date is 1.11523793698e-82
## For person 301 the probability of an open date is 1.95548569771e-83
## For person 302 the probability of an open date is 3.3752218892e-84
## For person 303 the probability of an open date is 5.73325362001e-85
## For person 304 the probability of an open date is 9.58160194029e-86
## For person 305 the probability of an open date is 1.5750578532e-86
## For person 306 the probability of an open date is 2.54598392709e-87
## For person 307 the probability of an open date is 4.04567308962e-88
## For person 308 the probability of an open date is 6.31790044132e-89
## For person 309 the probability of an open date is 9.69321711545e-90
## For person 310 the probability of an open date is 1.46062175712e-90
## For person 311 the probability of an open date is 2.16091985985e-91
## For person 312 the probability of an open date is 3.13777404307e-92
## For person 313 the probability of an open date is 4.47025343123e-93
## For person 314 the probability of an open date is 6.24610753405e-94
## For person 315 the probability of an open date is 8.55631169047e-95
## For person 316 the probability of an open date is 1.14865554201e-95
## For person 317 the probability of an open date is 1.51056071278e-96
## For person 318 the probability of an open date is 1.94510557536e-97
## For person 319 the probability of an open date is 2.45136593059e-98
## For person 320 the probability of an open date is 3.02223196922e-99
## For person 321 the probability of an open date is 3.64323853824e-100
## For person 322 the probability of an open date is 4.29203444231e-101
## For person 323 the probability of an open date is 4.93877935827e-102
## For person 324 the probability of an open date is 5.54766996409e-103
## For person 325 the probability of an open date is 6.07963831681e-104
## For person 326 the probability of an open date is 6.49605190015e-105
## For person 327 the probability of an open date is 6.76301293714e-106
## For person 328 the probability of an open date is 6.85565694998e-107
## For person 329 the probability of an open date is 6.76174384108e-108
## For person 330 the probability of an open date is 6.4838639572e-109
## For person 331 the probability of an open date is 6.03976368616e-110
## For person 332 the probability of an open date is 5.46060826419e-111
## For person 333 the probability of an open date is 4.78738258779e-112
## For person 334 the probability of an open date is 4.06599617045e-113
## For person 335 the probability of an open date is 3.34191466064e-114
## For person 336 the probability of an open date is 2.65521986736e-115
## For person 337 the probability of an open date is 2.03688099414e-116
## For person 338 the probability of an open date is 1.50673388608e-117
## For person 339 the probability of an open date is 1.07328989145e-118
## For person 340 the probability of an open date is 7.35130062638e-120
## For person 341 the probability of an open date is 4.83373191871e-121
## For person 342 the probability of an open date is 3.04591326385e-122
## For person 343 the probability of an open date is 1.83589292615e-123
## For person 344 the probability of an open date is 1.05626716299e-124
## For person 345 the probability of an open date is 5.78776527667e-126
## For person 346 the probability of an open date is 3.0128093221e-127
## For person 347 the probability of an open date is 1.48576898076e-128
## For person 348 the probability of an open date is 6.92001991041e-130
## For person 349 the probability of an open date is 3.03343338538e-131
## For person 350 the probability of an open date is 1.24661645975e-132
## For person 351 the probability of an open date is 4.78154258533e-134
## For person 352 the probability of an open date is 1.70301516738e-135
## For person 353 the probability of an open date is 5.59895397494e-137
## For person 354 the probability of an open date is 1.68735599245e-138
## For person 355 the probability of an open date is 4.62289312999e-140
## For person 356 the probability of an open date is 1.13989145671e-141
## For person 357 the probability of an open date is 2.49839223389e-143
## For person 358 the probability of an open date is 4.79143716088e-145
## For person 359 the probability of an open date is 7.87633505898e-147
## For person 360 the probability of an open date is 1.07895000808e-148
## For person 361 the probability of an open date is 1.18241096776e-150
## For person 362 the probability of an open date is 9.71844631034e-153
## For person 363 the probability of an open date is 5.32517606046e-155
## For person 364 the probability of an open date is 1.45895234533e-157
## For person 365 the probability of an open date is 0.0

# Bayes Law

In the description of the multiplication law above, we have assumed that A occurs first and may (or may not) influence the probability that a second event, B occurs. We imagine that an observer, having observed A, obtains an improved estimate of the probability that B will occur. In some circumstances, it makes sense to reverse our thinking and become more like a detective. If B has been observed, what is the probability that A occurred?

Write two equivalent expressions for $$P(\text{A and B}).$$ $P(\text{A and B}) = P(\text{A})*P(\text{B|A}) = P(\text{B}) *P(\text{A|B}).$

Now solve the equation relating the second and third equations for $$P(\text{A|B})$$.

$P(\text{A})*P(\text{B|A}) = P(\text{B}) *P(\text{A|B})$

$P(\text{A|B}) = \frac{P(\text{A})*P(\text{B|A})}{P(\text{B})}$

In many cases, we don’t know the probability of B directly. However we can construct it. If B occured, either A occurred and then B occured or; A did not occur and then B occurred anyway. These two possibilities are mutually exclusive and exhaustive. Therefore we can write

$P(\text{B}) = P(\text{A}) * P(\text{B|A})+P(\text{ not A}) *P(\text{B| not A})$

# Example

Return to the problem of drawing two hearts from a 52 card deck without replacement. Suppose the second card was a heart. What is the probability that the first card was also a heart?

$P(\text{H1|H2}) = \frac{P(\text{H1})*P(\text{H2|H1})}{P(\text{H2})}$

Now rewrite the denominator

$P(\text{H1|H2}) = \frac{P(\text{H1})*P(\text{H2|H1})}{P(\text{H1})*P(\text{H2|H1})+P(\text{not H1})*P(\text{H2 | not H1})}$

Now let’s insert the numerical values.

$P(\text{H1|H2}) = \frac{\frac{13}{52}*\frac{12}{51}}{\frac{13}{52}*\frac{12}{51}+\frac{39}{52}*\frac{13}{51}}$