Run the code with
N=1000 a few times. What do you see? The chance of getting two heads should be about 0.25 or 25%. Why is this? Two ways of thinking about it:
- All possible outcomes are HH, HT, TH, or TT. This is 4 possible outcomes. HH is only 1 of the 4, so the chance of getting HH is $1/4=0.25$ or 25%.
- The chance of one coin showing a H is 0.5 or 50%. For BOTH coins to show H, we'd say "coin 1 shows H AND coin 2 shows H." AND in probability always means multiply. So, $0.5\times 0.5=0.25$.
Notice again in order for probability to come out right, we always requires a large number of trials.
Note: Is the outcome for TT, HT, or TH any different? Try it! (Ans: No, but why?)