Clear questions and runnable code
get the best and fastest answer
There is no trick.
That is not a restriction. That is a property of the two numbers both being real. Real numbers are always finite. Given 2 finite numbers, there is an interval between them. A continuous distribution with non-zero probability density everywhere has a positive probability of falling into that interval.
However you're partially right. I did not state that the numbers had to be real. I don't think that there is any confusion on that point though.
Given any two numbers and the algorithm, there is a well-defined probability that you're right, and that probability is over 0.5.
No. I did not.
In this case "any number" means "any real number". I have not put any bounds on how large those numbers may be. But whatever they are, any real number will be finite. That's part of being a real number.
This is why you have to be very careful in the wording to even get a well-defined problem.... Prior to the numbers and algorithm, the probability of your being right is undefined and undefinable.
Let's be careful here.
If I ask what the probability is of your being right without knowing the numbers and algorithm, I can't get an answer. The exact answer is undefined because it depends on the numbers and algorithm.
If I ask what the probability is of your being right while knowing the numbers and algorithm, I can get an answer. That problem is always well-defined.
But not knowing the answer is not the same as being unable to prove anything about it. Even though I don't at the moment have the numbers, given the algorithm, I still can prove something about what the probability must be. In this case I can prove that the answer must be greater than 50%. (I can also prove that the answer must be less than 100%.)
This is like being able to prove that (x+y)+z is x+(y+z). Even though I don't know what x, y, z, or their sum is, I can still prove that the sum adds up the same both ways. (Incidentally, that particular proof takes a surprising amount of work.)
I'll say it again: The problem you originally presented and the problem you ultimately analyzed are not the same. The original problem's numbers were free of restrictions, but the analyzed problem's numbers were not. Two different problems.They were the same problem. Even though the set of real numbers is unbounded, every real number is finite, and every pair of distinct real numbers has a finite interval between them. A continuous probability distribution with non-zero density everywhere must have a positive probability of landing on that interval.
To object that I'm wrong because I'm limiting my numbers to be finite is like objecting that the rules of algebra are wrong because they only work for finite numbers. Real numbers are finite. It is only the set of real numbers that is infinite.