Given a bias coin that flips tails $5$ times, what is $E[p | T^5]$?

35 Views Asked by At

There is a loaded coin that flips tails with probability $p$, where p is known only to be distributed uniformly on the interval $[0,1]$. The coin is flipped five times, each time turning up tails. What is the best estimate of $p$ ?

A solution is provided here in Q1.6 but I don't understand it fully.

The first step makes complete sense (integral of conditional density with $p$):

$E[p|T^5] = \int_0^1 P[p|T^5]pdp$

In the second/thir line of working, they go:

$E[p|T^5] = \int_0^1 \frac{P(T^5 |p)P(p)}{\int_0^1 P[T^5|p]P(p)dp}pdp$

$E[p|T^5] = \frac{\int_0^1 p^6 }{ \int_0^1 p^5} = 6/7$

Here I don't understand, please help me. I understand the Bayes' theorem application (sort of), but I don't know how they got the denominator from $P(T^5)$ to $\int_0^1 P[T^5|p]P(p)dp$. I understand that it's mathematically identical (the integral is just stripping out the conditional density), but I don't understand either the motivation or thinking behind it.