Given a random variable \(x = \{ 0,1\} \) where \(0\) corresponds to heads and \(1\) corresponds to tails.

For a single coin flip: \( \mathbf{P}(x \mid p) = p^x(1-p)^{1-x}\).

For a sequence of \(n\) coin flips: \( \mathbf{P}(x_1,…,x_n \mid p) = \prod_{i=1}^n p^{x_i}(1-p)^{1-x_{i}}\).

I have a bag with three types of coins with the following probabilities of drawing each type:

\( \mathbf{P}(p=.5) = .7 \), \( \mathbf{P}(p=.1) = .2 \), \( \mathbf{P}(p=.9) = .1 \).

I draw a coin from the bag. I flip it \(n\) times resulting in a sequence \(X_1,…,X_n\).

- Using Bayes rule provide the formula for

\[ \mathbf{P}(p = .1 \mid x_1,…,x_n),\quad

\mathbf{P}(p = .5 \mid x_1,…,x_n), \quad\text{and}\quad

\mathbf{P}(p = .9 \mid x_1,…,x_n) \]. - If \(x_1,x_2,x_3,x_4,x_5,x_6,x_7,x_8)=(1,1,0,1,1,0,0,1)\) what is the most likely value probability \(p \) of the coin the was used ?