# conditional probability involving mixed variable types

I'm trying to answer the following question

A defective coin minting machine produces coins whose probability of heads is a random variable $$T$$ with PDF $$f_{T}(p) = 1+\mathrm{sin}(2\pi p)$$ if $$p \in [0,1]$$ and $$f_{T}(p)=0$$ otherwise.

In essence a specific coin produced by this machine will have a fixed probability $$T=p$$ of giving heads,but you do not know initially what that probability is. A coin produced by this machine is selected and tossed repeatedly, with successive tosses assumed independent.

a.Find the probability that the first coin toss results in heads.

b.Given that the first coin toss resulted in heads, find the conditional PDF of $$T$$.

c.Given that the first coin toss resulted in heads, find the conditional probability of heads on the second toss.

Now i've worked out the solutions to the three questions. I'm going through the actual solutions and i'm confused as to how they've arrived at a particular point in the solution for part c). As they did theirs differently to me i really wanted to understand their approach too.

The solution is here How did they arrive at the part $$P(B|A) = \int^{1}_{0} P(B|T=p,A) f_{T|A}(p)dp$$? (note i've switched $$P$$ with $$T$$ to not confuse it with the probability $$P$$)? For some reason i'm convinced it should be

$$P(B|A) = \int^{1}_{0} P(B|T=p,A) f_{T}(p)dp$$ and my reasoning is if we let $$C = (B|A)$$ then $$P(C) = \int^{1}_{0} P(C|T=p) f_{T}(p) dp$$ from the continuous version of the law of total probability. Can someone please explain the answer perhaps with a proof and why my reasoning is invalid. Note this is not for any homework assignment i'm just keen to sharpen my skills in probability theory and i want to understand their approach step by step.

Note my solution was

$$P(B|A) = P(A,B)/P(A) = \frac{\int^{1}_{0} P(A,B|T=p) f_{T}(p)}{P(A)} dp$$ which is easier to work with. Regarding their solution

My thinking is they may have got it somewhere like the following.

$$P(B|A) = \frac{\int^{1}_{0} P(A,B,T=p) dp}{P(A)} = \frac{\int^{1}_{0} P(B|A,T=p)P(A,T=p)}{P(A)}$$

Now my guess would be they derived the conditional density distribution from the last part? It looks similar but i realise there is subtleties involved with mixing probabilities and densities. If this is the case i'd be grateful to see the proof thanks!

How did they arrive at the part $$P(B|A) = \int^{1}_{0} P(B|T=p,A) f_{T|A}(p)dp$$?
Conditioning on A has to be respected in both terms under the integral, hence the correct use of $$f_{T|A}(p)$$.
Replacing $$A|B$$ with $$C$$ is not propagated correctly in your expressions and hides the conditioning. 