Here is another way to explain the exact same solution.
In full generality, what we need to find is a function
![p:\mathbb{R}\to[0,1] p:\mathbb{R}\to[0,1]](http://www.mathhelpforum.com/math-help/latex2/img/42a6d644ed2c8b4a85c49989117e5aef-1.gif)
that will describe our way to answer: if we are given the number

, then we answer "It is Y (the larger one)" with probability

and "It is X (the smaller one)" with probability

. Note that this covers in particular the case of a deterministic answer (

), even if this is not a good choice.
Suppose we are given the number

, and that our answer (based on the above strategy) is

, which is either 1 if we say that

is Y, or 0 is we say it is X. Then the probability that our guess was correct is:

.
As we can see, this is larger than

if and only if

. However, we don't know what

and

are when we choose the function

. Therefore we have to choose a function such that

for
all real numbers

. In other words,

must be strictly increasing from

to
![[0,1] [0,1]](http://www.mathhelpforum.com/math-help/latex2/img/ccfcd347d0bf65dc77afe01a3306a96b-1.gif)
. A possible choice of the function

was given by TheOdds in his last post.