13
$\begingroup$

I read an essay about prime numbers. In it the author suggests that a natural first question to ask is,

What is the probability of a random natural number being prime?

but proceeds to dismiss it as "not making sense". I wonder what's wrong with the question. Is its meaninglessness related to the fact that there is an infinite number of naturals?

$\endgroup$
  • 7
    $\begingroup$ The way you describe it, I wonder if the author doesn't explain just that in the very next sentence. $\endgroup$ – RegDwight Sep 21 '13 at 23:08
  • $\begingroup$ not exactly- but he does proceed to ascertain that another similar question does make sense, what is the probability of a random natural n-digit number? $\endgroup$ – Adam Sep 24 '13 at 22:12
26
$\begingroup$

There's no uniform random distribution on the natural numbers, so the problem is with the phrase "random natural number". One cannot, for example, "pick a natural number at random", a fact which can be illustrated by the following thought experiment: How many digits should a natural number picked at random have?

On the other hand, we can view the question asymptotically: If $\pi(x)$ is the number of prime numbers less than $x$, we can study the ratio $$\frac{\pi(x)}{x}$$ as $x$ grows large. By the prime number theorem, $$\lim_{x \to \infty} \frac{\pi(x)}{x} \ln(x) = 1,$$ so since $\ln(x)$ is unbounded, the percentage of numbers less than $x$ that are prime becomes arbitrarily small as $x$ becomes arbitrarily large. In the asymptotic sense, then, the "probability of a natural number being prime" is zero, because $$\lim_{x \to \infty} \frac{\pi(x)}{x} = 0.$$

Edit: Let me elaborate a bit on why there isn't a uniform random distribution on $\newcommand{\N}{\mathbb{N}}\N$ (or on any countably infinite set, for that matter). To talk about probability, we must have a measure, i.e., a function $\mu$ sending "nice" subsets of $\N$ to $[0, +\infty]$. (What constitutes a "nice" subset is a technical detail that doesn't really matter here; actually, as with topological spaces and open sets, which sets are measurable is part of the data of the measure space.)

The main axiom for measures is that they're countably additive, that is, additive over countably infinite, pairwise disjoint collections of sets. So, if $A_0, A_1, A_2, A_3, \ldots$ is a collection of measurable subsets such that $A_i \cap A_j = \emptyset$ whenever $i \neq j$, then $$\mu\left( \bigcup_{i \in \N} A_i \right) = \sum_{i \in \N} \mu(A_i).$$ If we try to define a uniform measure on $\N$, let $A_i = \{i\}$. Since the measure is uniform, we must have $\mu(\{i\}) = \mu(\{j\})$ for all $i, j \in \N$. So by countable additivity, $$\mu(\N) = \mu\left( \bigcup_{i \in \N} \{i\} \right) = \sum_{i \in \N} \mu(\{i\}) = \sum_{i \in \N} \mu(\{0\}).$$ If $\mu(\{0\}) = 0$, then $\mu(\N) = 0$, so $\mu$ assigns zero to every set. If $\mu(\{0\}) > 0$, then $\mu(\N) = +\infty$. But a probability measure is, by definition, a measure such that the whole space has measure 1. Therefore, there is no uniform probability measure on $\N$.

On the other hand, we can often define uniform probability measures on uncountably infinite sets with no problem. For example, the Lebesgue measure on $[0, 1]$ is defined so that $\mu([a, b]) = b - a$ for any $0 \leq a < b \leq 1$. The reason this works is that measures don't have to be uncountably additive, just countably additive.

$\endgroup$
  • 2
    $\begingroup$ Does it make sense to pick a real number between 0 and 1 at random? There is infinitely many of them, but arguably you don´t have the problem with size. $\endgroup$ – Adam Sep 21 '13 at 18:16
  • 12
    $\begingroup$ The Lebesgue measure is a uniform distribution on the interval [0, 1]. Actually, in a certain sense, the problem with the natural numbers is that there are too few of them; since measures are required to be countably additive, the only uniform measures on the natural numbers (or on any countably infinite set) have total measure either zero or infinity, while probability measures must have total measure 1. $\endgroup$ – Daniel Hast Sep 21 '13 at 18:26
  • $\begingroup$ Interesting. I definitely need to read up on that abstruse thing called measure theoretic probability. :-) $\endgroup$ – Adam Sep 21 '13 at 18:31
  • 4
    $\begingroup$ Measure theory isn't nearly as abstruse as it's sometimes made out to be. It's just a way of formalizing and generalizing the notions of length, volume, size, and probability by assigning a quantity to each "sufficiently nice" subset in a regular way. That allows you to view everything in one big framework, so, for instance, notions like the average or expected value can just be viewed as special cases of integration. $\endgroup$ – Daniel Hast Sep 21 '13 at 18:37
  • 1
    $\begingroup$ @EnergyNumbers: Okay, I wrote up the explanation I hinted at in the comments. All this can be found in most standard measure theory books, but I guess it's useful to have the relevant parts all in one place. $\endgroup$ – Daniel Hast Sep 22 '13 at 15:15
