31
$\begingroup$

Today my professor asked me to figure out the probability of getting a rational number from $[0,1]$. His answer was that the probability is $0$. Why is this?

$\endgroup$
  • 1
    $\begingroup$ The technical answer is yes, there are many more reals than rationals. The measure of the set [0,1] is 1, but the measure of the rationals in [0,1] is 0. $\endgroup$ – TravisJ Mar 3 '15 at 14:05
  • 5
    $\begingroup$ May I ask what kind of class this is? There are various senses in which the rational numbers are few in relation to the real numbers although there are infinitely many of them. $\endgroup$ – hardmath Mar 3 '15 at 14:08
  • $\begingroup$ Well, this lesson is called "Introduction to Computers".The professor is introducing the concepts of "information" to us in a mathematical way. $\endgroup$ – Ivy Mar 3 '15 at 14:31
  • 6
    $\begingroup$ Actually, there are exactly three more real numbers than rationals. </silly> $\endgroup$ – Ryan Reich Mar 4 '15 at 4:13
  • 1
    $\begingroup$ This question has gotten way more attention than it deserves check out math.stackexchange.com/a/1172936/66223 (not my answer) look at the detail - 4 votes. Seriously. $\endgroup$ – Alec Teal Mar 5 '15 at 6:22
2
$\begingroup$

The probability measure in your problem is just a special type of measure. Any concrete single number has probability zero because as a set, it is a set of zero measure. Measure of all rationals in $[0,1]$ is also $0$ (see this question for explanation), and so the probability of getting rational number is $0$.

$\endgroup$
57
$\begingroup$

Intuitively, think that the rational numbers have a periodic decimal representation. If you draw a number digit by digit, what are your chances to make a periodic drawing compared to a completely random one ?

$\endgroup$
  • 3
    $\begingroup$ Really good, expressive explanation. Chapeau! $\endgroup$ – GDumphart Mar 3 '15 at 14:17
  • 2
    $\begingroup$ youtu.be/Swm8tTLWirU $\endgroup$ – Foo Bar Mar 3 '15 at 18:10
  • 7
    $\begingroup$ I take issue with this intuition because what are the chances, really? Any given pattern has a 0% chance to be made, but at any given time there are an infinite number of possible rational patterns you could generate. 0 times infinity = ??? $\endgroup$ – QuestionC Mar 3 '15 at 22:37
  • 3
    $\begingroup$ @YvesDaoust That's not an argument, it's a vague intuition. What your critics are saying is that they disagree that that intuition is convincing. $\endgroup$ – Jack M Mar 4 '15 at 10:56
  • 4
    $\begingroup$ As JackM is saying, it is a vague intuition on the level of "There are more reals than rationals, that's why." As kasperd points out, for any non periodic finite sequence, there is an infinite periodic sequence with a period of the finite sequence. So for me, when I think of drawing a number digit by digit, it does not seem entirely intuitive that I am more likely to get non-periodic number as I will never know (because I would have to draw all of its digits which will never happen as I am drawing an infinite sequence.) $\endgroup$ – BoZenKhaa Mar 4 '15 at 12:58
14
$\begingroup$

All of the answers here presume that your [0, 1] denotes a subset of the Real Numbers, but you said,

Well, this lesson is called "Introduction to Computers"

Computers do not use Real Numbers. If [0, 1] denotes the set of numbers that could be returned by a random number generator (procedure) in a computer program, then the probability of getting a rational result from it is 1.

Every floating-point number is rational.

