I'm going through Bertsekas' and Tsitsiklis' "Introduction to Probability" and I'm stuck understanding a problem. This is not homework, and I have the solution. But I don't understand it, and I wonder if I am missing something or if there is an error.
A coin minting machine produces coins whose probability of heads is a random variable with density $f_P(p) = pe^p$ for $0 < p < 1$. Given that the first toss resulted in heads, find the conditional probability that of heads on the next one.
I am summarizing the solution a bit. Let $A$ be the event that the first flip is heads. Let $B$ be the event that the second flip is heads.
We use the continuous law of total probability to calculate $Pr(A) = e - 2$.
Using Bayes theorem:
$$ \begin{align} f_{P|A}(p) &= \frac{P(A|P=p)f_P(p)}{Pr(A)} \\ &= \frac{p^2 e^p}{e - 2} \end{align} $$
Finally, we use continuous total probability to compute
$$ \begin{align} Pr(B|A) &= \int_0^1 Pr(B|P=p, A) f_{P|A}(p) \mathrm{d}p \\ &= \int_0^1 Pr(B|P=p) f_{P|A}(p) \mathrm{d}p \\ &= \frac{1}{e-2} \int_0^1 p^3 e^p \mathrm{d}p \end{align} $$
I am confused about these integrals. In particular, it seems to me that either the first or second ones are wrong. If the first one is right, how are we justified in dropping the dependence on $A$ in the second integral?
The first integral is basically the Law of Total Probability, applied to continuous RV.
If you were talking about discrete partitions $\{C_k\}$, you would have the recognisable form: $$\Pr(B) = \sum_{k} \Pr(B\mid C_k)\Pr(C_k)$$ Which when conditioned over event A the LoTP would be: $$\Pr(B\mid A) = \sum_{k} \Pr(B\mid A, C_k)\Pr(C_k\mid A)$$ And the analogous form for a continuous case is: $$\Pr(B\mid A) = \int_{\bf C} \Pr(B\mid A, C=x)f_{C\mid A}(x)\operatorname{d}x$$ And specifically: $$\Pr(B\mid A) = \int_0^1 \Pr(B\mid A, P=p)f_{P\mid A}(p)\operatorname{d}p$$
The next step is simply that events A and B refer to different tosses of the same coin; so they are independent.
$$\Pr(B\mid A, P=p) = \Pr(B\mid P=p)$$