Thursday, March 10, 2011

Interview Question

Suppose you have an unfair coin, with probability of a head p ~ uniform(0,1). What is the probability of getting 2 (or n) heads?

Hints: For 2 heads the answer is not 1/4.

Ans: The answer is 1/3 for 2 heads and 1/(n+1) for n heads. Just integrate
\int_0^1 p^n U(0,1) dp = 1/(n+1)
The implication is that under uniform distribution, TH and HT are not distinguished.

See here for more interview questions/brainteasers