Suppose you play a game with your friend.
Variant 1
Your friend chooses two numbers, $a_1, a_2 \sim U[0,1]$ uniformly between $0,1$. He then reveals $a_1$ to you. You need to guess whether $a_2 < a_1 $ or $a_1 > a_2$. If you guess correctly, you win.
Variant 2
There are now 3, $a_1, a_2, a_3 \sim U[0, 1]$. Your friend shows you a random point and you have to tell if it's the smallest one, highest or the one in the middle. Then your friend shows a second point and you have to guess again. Finally he shows you the last point (you have only one option left). If you guess correctly (all three points) you win.
What is the optimal strategy that gives you the highest probability of winning these games.
My solution : Variant 1
Let us consider the first variant. You could guess randomly and win with probability $1/2$. We now as the question can we do better.
One strategy could be that once $a_1$ is revealed to us, if $a_1 > x$ (some cut-off) we guess that $a_1$ is larger, else we guess $a_2$ is larger.
$$P(win) = P(a_1 > a_2| a_1 \geq x) \cdot P(a_1 \geq x) + P(a_2 > a_1| a_1 < x) \cdot P(a_1 < x) $$
Now we can plug-in
$$P(a_1 \geq x) = \int_{x}^{1}dk_1 = 1-x $$ $$P(a_2 < x) = x $$ $$ P(a_1 > a_2| a_1 \geq x) = \frac{P(a_1 > a_2 \cap a_1 \geq x)}{P(a_1 \geq x)} = \frac{\int_{x}^{1}dk_1 \int_{0}^{k_1}dk_2}{1-x} = \frac{-x^2/2 + 1/2 }{1-x}$$
$$ P(a_2 > a_1 | a_1 < x) = \frac{P(a_2 > a_1 \cap a_1 < x)}{P(a_1 < x)} = \frac{\int_{0}^{x}dk_1 \int_{k_1}^{1}dk_2}{x} = \frac{x - x^2/2 }{x}$$
Now, going back to
$$P(win) = P(a_1 > a_2| a_1 \geq x) \cdot P(a_1 \geq x) + P(a_2 > a_1| a_1 < x) \cdot P(a_1 < x) = \frac{1+2x-2x^2}{2} $$
and then solving for, $\frac{\mathrm{d}P(win)}{\mathrm{d}x} = 0$ We get, $x= 1/2$ and $P(win) = 3/4$.
Question : The above approach seems fine to me, however, I am unsure how to extend it to variant 2.
We can actually get the answers a bit more easily by cheating a little bit, by exploiting symmetries and other nice properties of the various situations. (As a side note, we are here assuming that your friend's role is solely to reveal the numbers in order and tell you if you're right or not. You can do different analyses in the case where, for example, your friend can choose the order to reveal the values and has their own strategy to minimise your chance of winning.)
Also, the nature of this game means that we never have to consider taking a probabilistic strategy ourselves. This is because at each point there is always a single strategy that has a maximum chance of victory based on the known information, and any divergence from that can only reduce our win rate (for example, in variant 1, if we try to hedge our bets by guessing $a_2 < a_1$ with some probability $p$ then you'll quickly find that for any single value of $a_1$ that either $p = 0$ or $p = 1$ is always going to be the best choice).
Variant 1
By the time we're guessing, $a_1$ is a fixed quantity, and so $P(a_2 < a_1) = a_1$ and $P(a_2 > a_1) = 1 - a_1$. For any given $a_1$, then, the probability of winning by guessing $a_2$ will be smaller is $a_1$ and the probability of winning by guessing it will be larger is $1 - a_1$, so when $a_1 > 1 - a_1$ we have a better chance of winning by guessing that $a_2 < a_1$, which is equivalent to $a_1 > \frac{1}{2}$. Similarly, if $a_1 < \frac{1}{2}$ we maximise our win rate by guessing that $a_2 > a_1$.
This all lines up with your calculations, which also confirm that in general this will give us a 3 in 4 win rate.
Variant 2
For this one, we're going to work backwards. Obviously once all three values are known there's no guesswork left, so the only real decisions happen once we see $a_1$ and then when we see $a_2$.
Guessing the position of $a_2$
When $a_2$ is revealed, we can assume that we've already correctly guessed $a_1$'s position - if we hadn't, we couldn't win anyway, so it has no value. Additionally, if $a_1$ is the middle value then we have a guaranteed strategy to win - if $a_2 < a_1$ then it must be the smallest value, otherwise it must be the largest. So we only need to consider what happens if $a_1$ is either the smallest or largest, and since these situations are symmetrical we can just look at what happens when $a_1$ is smallest and the other case will be a reflection.
So let's suppose we know that $a_1$ is the smallest value, and we know the value of $a_2$ (which must, of course, be larger than $a_1$). Then guessing whether $a_2$ is the middle or largest value is equivalent to guessing whether $a_3 \lessgtr a_2$. And, in fact, it looks very similar to what happens with Variant 1:
Given the values of $a_1$ and $a_2$, then the probability that $a_3 < a_2$ is $\frac{a_2 - a_1}{1 - a_1}$, and the probability that $a_3 > a_2$ is $\frac{1 - a_2}{1 - a_1}$, because the distribution of $a_3$, conditional on $a_3 > a_1$, is $U(a_1, 1)$.
So the probability of winning by guessing $a_3 < a_2$ is $\frac{a_2 - a_1}{1 - a_1}$ and the probability of winning by guessing $a_3 > a_2$ is $\frac{1 - a_2}{1 - a_1}$, and the point where the two probabilities are equal is when $a_2 = \frac{1 - a_1}{2}$.
Just like in variant 1, the probability that we get this guess correct using this strategy is $\frac{3}{4}$.
When $a_1$ is the largest value, everything is reflected by the transformation $x \rightarrow 1 - x$, but the strategies are similar and the win chance is the same.
To recap:
If we guessed $a_1$'s position wrong, we lose no matter what.
If we correctly guessed that $a_1$ was the middle value, then if $a_2 < a_1$ we guess it's the smallest and win, otherwise if $a_2 > a_1$ we guess it's the largest and win.
If we correctly guessed that $a_1$ was the smallest value, then if $a_2 < \frac{1 - a_1}{2}$ we guess that it's the middle value, otherwise we guess that it's the largest value, giving us a $\frac{3}{4}$ probability of winning (at this point).
If we correctly guessed that $a_1$ was the largest value, then if $a_2 < \frac{a_1}{2}$ we guess that it's the smallest value, otherwise we guess that it's the largest value, also with a $\frac{3}{4}$ probability of winning.
Guessing the position of $a_1$
So now we go back to the very start of the game, when $a_1$ is revealed and we need to guess whether it's the smallest, middle or largest value of the three.
Importantly - if we get this wrong we automatically lose, therefore our only concern at this point is maximising our probability of being right.
Just like in previous analyses, it's pretty clear that you should choose whichever option is the most likely - in other words, if we set $p_s$, $p_m$, $p_l$ as the probabilities that $a_1$ is the smallest, middle or largest value respectively (knowing only the value of $a_1$) then our probability of winning on a particular guess is the probability the corresponding scenario occurring, and so we should pick the scenario with the largest value of $p$.
So, what are the respective probabilities?
$p_s$ is the probability that $a_1$ is less than both $a_2$ and $a_3$, given the value of $a_1$. In other words, $p_s = P(a_1 < a_2 \land a_1 < a_3 | a_1) = P(a_2 > a_1 | a_1) P(a_3 > a_1 | a_1) = (1 - a_1)^2$.
Similarly, $p_l$ is the probability that $a_1$ is larger than the other two, so $p_l = P(a_2 < a_1 | a_1) P(a_3 < a_1 | a_1) = a_1^2$.
Finally, since these three cases are exhaustive and mutually exclusive, $p_s + p_m + p_l = 1$ and so $p_m = 1 - a_1^2 - (1 - a_1)^2 = 2 a_1 - 2 a_1^2 = 2 a_1 (1 - a_1)$ (which also makes sense because it's the sum of the probabilities of $a_2 < a_1 < a_3$ and $a_3 < a_1 < a_2$, the two ways that $a_1$ can be the middle value).
You can apply whatever method you like to compare the three probabilities, and you'll find that:
$p_s$ is largest when $a_1 < \frac{1}{3}$
$p_m$ is largest when $\frac{1}{3} < a_1 < \frac{2}{3}$
$p_l$ is largest when $a_1 > \frac{2}{3}$
So that determines our strategy.
Calculating win rates
Recall that:
If we correctly guess $a_1$ as being the middle value, then we have a 100% winning strategy.
If we correctly guess $a_1$ as being either the smallest or largest value, then we have a 75% winning strategy.
So let's combine that with the strategy we came up with for guessing the position of $a_1$ to find our overall win rate.
$$\begin{eqnarray} P(\textrm{win}) & = & P(\textrm{win} | a_1 \textrm{ is smallest}) P(a_1 \textrm{ is smallest} + \\ & & P(\textrm{win} | a_1 \textrm{ is middle}) P(a_1 \textrm{ is middle}) + \\ & & P(\textrm{win} | a_1 \textrm{ is largest}) P(a_1 \textrm{ is largest}) \\ & = & \frac{3}{4} P(\textrm{guess } a_1 \textrm{ is smallest} | a_1 \textrm{ is smallest}) P(a_1 \textrm{ is smallest}) + \\ & & P(\textrm{guess } a_1 \textrm{ is middle} | a_1 \textrm{ is middle}) P(a_1 \textrm{ is middle}) + \\ & & \frac{3}{4} P(\textrm{guess } a_1 \textrm{ is largest} | a_1 \textrm{ is largest}) P(a_1 \textrm{ is largest})\end{eqnarray}$$
Now for each of these terms we can shuffle them around via the conditional probabilities, so we have $P(\textrm{guess } a_1 \textrm{ is blah} | a_1 \textrm{ is blah}) P(a_1 \textrm{ is blah}) = P(\textrm{guess } a_1 \textrm{ is blah} \land a_1 \textrm{ is blah})$, but also our guess on $a_1$ is decided entirely by where it sits in relation to $\frac{1}{3}$ and $\frac{2}{3}$, so we get:
$$\begin{eqnarray} P(a_1 \textrm{ is smallest} \land \textrm{guess } a_1 \textrm{ is smallest}) & = & \int_0^1 P(a_1 \textrm{ is smallest} \land \textrm{guess } a_1 \textrm{ is smallest} | a_1 = x) dx \\ & = & \int_0^\frac{1}{3} P(a_1 < a_2 \land a_1 < a_3 | a_1 = x) dx \\ & = & \int_0^\frac{1}{3} (1 - x)^2 dx \\ & = & \left.-\frac{1}{3}(1 - x)^3 \right\vert_0^\frac{1}{3} \\ & = & \frac{19}{81} \\ P(a_1 \textrm{ is largest} \land \textrm{guess } a_1 \textrm{ is largest}) & = & \frac{19}{81} \\ P(a_1 \textrm{ is middle} \land \textrm{guess } a_1 \textrm{ is middle}) & = & 2 P(a_2 < a_1 < a_3 \land \frac{1}{3} < a_1 < \frac{2}{3}) \\ & = & 2 \int_\frac{1}{3}^\frac{2}{3} P(a_2 < a_1 \land a_1 < a_3 | a_1 = x) dx \\ & = & 2 \int_\frac{1}{3}^\frac{2}{3} x(1-x) dx \\ & = & \frac{13}{81} \end{eqnarray}$$
(Hopefully you can see where I've applied some symmetry arguments to skip a few steps.)
So putting that back into the previous formula we get:
$$\begin{eqnarray}P(\textrm{win}) & = & \frac{3}{4} \times \frac{19}{81} + \frac{13}{81} + \frac{3}{4} \times \frac{19}{81} \\ & = & \frac{83}{162} \approx 0.512 \end{eqnarray}$$
So with our given strategy, we have a slightly better than 50% chance of winning. And just to reiterate, that strategy is:
If $a_1 < \frac{1}{3}$, guess that it's the smallest value. Then if you're right, if $a_2 < \frac{1 - a_1}{2}$ guess that it's the middle value, otherwise guess it's the largest.
If $a_1 > \frac{2}{3}$, guess that it's the largest value. Then if you're right, if $a_2 < \frac{a_1}{2}$, guess that it's the smallest value, otherwise guess it's the middle.
If $\frac{1}{3} \leq a_1 \leq \frac{2}{3}$, guess that it's the middle value. Then if $a_2 < a_1$ guess that it's the smallest value, otherwise guess it's the largest.
As long as you guess $a_1$ and $a_2$ correctly, guess $a_3$ is whatever's left.