Biased coin where probability of heads is uniformly distributed I have been considering a problem that goes as follows:
Suppose that one flips a coin for which the probability of obtaining heads is $P$, and that $P \sim \operatorname{Uniform}(0,1)$. Find the probability of obtaining $HTH$ in the first three trials.
So far, I know that the $P(T)=1-P$, where $T: \text{the event that the coin shows tails}$. 
Assuming that the outcome of each coin flip is independent and P is fixed, I also know that $P(HTH)=P\cdot(1-P)\cdot P=P^2 (1-P)$. 
However, I am unsure that this is the case since it states that P is uniformly distributed. If someone could clarify/point me in the right direction it would be greatly appreciated!

$P^2(1-P)$ is the conditional probability of the sequence $HTH$ given the value of $P$.
The marginal (i.e. "unconditional") probability of that sequence is the $\text{expected value } \operatorname{E}(P^2(1-P)).$
Exercise: Show that if $P$ is uniformly distributed in $(0,1)$ and the conditional distribution of the coin tosses given $P$ is that they are i.i.d. with probability $P$ of heads, then the number of heads is uniformly distributed in the set $\{0,1,2,\ldots,n\},$ where $n$ is the number of tosses.
