Reply to comment
The idea is this. To start with, you will choose an envelope at random, say by tossing a coin, and look at its contents, which is a cheque for some number - say n. (By randomising like this, you can be sure I haven't subconsciously induced you to prefer one envelope or the other.) You want to make sure that the bigger the number is, the more likely you are to keep it, in other words, the less likely you are to swap.
The key idea is to make another random choice at this point, but one which depends on n, so that the bigger the number you see, the less likely you are to swap. For example, you could toss a coin n times, and swap only if it comes up heads every time. The bigger the cheque, the more times you toss the coin and the more likely it is that it will come up tails at least once - in which case you keep the cheque rather than swapping.
In mathematical terms, this is equivalent to swapping with probability 1/2n. Let's call this function f(n). There's actually nothing very special about f(n) - lots of other functions would do. (In the case where n is always a positive integer, for example, an even simpler idea is to swap with probability 1/n.) The two important features of f(n) that we are relying on are:
As n gets bigger, f(n) gets smaller. That is, if n>m then we know f(m)>f(n).
For allowed values of n (remember, we were assuming n was a positive integer), f(n) always took values between zero and one. This was important as it had to be a valid probability. In fact, for this f, this would be true even if n could be any non-negative real number.
Let's check that this strategy will indeed get the higher number more than half the time. Say the numbers I have written in the envelopes are n and m, and n is the bigger, that is, n>m. What is your probability of ending up with n, the larger amount? Well, half the time the envelope you first examine will contain m; in this case, you succeed by swapping, which happens with probability f(m). The other half of the time you look at the amount n, which you will keep with probability 1-f(n). Your overall probability of success is:
1/2 (f(m) + 1 - f(n)) = 1/2 + 1/2 (f(m) - f(n))
Since n>m, f(m) - f(n) is positive and this probability is greater than a half. You are all set to take the trickster for a ride - unless he has a couple of extra envelopes up his sleeve.
The real thing
I claimed before that there is a strategy that works even if the "cheques" are for arbitrary real numbers. We've already found a function that will do if the numbers are known to be non-negative. What if negative cheques are also allowed? There is still no problem; all we need is a function f(n) that is defined on all real numbers, but still has both the properties (1) and (2) above. In other words we want a function that looks like this:
In fact there are plenty of such functions. You might like to try to come up with a few. Can you modify the function f above to make it work in this new case? (You might need a definition that depends on whether n is positive or negative.) If you have done a bit of trigonometry, you might notice that arctan(x) is also suspiciously similar in shape to what we want. Try modifying it to make another suitable probability function.
About the author
Mark Wainwright is an assistant editor of Plus.