Box contains 2 different coins, one is chosen randomly and tossed n times, head came all n times. Probability that n+1 toss is a head too? A box contains two coins: a regular coin and one fake two-headed coin (P(H)=1). One coin is choose at random and tossed $n$ times. 
If the first n coin tosses result in heads, What is the probability that the $(n+1)^{th}$ coin toss will also result in heads?

My solution:
$$\text{Required Probability} = \frac{1}{2}\times \left(\frac{1}{2}\right)^n \times \frac{1}{2}+\frac{1}{2} \times 1^n \times 1$$

First we find the probability that the coin is fair.
To do this we use Bayes theorem, we want $P(A|B)$, where $A$ is the probability the coin is fair and $B$ is the probability the first $n$ flips are heads.
By Bayes theorem:
$P(A|B)=\frac{P(B|A)P(A)}{P(B)}$, the numerator is $\frac{1}{2^{n}}\times \frac{1}{2}$ and the denominator is $\frac{1}{2}+\frac{1}{2^n}\times \frac{1}{2}=\frac{2^n+1}{2^{n+1}}$. hence $P(A|B)=\frac{1}{2^{n}+1}$.
Therefore the final answer is:
$\color {green}{\frac{1}{2^n+1}\times \frac{1}{2}}+\color{\purple}{(1-\frac{1}{2^n+1})}=1-\frac{1}{2(2^n+1)}$
The green part is the probability that it is heads and that the coin is fair, and the purple part is the probability that it is heads and the coin is fake.
