Perl: the Markov chain saw  
PerlMonks 
Comment on 
( #3333=superdoc: print w/ replies, xml )  Need Help?? 
You'd think that your odds of doing that are 50%. It turns out that they don't have to be. This violates common sense, which is what makes the problem interesting.Suppose I have two envelopes. All you know is that they contain different numbers. I randomly hand you one of them. You open it, look at it, then hand it back. You now have sufficient information to, with guaranteed better than even odds, correctly tell me whether I gave you the envelope with the larger number. How?No, that question actually is: Mathematicians are very interested in understanding situations where their intuitions differ from what happens. By examining those "pathological cases" you sharpen your intuition for how things work. Note that in these weird boundary cases it is important to be very precise in your thinking. Any sloppiness will cause you to misanalyze the problem to fit your preconceptions, not reality. And that is what sloppiness looks like.If you sit down and do the algebra, you will find that your probability of being right turns out to be exactly 50% plus 1/2 the probability that you pick a number between my two.Hmm. If I choose to guess myNumber + epsilon(where epsilon is small enough) I have 50% chance of being between your two numbers and hence have 75% chance of being correct, which is silly:) The algebra only works if your method of choosing the other number is independent of the number that you get. As soon as you introduce a dependency you have to analyze that dependency, and it changes the answer. Since you don't seem inclined to try the algebra, allow me to demonstrate what it looks like. Suppose that the numbers that I have are x and y with x < y. Suppose that p(z) is the function that tells you for any number how likely you are to think that you got the larger one if you're handed that number. Then: So far we haven't introduced any details about the method. With the method that I described, though, p is a monotonically increasing function, in fact p(y)  p(x) is the probability that you pick a number between x and y, so you're better than even odds by half the probability that your number is between my two. With the choosing method that you came up with, you always conclude that you're handed the smaller number. Therefore p(x) and p(y) are both 0.5 and your odds of being right remain at 50%. Slight difference! If your eyes are glazing over at the algebra, then please examine the following (bad) ASCII art version of the picture that I described in my root node. As you can see, no matter what number you independently come up with, you never have worse than even odds of being right, and you have some chance of guaranteeing that you're right. That chance gives you better than even odds overall. In reply to Re^2: Spooky math problem
by tilly

