Serving the Quantitative Finance Community

 
User avatar
reaverprog
Topic Author
Posts: 0
Joined: October 28th, 2009, 8:53 am

Coin flipping game

August 29th, 2014, 5:03 am

Hi all,You have n coins. You toss each of them and get $1 if you get head, 0 for tail.First basic question, what's the expected value ?Assume you're allowed to toss a coin again in case you don't get all of them as heads. What's the expected value now ?Thanks
 
User avatar
CommodityQuant
Posts: 61
Joined: July 5th, 2007, 6:16 am

Coin flipping game

August 29th, 2014, 8:55 am

The first one is easy so I'll leave that one out. I'll reword the second one. You toss n coins, with the aim of getting as many heads as possible. After all n coins have been tossed, you are allowed to toss one of the coins again. (Obviously you would only do that with a tail). What is the expected value of the number of heads (translated into dollars)? (However, the original wording is somewhat ambiguous -- it could mean that every coin can be tossed twice.)There are two distinct cases -- either you initially get all heads or you don't. Begin by considering the situation before retossing. The expected value given the all-heads outcome is $ n. The expected value given the not-all-heads outcome is harder to calculate. Call the expected value, given not-all-heads NTH. We have (by the first easy omitted question) 1/2^n * n + (1 - 1/2^n) * NTH = n/2. Hence NTH = (n/2 - n/2^n)/(1 - 1 / 2^n) = n * (2 ^ (n-1) - 1) / (2 ^ n - 1).However, the NTH needs to be increased by 0.5 to allow for the retoss allowance. Hence final answer = $ n / 2^n + (1 - 1/2^n) * ( n * (2 ^ (n-1) - 1) / (2 ^ n - 1) + 1/2). I won't bother to simplify this but I will check for small values of n. For n = 1, the answer should be 3/4. That checks. A much harder question than it looks. If used as an interview-brainteaser, I'd bet the majority would get this wrong. (And I'm not completely confident I haven't made an error). Easy to get right but easy to get wrong.CommodityQuant.
 
User avatar
Vanubis1
Posts: 1
Joined: February 21st, 2011, 7:41 am

Coin flipping game

August 29th, 2014, 12:06 pm

Don't need to calculate NTH, the proba of NTH= 1-1/2^n is sufficient.Final answer is n/2+P(NTH)*0.5
Last edited by Vanubis1 on August 28th, 2014, 10:00 pm, edited 1 time in total.
 
User avatar
Vanubis1
Posts: 1
Joined: February 21st, 2011, 7:41 am

Coin flipping game

August 29th, 2014, 12:12 pm

Another one: what the expected value if you 're allowed to toss again p coins of your choice instead of one?
Last edited by Vanubis1 on August 28th, 2014, 10:00 pm, edited 1 time in total.
 
User avatar
CommodityQuant
Posts: 61
Joined: July 5th, 2007, 6:16 am

Coin flipping game

August 29th, 2014, 3:48 pm

Vanubis1,You are correct that your method is neater and simpler. I hope that I hit the right answer, anyway. As a job-seeker, I wonder if someone could tell me how my approach would come across in a job interview. I was very much doing the question job-interview-style, tackling the problem as soon as I met it. (Of course, in an interview, I wouldn't omit the first part of the question on the grounds of it being too simple.)For the p toss problem, again start out with n/2. Then add 0.5 * ( prob(exactly one tail) + 2 *prob(exactly two tails) + ... p * prob(exactly p tails)) + p/2 * prob(more than p tails). Closed-form formulas for the above probably exist and perhaps you can enlighten us by revealing such.CommodityQuant