I encountered a problem similar to the two envelope paradox: Two envelopes with amounts $x$ and $2x$, where $x$ is uniformly distributed in $[0,100]$. Randomly shuffle the two envelopes, and you pick one and observe the amount. You can choose to switch or stay. What is the optimal strategy to get the envelope with the larger amount?
An intuitive strategy is to switch if the envelope has less than 100. But I am not sure how to show this strategy in fact maximizes the probability of getting the envelope with the larger amount. Here is what I tried:
\begin{align*} P(\text{getting large envelop}) &= P(\text{getting large envelop } | \text{ observed <100})P(\text{ observed <100})\\ &+ P(\text{getting large envelop } | \text{ observed >100})P(\text{ observed >100})\\ &= P(\text{getting large envelop} | \text{ observed <100}) \cdot \frac{3}{4} + 1 \cdot \frac{1}{4} \\ \end{align*}
but how can I show that the strategy maximizes $P(\text{getting large envelop} | \text{ observed <100})$?
Thanks.
I'll rephrase your problem to emphasize the different elements:
I will also use $R$ for the result of the game, with the value $1$ when the larger value was chosen and $0$ when the smaller one is selected. We are looking for a way to maximize the probability that the strategy $f$ helps us choose the larger amount, conditioned by the strategy $f$: $P(R = 1 | f)$. Consider a random value $x$ and the possible outcomes:
Thus, the total probability $P(R = 1|f)$ for a strategy $f$ can be written as
$$ P(R=1|f) = \int_0^1 P(R=1|X=x,f)dx \\ = \int_0^1 \frac12 \left( P(R=1|X=x,O=0,f)+P(R=1|X=x,O=1,f) \right) dx \\ = \int_0^1 \frac12 (1 - f(x) + f(2x)) dx = \frac12 - \frac12 \int_0^1 f(x) dx + \frac14 \int_0^2 f(x) dx \\ = \frac12 - \frac14 \int_0^1 f(x) dx + \frac14 \int_1^2 f(x) dx $$
So from here we can see that the strategy $f$ which maximizes the outcome is indeed the one you suggested, switch when $x < 1$ and keep when $x > 1$. Seen as a probability value, the outcome of this case is $3/4$.