I just had an (intellectual) panic attack.

  • A continuous random variable that follows a uniform in a closed interval $U(a,b)$: a comfortably familiar statistical concept.
  • A continuous uniform r.v. having support over the extended reals (half or whole): not an r.v. proper, but a basic Bayesian concept for an improper prior, useful and applicable.
  • A discrete uniform taking a finite number of values: let's throw a geodesic dome, no big deal.

But what about a function that has as its domain all the rationals that are included in a closed interval with integer bounds (start with the $[0,1]$ if you wish)? And we want to use it in a probabilistic framework, requiring that each possible value has equal probability with all the others?

The number of possible values are countably infinite (which characterizes a lot of discrete distributions), but how to express the probability of a single value given that we want probabilities equal?

Can we say-show-prove that such an entity is (is not) a random variable?

If not, is this another incarnation (perhaps already well-known) of an "improper prior"?

Is it possible that this entity is in some well-defined sense, however special, "equivalent" to a continuous uniform r.v.? Or I just committed a cardinal(ity) sin?

It appears that the fact that the domain is a closed interval does not let me let go. Bounded things are usually manageable.

The questions are many in order to be indicative of the internal maelstrom- I am not asking to get answers to each one of them.

At any time that I may come up with any insights, I will update.

UPDATE: the present question just acquired a constructivist sequel here.

  • 2
    $\begingroup$ +1 A great question to have here. You can't define a uniform distribution over the rationals, not even restricted to [0,1], nor for any other countably infinite set. I wrote a little discussion about this once, I'll see if I can dig it up and look at it, but it probably doesn't add anything useful to the answer you have. $\endgroup$
    – Glen_b
    Jun 19, 2014 at 0:17
  • $\begingroup$ @Glen_b Thanks Glen. Let's hope you post this little discussion you mention. $\endgroup$ Jun 19, 2014 at 1:26
  • $\begingroup$ On reflection, I don't think it said anything not already covered here $\endgroup$
    – Glen_b
    Jun 19, 2014 at 3:03
  • 1
    $\begingroup$ Possible duplicate of Uniform distribution on $\mathbb{Q} \cap [0, 1]$ (sort of) $\endgroup$ Nov 6, 2017 at 18:13
  • $\begingroup$ Can someone make a comparison as to why it makes sense in the continuous/uncountably infinite case (i.e., uniform over [0,1])? $\endgroup$
    – Sam
    Oct 5, 2023 at 14:53

2 Answers 2


This "random variable" is similar to the idea of having a flat prior on the entire real line (your second example).

To show that there can be no random variable $X$ such that $P(X=q)=c$ for all $q\in \mathbb{Q}\cap[0,1]$ and constant $c$, we use the $\sigma$-additive property of random variables: the countable union of disjoint events has probability equal to the (possibly infinite) sum of probabilites of the events. So, if $c=0$, the probability $P(X\in\mathbb{Q}\cap[0,1])=0$, as it is the sum of countably many zeros. If $c>0$, then $P(X\in\mathbb{Q}\cap[0,1])=\infty$. However a proper random variable taking values in $\mathbb{Q}\cap[0,1]$ must be such that $P(X\in\mathbb{Q}\cap[0,1])=1$, so there is no such random variable.

The key here, as you may already be aware, is that if the space is composed of finitely many points, then we can use $c>0$ and have no problem with the sum, and if the space has uncountably many points you can have $c=0$ and the $\sigma$-additivity isn't violated when integrating over the space because it is a statement about countable things. However you're going to problems when you want a uniform distribution over a countably infinite set.

In the context of a Bayesian prior, though, you can of course just say that $P(X=q)\propto 1$ for all $q\in \mathbb{Q}\cap[0,1]$ if you're willing to use the improper prior.

  • $\begingroup$ Thanks, this looks like the cold shower appropriate for the occasion. $\endgroup$ Jun 19, 2014 at 1:04

A more positive fact is the following.
If you drop the requirement that the probability measure be countably additive, and only require, instead, that it be finitely additive (just for the sake of this question), then for the rational numbers the answer is "yes".
The rational numbers are an additive group since one can add two rational numbers, there is a neutral element, zero, and any $z\in\mathbb{Q}$ has an additive inverse $-z\in\mathbb{Q}$.
Now, one can equip the rational numbers with the discrete topology so that they are a discrete group. (This is important because in other contexts it is more convenient not to do so and put another topology on them.)
Viewed as a discrete group, they are even a countable discrete group because there are only countably many rational numbers.
Also, they are an abelian group because $z +y =y+z$ for any pair of rational numbers.
Now, the rational numbers, viewed as a countable discrete group, are an amenable group. See here for the definition of an amenable discrete group. Here it is shown that every countable abelian discrete group is amenable. In particular, this applies to the group of rational numbers.
Therefore, by the very definition of an amenable discrete group, there exists a finitely additive probability measure $\mu$ on the rational numbers that is translation invariant, meaning that $\mu(z + A) = \mu(A)$ for any subset $A\subset\mathbb{Q}$ and any rational number $z\in\mathbb{Q}$.
This property encompasses the intuitive way of defining "uniformity".
$\mu$ necessarily vanishes on all finite subsets: $\mu(\{z\})=0$ for all $z\in\mathbb{Q}$.
If you seek a random variable instead of a probability measure, then just consider the identity function on the probability space $(\mathbb{Q}, \mu)$. This gives such a required random variable.
Therefore, if you relax your definition of probability measure a bit, you end up with a positive answer for the rational numbers.
Perhaps, the existence of $\mu$ seems a bit counter-intuitive. One can get a better idea of $\mu$ by taking into account that a direct consequence of the translation-invariance is that the measure of all rational numbers whose floor is even, is one half; also, the measure of those with odd floor is one half, and so on.
That measure $\mu$ that we just showed to exist, also necessarily vanishes on all bounded subsets (as one can show with a similar argument), in particular on the unit interval.
Therefore, $\mu$ does not immediately give an answer for the rational numbers in the unit interval. One would have thought that the answer is easier to give for the rational numbers in the unit interval instead of all rational numbers, but it seems to be the other way around.
(However, it also seems that one can cook up a probability measure on the rational numbers in the unit interval with similar properties, but the answer would then require a more precise definition of "uniformity" - maybe something along the lines of "translation-invariant whenever translation does not lead outside the unit interval".)
UPDATE: You immediately obtain a measure on the unit interval rationals that is uniform in that sense, by considering the push-forward measure of the one on the rationals, that we constructed, along the map from the rationals to the unit interval rationals that maps each rational to its fractional part.
Therefore, after relaxing the requirement to finite additivity, you obtain such measures in both cases you mentioned.

  • 2
    $\begingroup$ (+1) Thanks Matthias, and welcome to CV. It will take me some time to fully digest your answer, but it is a very interesting approach. $\endgroup$ Jun 19, 2014 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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