system
Given the following post, respond as if you're commenting on Reddit:
human
Is a 'randomly' generated real number practically guaranteed to be transcendental?

I learnt in class a while back that if one were to generate a number by picking each digit of its decimal expansion randomly then there is effectively a 0% chance of that number being rational. So my question is 'will that number be transcendental or a serd?'
gpt
When we talk about probability distributions on the real numbers, we are really ultimately talking about a *measure*. A measure is a rather technical way of assigning a length to an interval or a volume to a region. We can actually define many measures on the real numbers, but we typically stick to so-called *Lebesgue measure*. This is a measure that allows us to assign "lengths" to subsets of real numbers in such a way so that the length of the interval [a, b] is just what you expect: *b*-*a*.

We can forget about most of the technicalities. What's important for your question is that Lebesgue measure assigns measure 0 to single points. That should make sense: the length of a single point is 0, right? It's also important that any measure satisfy certain properties. One property that makes a lot of sense is that if *A* and *B* are two *disjoint* subsets (that means they don't overlap), then the length of their union is just the sum of their lengths. For example, the measure of [1, 3] together with [5, 6] should be 2+1 = 3, and it is. What's interesting about measures is that we extend this rule of *finite* additivity to *countable* additivity. So if we have *countably* many disjoint sets (and there could be infinitely many of them), then the measure of the union is the sum of the measures.

So what happens when we combine those rules to a countable set of points? For instance, what is the Lebesgue measure of the set N = {0, 1, 2, 3, 4, ....}? Well, each number in the set is a single point and has Lebesgue measure 0. There are countably many numbers in N, so the Lebesgue measure of N is just 0+0+0+... = 0. This applies to *any* countable set. All countable sets of real numbers have Lebesgue measure 0. That should also make sense. Remember that the real numbers are uncountable. So a countable set, even though it may be infinite, is very small when compared to the uncountable set. Our sense of that smallness is reflected in how we construct Lebesgue measure.

Okay, so what does this have to do with transcendental numbers? Consider the set S of algebraic numbers, that is, all real numbers that are a root of some polynomial with rational coefficients. It turns out that S is countable! How can that be? (We need to use the fact that the rational numbers are countable.) We can actually just make a list of them. Forget about degree-0 polynomials since those are constants. What about degree-1 polynomials? Each degree-1 polynomial is determined by 1 rational number (we can always assume the leading coefficient of the polynomial is unity). There are countably many such polynomials, each of which has at most 1 real solution. So we get S*_1_* = set of real solutions to degree-1 polynomials with rational coefficients, and that is a countable set. Then we move on to degree-2 polynomials, and there are countably many of those since they are determined by 2 rational numbers. Each of those degree-2 polynomials has at most 2 solutions, so there are countably many solutions. (Two solutions times countably many polynomials = countably many solutions.) So S*_2_* = set of real solutions to degree-2 polynomials with rational coefficients, and that is a countable set.

We can generalize clearly. Let S*_n_* = set of real solutions to degree-n polynomials. That set is countable, being at most the size of finitely many countable sets. Finally, we see that S (the set of algebraic numbers) is the union of S*_1_*, S*_2_*, ..., S*_n_*,... . Here we have to use the fact that the union of countably many countably sets is itself countable. The proof is not that difficult. If you have a list of the members of each set, you can form a list of the union by listing them like this:

> S*_1_*(1)

> S*_1_*(2)

> S*_2_*(1)

> S*_1_*(3)

> S*_2_*(2)

> S*_3_*(1)

> ...

The pattern is rather simple. List one element from the first set. Then the next unlisted elements from the first two sets. Then the next unlisted elements from the first three sets. Then the next unlisted elements from the first four sets, and so on. Eventually, every single element in the union will appear on the list.

So now once we know that the algebraic numbers are countable, we know that their Lebesgue measure is 0. We say that *almost all* real numbers are transcendental. So, for instance, if you consider the uniform probability distribution on the interval [0,1], there is probability 1 that a randomly selected number is transcendental.