# phoenixgarage.org

2. Probability:After years of observations you have found out that if it rains on a given day, there is a 60% chance that it will rain on the next day too. If it is not raining, the chance of rain on the next day is only 25%. The weather forecast for Friday predicts the chance of rain is 75%. What is the probability that

at least one dayof the weekend will haveno rain?

Sounds pretty basic, huh? Well - maybe if you've passed Stats/Probabilities 101 or something; since I've never had that course, all I have to go on is what I've learned in class, and the scraps found here and there and everywhere on the internet, etc. Considering the course never talked about rainy weekends (although there was a bit about cancer and Bayes Rule - but I don't think that applies here).

So, here's what I've done based on suggestions from the forum. Based on a couple of different suggestions, I built a table to show which days were rainy (Y), and which were sunny (N); there's 8 combinations (3 days = 2^3 combos):

Friday | Saturday | Sunday |

N | N | N |

N | N | Y |

N | Y | N |

N | Y | Y |

Y | N | N |

Y | N | Y |

Y | Y | N |

Y | Y | Y |

Just so it is clear, a "Y" in a cell means that it is raining, an "N" means "no rain" (or sunny).

With that, I proceeded with the following calculations; I honestly can't recall if these came from this class, or from the AI class last year, but here goes: First, I set out my base probabilities:

P(Rfr) = 0.75 (probability of rain on Friday) |

P(!Rfr) = 0.25 (probability of no rain on Friday) |

P(Rsa|Rfr) = 0.60 (probability of rain on Saturday given rain on Friday) |

P(Rsa|!Rfr) = 0.25 (probability of rain on Saturday given no rain on Friday) |

As far as I can tell, these match up with what was given in the problem (see above). So, supposedly, in order to find out the probability of rain on Saturday, I need to do the following:

P(Rsa) | = P(Rsa|Rfr) * P(Rfr) + P(Rsa|!Rfr) * P(!Rfr) |

= 0.60 * 0.75 + 0.25 * 0.25 | |

= 0.5125 |

Therefore:

P(!Rsa) | = 1 - P(Rsa) |

= 1 - 0.5125 | |

= 0.4875 |

I am pretty certain that the above is correct; with that in mind, we now have the follow "base probabilities" to calculate for Sunday:

P(Rsa) = 0.5125 |

P(!Rsa) = 0.4875 |

P(Rsu|Rsa) = 0.60 |

P(Rsu|!Rsa) = 0.25 |

...and so:

P(Rsu) | = P(Rsu|Rsa) * P(Rsa) + P(Rsu|!Rsa) * P(!Rsa) |

= 0.60 * 0.5125 + 0.25 * 0.4875 | |

= 0.429375 |

Therefore:

P(!Rsu) | = 1 - P(Rsu) |

= 1 - 0.429375 | |

= 0.570625 |

That leaves me with the following complete set of probabilities as follows:

P(Rfr) = 0.75 |

P(!Rfr) = 0.25 |

P(Rsa) = 0.5125 |

P(!Rsa) = 0.4875 |

P(Rsu) = 0.429375 |

P(!Rsu) = 0.570625 |

Plugging these into our table shows:

Friday | Saturday | Sunday |

N 0.25 | N 0.4875 | N 0.570625 |

N 0.25 | N 0.4875 | Y 0.429375 |

N 0.25 | Y 0.5125 | N 0.570625 |

N 0.25 | Y 0.5125 | Y 0.429375 |

Y 0.75 | N 0.4875 | N 0.570625 |

Y 0.75 | N 0.4875 | Y 0.429375 |

Y 0.75 | Y 0.5125 | N 0.570625 |

Y 0.75 | Y 0.5125 | Y 0.429375 |

Now - I am fairly certain that the above is correct; but how to get from those probability values, to the final value needed, I honestly don't know. One individual said to take the values for "no rain on the weekend" (rows 1 and 5?), get the total probability, and take the inverse (presumably subtract the value you get from 1?). I tried something like that - I tried to add them together, I tried to multiply them together, I subtracted what I got from 1; nothing worked. That is, if I am making the proper assumption of what was meant, of course.

For completeness sake, one person mention running a "numerical simulation"; so I wrote the following in python, which I believe follows what this individual outlined:

size = 10000000.0

fr = []

sa = []

su = []

for i in range(size):

if (randint(0,100) > 25):

fr.append(1)

else:

fr.append(0)

for i in range(len(fr)):

if (fr[i] == 1):

if (randint(0,100) > 40):

sa.append(1)

else:

sa.append(0)

else:

if (randint(0,100) > 75):

sa.append(1)

else:

sa.append(0)

for i in range(len(sa)):

if (sa[i] == 1):

if (randint(0,100) > 40):

su.append(1)

else:

su.append(0)

else:

if (randint(0,100) > 75):

su.append(1)

else:

su.append(0)

count = 0.0

for i in range(size):

if (sa[i] == 0 or su[i] == 0):

count += 1.0

print count / size

I honestly don't know if this is what was meant or not; in the end, it brought my computer to a crawl, spat out a number (something like 0.6999...something) - and that didn't pass, either. It was mentioned that the method only generates an approximation, so (assuming I even coded it correctly), that could be why it doesn't work...