|
1 | 1 | \begin{answer}{bayescoins}
|
2 |
| -This is another question about Bayes' law. |
3 |
| -Let's make some notation to use. |
| 2 | +This is another question that tests your knowledge of Bayes' law. |
| 3 | +Let's define some notation to use. |
4 | 4 | Define $H$ as the event that a coin comes up head, and $T$ that a coin comes up tails, and let $10H$ denote getting ten heads from ten coin flips.
|
5 | 5 | Let $C_{F}$ be the event where we select the fair coin from the bag, and $C_{R}$ the event that we select the rigged coin.
|
6 | 6 | This is one of the simplest questions about Bayes' law as there is not much to unpack.
|
|
27 | 27 | Since this will happen with certainty
|
28 | 28 | $P( 10H \vert C_{R} ) = 1$.
|
29 | 29 | For the fair coin each flip is independent, so you have
|
30 |
| -$P( 10H \vert C_{F} )=P( 10 \vert C_{F} )^{10}= ({1}/{2})^{10} = {1}/{1024}$. |
| 30 | +$$P( 10H \vert C_{F} )=P( H \vert C_{F} )^{10}= ({1}/{2})^{10} = {1}/{1024}.$$ |
31 | 31 | Since you picked te coin out of a bag of 1000 coins, the probability that you selected the rigged coin is
|
32 | 32 | $P(C_{R}) = 1/1000$ and the probability that the coin you selected is fair is
|
33 | 33 | $P(C_{F}) = 999/1000$.
|
34 |
| -You can substitute |
| 34 | +You can substitute these into \eqref{eq:1000coins:bayeslaw1} to get |
35 | 35 | \begin{align*}
|
36 | 36 | P( C_{R} \vert 10H)
|
37 | 37 | &=
|
|
69 | 69 | which is slightly more than $1/2$.
|
70 | 70 |
|
71 | 71 | This question is so well known that your interviewer likely won't even let you finish it.
|
72 |
| -Once they see you can answer it they will move on to the next question. |
| 72 | +Once they see that you are on the right track they will move on to the next question. |
73 | 73 | My interviewer didn't care about the answer, but he wanted me to describe \eqref{eq:1000coins:bayeslaw1} in detail.
|
74 | 74 | Since Bayes' law is just the application of conditional probability, you can derive it from first principles:
|
75 | 75 | \begin{align}
|
|
82 | 82 | P( 10H )
|
83 | 83 | }
|
84 | 84 | \end{align}
|
85 |
| -and even a frequentist will agree with you here. |
86 |
| -The nominator is the joint probability of ten heads and the rigged coin, and it is easier to split this into another conditional probability: |
| 85 | +and even a frequentist will agree. |
| 86 | +The nominator is the joint probability of ten heads and the rigged coin being selected, and it is easier to split this into another conditional probability: |
87 | 87 | \begin{align*}
|
88 | 88 | P( 10H , C_{R} )
|
89 | 89 | =
|
|
97 | 97 | P( C_{R} \vert 10H ) p( 10H )
|
98 | 98 | \text{,}
|
99 | 99 | \end{align*}
|
100 |
| -but this is not helpful, as it contains the probability we are trying to determine and will lead to circular reasoning. |
| 100 | +but this is not helpful, as it contains the quantity we are trying to solve for, $P( C_{R} \vert 10H )$, and will lead to circular reasoning. |
101 | 101 |
|
102 | 102 | You can expand denominator in
|
103 | 103 | \eqref{eq:1000coins:bayesexplain}
|
|
119 | 119 | \text{,}
|
120 | 120 | \end{align*}
|
121 | 121 | by applying the law of conditional probability to each of the terms.
|
122 |
| -Combining the nominator and the denominator yields \eqref{eq:1000coins:bayeslaw1}. |
| 122 | +Putting all this together yields \eqref{eq:1000coins:bayeslaw1}. |
123 | 123 |
|
124 | 124 | My interviewer used this Bayes' law question to test my handle on probability concepts.
|
125 | 125 | It is easy to confuse these basic concepts, which is another reason for doing proper interview preparation.
|
126 | 126 | Some interviewers ask this question and demand an ``intuitive'' solution that doesn't rely on algebraic manipulation.
|
127 |
| -In this case, you could opt for a visual explanation of Bayes' Law, like that of answer \ref{a:bayeslawdisease}. |
| 127 | +In this case, you could opt for a visual explanation of Bayes' Law as discussed in answer \ref{a:bayeslawdisease}. |
128 | 128 | If that's not what your interviewer wants, use the following argument.
|
129 | 129 | You know the probability of choosing the rigged coin is $1/1000$.
|
130 | 130 | You also know the probability of getting ten heads from a fair coin is $1/2^{10} = 1/1024$.
|
131 | 131 | These two events are about equally likely, meaning the probability that we have the double headed coin is about a half.
|
132 | 132 | If you only had nine heads in a row, the fair coin would give a probability of $1/512 = 2/1024$.
|
133 |
| -That means the outcome of nine heads is about twice as likely with the fair coin as the probability of selecting the rigged coin. |
| 133 | +That means the outcome of nine heads is about twice as likely with the fair coin as the probability of selecting the rigged coin from the bag. |
134 | 134 | So the odds of ${fair}{:}{rigged}$ are $2{:}1$, leading you to assign a probability of about $1/3$ to the rigged coin being selected.
|
135 | 135 | %TODO: could link this up to section on gambling mathematics
|
136 | 136 | \end{answer}
|
|
0 commit comments