TITLE: The expected payoff of a dice game
QUESTION [51 upvotes]: There's a question in my Olympiad questions book which I can't seem to solve:

You have the option to throw a die up to three times.  You will earn
  the face value of the die.  You have the option to stop after each
  throw and walk away with the money earned. The earnings are not additive. What is the expected payoff of this game?

I found a solution here but I don't understand it.

REPLY [3 votes]: Start from the end. 
What happens if you do not care about the first two rolls? The expected payoff is $(1+2+3+4+5+6)/6 = 3.5$. Now you have a freedom to go step earlier and make a decision about your strategy after the second roll (you still do not care about the first roll). We can actually find the optimal scenario which maximizes payoff:
$$E[X] = \frac{n}{6}3.5 + \frac{1}{6}[6+5+ \ldots+(n+1)] = \frac{n}{6}3.5 + \frac{1}{6}\cdot\frac{7+n}{2}(6-n)$$
It has a maximum for $n=3$ and then $E[X] = 4.25$. The meaning of the above expression is that if we roll $1,2,\ldots , n$ then we should roll once again. Otherwise we stop.
Ok, we move to the first roll and apply the same idea, but with a new expectation value $4.25$:
$$E[X] = \frac{n}{6}4.25 + \frac{1}{6}\cdot\frac{7+n}{2}(6-n)$$
Maximum is for $n=4$ and we get $E[X] = 4.6666...$.
In the problem the optimal strategy is the following:

If you roll $1,2,3$ or $4$ in the first try, then reroll the dice. Otherwise take what you got, because on average you will not get more than $4.25$.
In the second try. If you roll $1,2$ or $3$ you should roll once again. Otherwise stop, because on average you will not gain more than $3.5$.