VehiclesFashionRecipesBlogsHuntTravelsSportFunHandmadeITEducation
Mini-Games
x

x
zakruti.com » Knowledge, science, education » Numberphile
How to Win a Guessing Game - Numberphile

How to Win a Guessing Game - Numberphile

FBTwitterReddit

video description

Rating: 4.0; Vote: 1
How to Win a Guessing Game CanadianGuillaume: Here's the mathematical proof on the matter, for people with basic probability knowledge and doubting the video:
First let, s eliminate the cases where K=A or K=B.
K is a continuous random variable whose distributions is strictly positive over all real numbers (this was imposed as a condition for this trick to work by our mathematician. For any such probability distributions (with finite parameters, the probability that K is equal to any specific real number is 0. So that probability that K=A or K=B is 0. We do not need to consider it.
We have complete ignorance as to whether A>B or B>A, the labels A and B are themselves interchangeable as well. By symmetry, P(A>B) = P(B>A. Now, let's assign a value to K using ANY continuous probability distribution over all reals. Suppose we turn over A, and find that A > K. Then we seek P(A>B - A > K, or in words, the probability that A > B, given that we know A > K.
There is a proven formula that transforms this expression. P(A>B - A>K) = P(A>B AND A>K)/P(A>K. The numerator of the right hand side is the probability that we obtain the sequences, from smallest to biggest number, (KBA) or (BKA. The denominator is the probability that we obtain the sequences (KBA, (BKA) or (KAB. Here (KBA) means KK) = [P(KBA) + P(BKA)]/P(A>K) = [P(KBA) + P(BKA)]/[P(KBA)+P(BKA)+P(KAB)].
Now note that P(A K) = 1 - P(A>B - A > K) = P(KAB)/[P(KBA)+P(BKA)+P(KAB)] = P(KAB)/P(A>K)
By our original symmetry, we have P(A>B) = P(B>A, in absence of all knowledge about the relation between A and K. This implies that the probability that P(KAB) = P(KBA, since the only difference between those two events here is whether A>B or B>A.
Thus: P(A>B - A>K) = [P(KBA) + P(BKA)]/P(A>K) = [P(KAB) + P(BKA)]/P(A>K)] = P(KAB)/P(A>K)] + P(BKA)/P(A>K) = P(A K) + P(BKA)/P(A>K.
We have P(BKA)/P(A>K) is > 0, since K's distribution is strictly positive over all reals (like the normal distribution is, meaning both the numerator and denominator are positive.
This means that P(A>B - A>K) = P(A K) + -something bigger than 0-. We can call this second term epsilon, with epsilon > 0. Then P(A>B - A>K) = P(A K) + epsilon, which is the definition of P(A>B - A>K) > P(A K.
In conclusion, knowing that A > K, tells us that its more probable that A > B than B > A. Doing the same demonstration again, but given K > A, will give the opposite conclusion.
And how dense our probability distribution in the area between A and B, and how wide apart these 2 are, increases our chance of success. Of course, these are unknown and we only know that the effect is positive but not its magnitude.

Date: 2022-04-08

Comments and reviews: 9


Here's a simulation done 1, 000, 000 times in Python 2. 7. I got that this method yields a success rate of around 2/3 of the time.
import random
def main):
num_simulations = 1000000
lower_range = -10000
higher_range = 10000
correct_guesses = 0
incorrect_guesses = 0
a = random. randint(lower_range, higher_range)
b = random. randint(lower_range, higher_range)
k = random. randint(lower_range, higher_range)
for i in range(num_simulations):
a = random. randint(lower_range, higher_range)
while (b == a):
b = random. randint(lower_range, higher_range)
while (k == a):
k = random. randint(lower_range, higher_range)
guess = --
if a < k:
guess = --
if guess == -- and a > b:
correct_guesses += 1
else:
incorrect_guesses += 1
print -Out of -- simulations with numbers a, b, k in range (--, --, correct guesses number -- and incorrect guesses number --, marking a --% correct rate. -. format(num_simulations, lower_range, higher_range, correct_guesses, incorrect_guesses, float(correct_guesses) / num_simulations - 100)
if __name__ == -__main__-:
main)

reply

Problem revealed. This would have no practical application as it requires picking numbers from an infinite set. Thus the probability of picking any number from this set is 1 out of infinity which has no tangible meaning. Using a finite set of numbers it is easy to see why this works. Say we have a range from 1 to 10 to pick from. We pick an A and B that are not equal to each other. Now by revealing A, we can already take a better guess since the probability of picking B greater than A is 0 if A=10. If A=9, probability that B>A= 1 out of 9. If A= 8, probability of B>A= 2 out of 9 and so on. K is not needed to reveal why we have a better guess. K does not help if A happens to be in the exact middle of the set of numbers since both sides would have equal probability of containing B. Even if we reconsider the case where there are infinite numbers to pick from, one can assume that A can always be right in the middle of the set thus K would not give any advantage to guessing the number correctly either. you would have a 50% chance of K being either bigger or smaller than A. Since you will always guess B>A if K>A and B
reply

Over 1, 100 trials I got exactly 66% wins.
Code was surprisingly simple in bash:
#! /bin/bash
for N in $(seq 1 1000); do
A=$(rand)
sleep 1 # without this A will equal B and so will K
B=$(rand)
sleep 1
K=$(rand)
if [ -$A- -lt -$K- ];
then X=1 # guess B is bigger
else X=0 # guess B is smaller
fi
if [ -$X- -eq '1' -a -$B- -gt -$A- ]; then echo Win # guess bigger, is bigger
elif [ -$X- -eq '1' -a -$B- -lt -$A- ]; then echo Lose # guess bigger, is smaller
elif [ -$X- -eq '0' -a -$B- -gt -$A- ]; then echo Lose # guess smaller, is bigger
elif [ -$X- -eq '0' -a -$B- -lt -$A- ]; then echo Win # guess smaller is smaller
fi
done
exit 0
The pseudo-random numbers default to between 0 and 32, 576 so there was a 1 in 1, 061, 195, 776 chance that A would = B on any run but that didn't occur.

reply

I was greatly fascinated by this and I made a program and run this many times. Here are my results:
Within a known range:
1)If K is mean, probability of correct guess is 3/4
2)If K is a random number in the range, probability of correct guess is 2/3
This works for both integers and real numbers.
I ran a simulation for many ranges with around 1, 000, 000 test cases and calculated the probability. I repeated this process around 100 times. Ranges were also selected at random. Here is my code (I made it in python 2. 7)
import random
wins = 0
test_cases = 1000000
init = -1000+random. random)-2000
final = -1000+random. random)-2000
while final k:
guess = a
else:
guess = b
if a > b:
correct = a
else:
correct = b
if guess == correct:
wins += 1
print wins/test_cases

reply

I dont understand. The numbers I chose were 9billion and 12billion(a pretty big gap. I get that adding an extra requirement where I have to tell you if one of my numbers is bigger or smaller than a random number you give(k) will help increase your odds. Of course since you have more information. But whats so interesting about that? Its just common sense. And say your K is 804, i'd tell you its smaller than my A, that doesn't help you because its smaller than both of my numbers. And with an infinite amount of numbers to choose from i feel that its unlikely that k will be between A and B objectively as long as you dont have one of your numbers in the far negatives and one in the far positives (the example he gave which was way too favorable to the circumstances) Is there something im missing here that makes this somehow interesting?
reply

This is the dumbest video ever released by numberphile. This guy has zero understanding of logic or infinity and doesn't seem to care that he has just -proved- a paradoxical result. Why is he being touted as an expert?
He doesn't even fully define the game or his strategy (what does he do if K=A or K=B) If you want to be able to play this game like he mistakenly thinks is possible, you need to specify the range of options for A and B.
What is he talking estimating a probability to win the game? Simulating the game? Simulating what? You haven't specified the game or how your opponent will behave.
Why does he not seem to care that he is concluding that you can have a -significant- advantage in a -game- where your opponent gets to pick how little your advantage is? Oh but he's willing to wager on it so it must be true.

reply

For people who are getting 2/3 as the answer, you are most likely assuming that A, B, and K come from the same distribution. When they come from the same distribution, all 6 permutations of ABK are equally likely and 4 of those result in a win. But in these cases, you are really using knowledge of the distribution to increase your chances - I see this as a Monte Carlo method where the distribution is being approximated by sampling 1 point. A better method would be to generate many random numbers K1 to Km, and switch if the majority of those are above the first value. Without distribution assumptions, I don't think you can get an advantage (due to the no free lunch principle. The argument breaks down because it is not possible to choose a random element from an infinite set where all numbers have a chance of getting picked.
reply

If you consider all the finite real numbers as being possible, then the gap between A and B will be infinitesimally small, because there is always a significantly higher number than the larger of the 2 and a significantly lower number than the lower of the 2. For example, if you just were to take the numbers between X and Y where X is the absolute value of 10-42 times the difference between A and B added to the highest number and Y is the absolute value of 10-42 times the difference of A and B removed from the lower number, then the chance of taking K between A and B is 1/(2-10-42. Now replace 10-42 with the highest number you can think of (limit -> inf) and the chance of getting K between A and B gets infinitely small (chance A
reply

The idea of the video not very smart - I got the answer and a better version now.
The solution is simple.
The whole trick hasn't to do anything with picking a random number. Here it is:
Let's take a number range between 1 and 100 and assume A and B is totally randomly chosen.
If A=1, what's the probability that B is bigger than A? About 99%.
If A=99, what's the probability that B is bigger than A? About 1%.
You just have to see if A is bigger or smaller than 50 and then make the referring guess (if A is bigger than 50 guess that B is smaller than A and the other way round.
Doing it with the k-number-thing indeed is also working but not as efficient.

reply
Add a review, comment






Other channel videos