$\endgroup$
  • 6
    $\begingroup$ Not every number produced by a computer is floating point, or an integer. It's easy to precisely represent some irrational numbers – e.g. numbers of the form $a + b\sqrt 2$ for rational $a$ and $b$. $\endgroup$ – Ben Millwood Mar 4 '15 at 23:17
  • 1
    $\begingroup$ @JimLarge Same goes for integers and rational numbers. A ge eral-purpose data type that could exactly represent any integer or rational would be impossible. $\endgroup$ – heinrich5991 Mar 5 '15 at 3:56
  • 1
    $\begingroup$ @heinrich5991, true enough, but that doesn't contradict what I'm claiming, which is that a "general purpose" real data type can only represent rational values. Ben Millwood's example does have irrational values, but I'm arguing that it's not "general purpose" because its irrational values all are solutions to one narrowly defined family of equations. $\endgroup$ – Solomon Slow Mar 5 '15 at 4:44
  • 1
    $\begingroup$ Logarithmic representations might reasonably include a large number of irrationals in their set of representable numbers. They're not very popular, but they're not entirely dead. $\endgroup$ – user2357112 Mar 5 '15 at 9:59
  • 1
    $\begingroup$ @JimLarge: there are several rather more "general-purpose" options. The algebraic numbers are a well-known subfield of the reals that can be, and has been, implemented. If you want more still, there are the computable or *provably computable reals; google "exact real arithmetic" for more on the options. These aren't widely used for now, since they're very inefficient compared to the floating point options, but they certainly exist and are actively studied. $\endgroup$ – Peter LeFanu Lumsdaine Mar 5 '15 at 14:04
14
$\begingroup$

At risk of over-complicating things, if you dig a little deeper you'll find that your professor defines "uniform distribution" to mean that for any subset $S$ of $[0,1]$, the so-called "probability of drawing a number in $S$" is the Lebesgue measure of the set $S$.

If you don't know the real definition, you can think of the Lebesgue measure of $S$ as being the area under the graph of the characteristic function of $S$, that is to say the function that takes value $1$ for elements in $S$ and $0$ elsewhere. It might be that your professor would state his definition in terms of lengths or integrals rather than Lebesgue measure as such, but it will amount to the same thing.

Now, it turns out that that rational numbers are countable, and that the Lebesgue measure of any countable set in the real numbers is $0$. Hence, the probability is $0$ directly from the way he defined his distribution in the first place.

You need a certain amount of mechanism to define Lebesgue measure formally and show that the measure of any countable set is $0$, but the general idea is as follows. Consider a countable sequence of points $a_i$. For any given small number $\epsilon > 0$, we can put an interval of size $\frac{\epsilon}{2}$ around the first point $a_1$, an interval of size $\frac{\epsilon}{4}$ around $a_2$, and in general size $\frac{\epsilon}{2^i}$ around $a_i$. The intervals overlap, but the sum of the lengths of all of them is $\epsilon$, so the measure of their union is no greater than $\epsilon$, which recall can be as small as we like. This means the set $\{a_i: i \in \mathbb{N}\}$ can be contained in as "short" a set of intervals as we like, which (once we make a suitable set of formal definitions) means it has measure $0$ and intuitively it means the set of rationals "has no length" in the reals, and occurs with probability $0$. The complement of the rationals, the set of irrational numbers, cannot be covered in arbitrarily small intervals this way, and doesn't have measure $0$ (in fact it has measure $1$, which is good news for people who want their probabilities to add up!)

There are plenty of probability distributions on $[0,1]$ that aren't continuous, and for which your professor's statement isn't true. I presume he means the continuous uniform distribution because that's always the distribution people mean when they don't bother to state it, but the property does hold for any continuous distribution, so he's not out of order to leave off the details.

$\endgroup$
5
$\begingroup$

There are only countably many rational numbers in $[0,1]$, while the set of irrational numbers in $[0,1]$ is uncountable.

$\endgroup$
4
$\begingroup$

The probability that we choose a rational number should clearly equal the probability of choosing an $x$ such that $x+\sqrt{2}$ is rational - shifting the rationals by a constant certainly shouldn't affect probability. So, if the probability of picking a rational is $p$, then the probability of picking an $x$ such that either $x$ or $x+\sqrt{2}$ is rational must be $2p$, as those two events are disjoint. This means $2p\leq 1$, as every probability is less than $1$. So $p\leq \frac{1}2$.

However, this gives us trouble: the probability that $x+n\sqrt{2}$ is rational (for integer $n$) is also $p$. So, the probability that one of the following: $$x,x+\sqrt{2},x+2\sqrt{n},\ldots,x+(n-1)\sqrt{2}$$ is rational must be $np$, as no two of those can be rational simultaneously (but, individually, would each be rational with probability $p$). So, we get that $np\leq 1$ any any $n$. Thus $p\leq \frac{1}n$ for all $n$ - which implies that $p$ must be $0$, as this is not true of any positive number.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.