4
$\begingroup$

The main issue with the question is that the density of primes decreases over increasing upper-limit interval subsets of $\mathbb N$. In fact, taking the density of the primes over the entire set of natural numbers evaluates to zero, therefore the probability would technically be zero. It does makes sense to say, for a given $n\in \mathbb N$, what is the probability of a number $q\in [1,n]$ being prime? And then the question has an exact, nonzero answer as the ratio of primes less than or equal to $n$ ($\pi(n)$) compared to $n$: $\pi(n)\over n$.

$\endgroup$
  • $\begingroup$ Your revised question has an exact answer: $\pi(n)/n$. $\endgroup$ – TonyK Sep 21 '13 at 17:57
  • $\begingroup$ @TonyK: thank you, I was thinking of the $\log n$ portion and thinking it was approximate. Corrected. $\endgroup$ – abiessu Sep 21 '13 at 18:10
  • 2
    $\begingroup$ The ratio $\pi(n)/n$ isn't given by the prime number theorem; it immediately from the definition of $\pi(n)$. The prime number theorem gives the asymptotic behavior of that ratio. $\endgroup$ – Daniel Hast Sep 21 '13 at 18:11
  • $\begingroup$ I should give up now... I'm too tired to get this right... :-( $\endgroup$ – abiessu Sep 21 '13 at 18:18
4
$\begingroup$

As in the other answers, indeed, there is difficulty in defining probabilities on somewhat-sparse subsets of infinite sets.

Nevertheless, in practice, there is a version of this question that has some substance, namely, to ask the "probability" that a number chosen "near" a given large-ish integer $N$ is prime, giving an answer depending on $N$. The prime number theorem essentially says the "density" of primes "near" $N$ is $1/\log N$, so a heuristic notion of this probability is $1/\log N$.

To make this more than a heuristic is not so difficult, using the prime number theorem, but of course it can also be rendered nonsensical if one desires, depending on how skeptical one wishes to be about probabilities in such situations.

$\endgroup$
2
$\begingroup$

There is a sense in which the probability of a random natural number being prime approximates to $\frac{1}{log N}$, as Paul and Daniel each get to, and subject to Daniel's elegant exposition of the measure issue.

It's worth bearing in mind that for most of the twentieth century, a lot of mathematicians (and in particular, statisticians) burdened themselves with a very narrow definition of probability: that it represented the frequency of an occurrence in a long-enough series of independent identical trials.

Using that definition, it isn't really meaningful to ask whether a specific random natural number is prime or not: it either is (probability=1) or it is not (probability=0); and until you check, you don't know whether you are the former state or the latter. Every time you check that specific number, you will always get the same answer. So the estimate of $\frac{1}{log N}$ isn't meaningful (and nor is any other estimate, though if you choose 0, you'd be right more often than not), using that definition of probability.

There is a broader, more useful definition of probability: one that is a superset of the above definition. And that is, that it is the quantification of our reasoned belief that a specific event will occur. Under this definition, $\frac{1}{log N}$ is a meaningful estimate, and may be useful.

$\endgroup$
  • 2
    $\begingroup$ "for most of the twentieth century, a lot of mathematicians (and in particular, statisticians) burdened themselves with a very narrow definition of probability"... Funny, I thought that in 1933, a guy published a small book titled Grundbegriffe der Wahrscheinlichkeitsrechnung which explained how to do it. Or maybe 1900-1933 is "most of the twentieth century"? $\endgroup$ – Did Sep 22 '13 at 12:23
  • 1
    $\begingroup$ Bayes pre-dated that book, and C20, by a long time; nevertheless, C20 concepts of probability largely belonged to the frequentists, despite Kolmogorov and despite Bayes. $\endgroup$ – EnergyNumbers Sep 22 '13 at 13:00
  • $\begingroup$ "C20 concepts of probability largely belonged to the frequentists"... Wow. Care for some references? $\endgroup$ – Did Sep 22 '13 at 14:00

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.