Wednesday, October 30, 2013

Those damn dice... (Part II)

Last time  we investigated questions that ask about the probability of a variety of dice rolling situations. This time we focus on games that involve dice.

 DR04
You roll a six-sided die and a ten-sided die. If you guess the sum correctly you win an amount that equals the sum. What is the optimal guess?

DR04 - Answer:
First of all, think about what "optimal guess" means. It should maximize the expected payoff. Hence we can iterate a table:
Sum                   | 2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
# combination  | 1  2  3  4  5  6  6  6   6   6   5   4   3   2   1
The product is maximized at sum = 11, which is the answer.

DR05
What is the expectation value of the product of rolling a six-sided die and a eight-sided die?

DR05- Answer:
Since the two rolls are independent events, E[A & B] = E[A] * E[B] = 15.75

DR06
The game is as follow: Roll a 12-sided die. You can either get the amount of the roll, or choose to roll two 6-sided dice, at which point you must receive the sum of the two dice. What is the game worth?

DR06- Answer:
Use backward induction. The expected payoff of the second round is 7. Hence you would go for round 2 only if the first round was less than or equals 6. Thus the payoff is
(7 + 8 + 9 + 10 + 11 + 12) / 12 + 0.5 * 7 = 8.25


DR06
What is the expectation value of the absolute difference of the points on two 6-sided dice?

DR06- Answer:
By simple state space counting, the answer is
(0 * 6 + 1 * 10 + 2 * 8 + 3 * 6 + 4 * 4 + 5 * 2) / 36 = 1.94

See here for more interview questions/brainteasers

Friday, October 11, 2013

Brainteaser: Expected Number of Trials

The first part is the classic coin flipping question: For a fair coin, what is the expected number of trials in order to get the first Head? And the answer is 2 (see here for discussion and related problems).

Now, put the coin aside and consider instead a deck of 52 cards. What is the expected number of trials in order to get the first red card? Would it be less than, equal to, or larger than 2? In the coin case, one way to get the answer is to do the infinite sum

$$ E[H] = \sum_{i=1}^{\infty} \frac{1}{2^i} i $$


Now, along the same line we can have a finite series

$$ E[Red] = \sum_{i=1}^{52} P_i i$$

The only problem is that for this case the $P_i$'s are uglier. Just write down the first few terms and we will see

$$ E[Red] = \frac {26}{52}1 + \frac {26}{52} \frac {26}{51}2 + \frac {26}{52} \frac {25}{51} \frac {26}{50}3 + \sum_{i=4}^{52} P_i i$$

As you can see, some of the fractions are greater than 1/2 and some are less. Can we easily conclude if the finite sum is less than or greater than 2?

See here for more interview questions/brainteasers