P is for Practical PerlMonks

### comment on

 Need Help??
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:
If I give you a number from a set of two diffrent numbers tell me if you got the small or large number?

My odds of doing that is exactly 50%.
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.

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.

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:-)
And that is what sloppiness looks like.

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:

```P(You're right)
= P(You're handed x)*P(You don't think that x is larger)
+ P(You're handed y)*P(You think that y is larger)
= 0.5 * (1 - p(x)) + 0.5 * p(y)
= 0.5 + 0.5*(p(y) - p(x))
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.

```     (Right if handed the larger) |
<----------------------------|
(even odds)     (guaranteed)   | (even odds)
<-------------x------------------y--------------->
|
|------------------------------->
| (Right if handed the smaller)
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
in thread Spooky math problem by tilly

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Are you posting in the right place? Check out Where do I post X? to know for sure.
• Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
• Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
• Want more info? How to link or or How to display code and escape characters are good places to start.

Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2021-12-05 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
R or B?

Results (31 votes). Check out past polls.

Notices?