[Math] Finding optimal thresholds for “guess if number is highest” game

game theoryprobability

Consider the following game: five numbers are chosen randomly in the interval [0..1] with uniform distribution. The player is shown each number in turn and asked if it is the highest. The game proceeds until the player either answers incorrectly (false positive and false negative are both losing outcomes) or correctly guesses that the present number is the highest (correctly answering that the current number is the highest is an instant win, since the player could presumably answer correctly that one of the others is).

If the player's goal is to maximize the probability of answering correctly whether each given number is the highest, the player should answer "yes" when shown a number which is larger than any seen thus far, and which is larger than the 1-1/2^(1/n), where n is the number of unseen numbers remaining (e.g. if the third number is sqrt(2), and the first two numbers were smaller than that, there's a 50% probability that both of the remaining numbers are less than that, so either "yes" and "no" would have a 50% probability of being correct; if the value is higher, then "yes" will more likely be correct; if it's lower, then "no" will be most likely.

If the player's goal is to maximize the probability of winning, however, the calculations would seem to get more complicated. When asked whether the fourth number is highest, the player should answer "Yes" if it's greater than 50%, and greater than all numbers seen thus far. If the player answers correctly, the player wins (a player who correctly states that the fourth number is not the biggest will have no trouble answering that the fifth is). When answering whether the "third" number is the biggest, however, the reward for correctly identifying that it is the biggest (i.e. an instant win) is larger than the reward for identifying that it is not (since the player will still risk a loss on the next number).

Is there any nice way to determine the threshold for each number where the player should announce that it's the biggest (assuming it's larger than any values seen thus far)? Attempting to partition a 3-dimensional space to decide what to do on the third guess seems awkward but not impossible, but going beyond that to figuring out the optimal strategy on the second guess would seem unworkable absent some simplification I'm not seeing.

Best Answer

I get the same threshold numbers as Robert Israel but, I think, by a different way of thinking about things.

Generalize the problem from $5$ numbers at the beginning to $n+1$ and ask what's the threshold value, $\tau_n$, above which you should accept the first card, below which you should pass on it, and at which you are indifferent -- i.e., at which you figure the probability it's the highest value is equal to the probability that you'll actually pick the highest value when it's offered. (Note, I'm using $\tau$ for the threshold value, to distinguish it from Robert Israel's $t$'s, which use a countdown index starting from $5$.)

The key idea is that if your best course is to accept any number greater than the threshold value, that means if you pass on the threshold value (and survive), then you'll accept the next higher value as soon as it appears.

Now if the first number is $x$, the probability that it is larger than the remaining $n$ values is $x^n$. On the other hand, the probability that the largest number is among the next $n$ numbers but appears before any other number larger than $x$ is

$${n\choose 1}x^{n-1}(1-x)+{1\over2}{n\choose2}x^{n-2}(1-x)^2+{1\over3}{n\choose3}x^{n-3}(1-x)^3+\cdots+{1\over n}{n\choose n}(1-x)^n$$

To see why, consider a generic term, ${1\over k}{n\choose k}x^{n-k}(1-x)^k$. This corresponds to the possibility that of the next $n$ numbers, $k$ are greater than $x$ and $n-k$ are less than $x$. There are $n\choose k$ ways to arrange such numbers, and among these arrangements, the largest of the $k$ "large" numbers occurs first with probability $1/k$.

It stands to reason that the displayed expression is a decreasing function of $x$, whereas $x^n$ is clearly increasing on $[0,1]$. Consequently, $\tau_n$ is the unique root in $[0,1]$ of the equation

$$x^n=nx^{n-1}(1-x)+{1\over2}{n\choose2}x^{n-2}(1-x)^2+{1\over3}{n\choose3}x^{n-3}(1-x)^3+\cdots+{1\over n}{n\choose n}(1-x)^n$$

Plugging in the first few values $n=1,2,3,4,5$, we get equations that are convenient to write as follows:

$$\begin{align} 2x&=1\\ 5x^2&=2x+1\\ 17x^3&=6x^2+3x+2\\ 74x^4&=24x^3+12x^2+8x+6\\ 394x^5&=120x^4+60x^3+40x^2+30x+24\\ \end{align}$$

Note, the fourth of these agrees with Robert Israel's $37z^4-12z^3-6z^2-4z-3$. The roots of the cubic and quadratic also agree with what he calls $t_2$ and $t_3$. I've written things here to suggest the general pattern

$${a(n)\over n!}x^n=x^{n-1}+{1\over2}x^{n-2}+\cdots+{1\over n-1}x+{1\over n}$$

The sequence of $a(n)$'s, $2,5,17,74,394,\ldots$, appears to be A000774 in the OEIS. I would imagine there is some fairly simple inductive proof of this general pattern. If I come up with one, I'll edit it in, but I'd be happy if someone would do the work for me.

Related Question