# User talk:Ddykstra

## Segment 1. Let's Talk about Probability

### Problems

#### To Calculate

1. Prove $P(ABC)\ =\ P(B)\ P(C|B)\ P(A|BC)$

$P(ABC)\ =\ \cancel{P(B)}\ \left(\frac{\cancel{P(BC)}}{\cancel{P(B)}} \right)\ \left(\frac{P(ABC)}{\cancel{P(BC)}} \right)$

2. What is the probability that the sum of two dice is odd with neither being a 4? Edited--Ddykstra 16:21, 16 January 2013 (CST)

     1  2  3  4  5  6
+-------------------
1 | 2  3  4  X  6  7
2 | 3  4  5  X  7  8
3 | 4  5  6  X  8  9
4 | X  X  X  X  X  X
5 | 6  7  8  X 10 11
6 | 7  8  9  X 11 12

Probability: 12/36 OR 1/3

That's not right. You have to consider all 36 combinations of the dice because there are two ways to get certain pairs. Consider the simplified case of two coins. You can get both heads or both tails with probability 1/4 each, but there are clearly two ways to get one head and one tail, so the probability of that is P=1/2. This can also be seen by considering that the P=1-2*1/4. --Noah 12:51, 16 January 2013 (CST)
Yeah, you're right. I guess I over thought it for a second. Correct answer is 1/3.

## Segment 2. Bayes

### Problems

#### To Calculate

1. If the knight had captured a Gnome instead of a Troll, what would his chances be of crossing safely?

$P(H_{3}|G)\ \alpha\ P(G|H_{3})\ P(H_{3})$

$P(H_{3}|G)\ =\ \frac{1*\frac{3}{5}}{\frac{3}{5}*\frac{1}{5}+\frac{4}{5}*\frac{1}{5}+1*\frac{3}{5}}\ = \frac{15}{22}$

2. Suppose that we have two identical boxes, A and B. A contains 5 red balls and 3 blue balls. B contains 2 red balls and 4 blue balls. A box is selected at random and exactly one ball is drawn from the box. What is the probability that it is blue? If it is blue, what is the probability that it came from box B?

#### In Class Exercise

##### Knight/Troll/Gnome

Simulate the Knight/Troll/Gnome problem 100,000 times.

Code

import random

caughttroll_safe = 0
caughttroll_notsafe = 0

for x in range(100000):
approach = random.uniform(0,1)
if (approach < 0.2):
H1 = random.uniform(0,1)
if H1 < 0.4:
caughttroll_notsafe += 1

elif (approach < 0.4):
H2 = random.uniform(0,1)
if H2 < 0.2:
caughttroll_safe += 1
print caughttroll_notsafe
print caughttroll_safe
print float(caughttroll_safe)/float((caughttroll_safe+caughttroll_notsafe))<\code>


Results

Caught Troll, crossed safely = 7986

Caught Troll, did not cross safely = 3978

(Caught Troll, did not cross safely) / (Total # of times the knight caught a troll) = 0.332497492477

##### Unfair Coin to Fair Coin Strategy

You are an oracle that, when asked, says "yes“ with probability ½ and "no" with probability ½. How do you do this using only a coin that comes up heads with unknown but constant probability P?

Travis' and my Solution
1. Flip the unfair coin N number of times, say 1,000,000 times, count the number of heads. We'll denote this as "N1".
2. Flip it again N number of times and count the number of heads in this set. We'll denote this as "N2".
3. Answer yes when $\frac{N1}{2*N2} \ge 0.5$
4. Answer no when $\frac{N1}{2*N2} < 0.5$

## Segment 3. Monty Hall

### Problems

#### In Class Exercise

There are N doors. You pick one.  Monte then opens n others, leaving  closed your door along with N‐n‐1 others. You are offered the chance to switch to one other door. Should you switch or stay?

Simulation Work

Get answers for specific cases N=7 doors: open n=3, or 4, or 5; and N=8 doors: open n=3, 4, or 5.

With Sean and Kkumar

Analytical Solution

As a function of N and n, what is the ratio of your probability of winning, switch vs. stay?  When is this greater than 1?