A deep take on countability, cardinality and ordering

I’ve been teaching CMSC250, Discrete Mathematics, over the past year in CS UMD. Last semester, I typed a more philosophical than mathematical post on Countability, Cardinality and Ordering, which I’m repeating here for the community’s sake.

After our ordinality lecture last Tuesday, I had a student come to me and tell me that they were not sure how to think about ordinality: they were understanding the relationship between cardinality and size, since it is somewhat intuitive even for infinite sets (at least to them!), but ordinality still appeared esoteric. That’s 100% natural, and in this post I will I’ll try to stray away from math and try to explain how I think about countability, cardinality and ordinality intuitivelyThis post has exactly zero things to do with the final, so if you want to limit your interactions with this website to the exam-specific, you may stop reading now.

Before we begin, I would like to remind you of a definition that we had presented much earlier in the semester, I believe during an online quiz: A set S is dense if between any two elements of it, one can find another element. Note something interesting: only ordered sets can be qualified as dense or not! Technically, we had not presented the notion of an ordered set when we discussed dense sets, but it is intuitive enough that people can understand it.


We say that any enumerable set is countable. Enumerable, mathematically, means that we can find a bijection from the non-zero naturals to the set. Intuitively, it means “you start from somewhere, and by sequentially making one step, no matter how long it takes, you are guaranteed to reach every single element of the set in finite time”. Whether this finite time will happen in one’s lifetime, in one’s last name’s lifetime, or before the heat death of the universe, is inconsequential to both the math and the intuition. Clearly, this is trivial to do for either the non-zero naturals or the full set of naturals: you start from either 1 or 0, and then you make one step “forward”.

However, we also saw in class that this is possible to also generalize for the full set of integers: we start from 0 and then start hopping around and about zero, making bigger hops every time. Those hops are our steps “forward”.

Those results are probably quite intuitive to you by now, and I feel that the reason for this might that both LaTeX: \mathbb{N} and LaTeX: \mathbb{Z} are non-dense sets.There are no naturals or integers between LaTeX: n and LaTeX: n+1 (LaTeX: n \in \mathbb{N}  or LaTeX: n \in \mathbb{Z} ).

Let’s stray away from LaTeX: \mathbb{Q}  for now and fast-forward to LaTeX: \mathbb{R} . We have already shown the mathematical reason, Cantor’s diagonalization, for which the set of reals is uncountable. But what’s the intuition? Well, to each their own, but here’s how I used to think about it as a student: Suppose that I start from zero just to make things easier with respect to my intuitive understanding of the real number line (I could’ve just as well started with LaTeX: -e^8). 

Then, how do I decide to make my step forward? Which is my second number? Is it 0.1? Is it -0.05? But, no matter which I pick as my second number, am I not leaving infinitely many choices in between, rendering it necessary that I recursively look into this infinite interval? Note that I have not qualified “infinite” with “countably infinite” or “uncountably infinite” yet. This was my personal intuition as a Discrete Math student about 11 years ago about why LaTeX: \mathbb{R}  is uncountable: Even if you assume that you can start from 0, there is no valid ordering for you to reach the second element in the sequence of reals! Therefore, such a sequence cannot possibly exist!

But hold on a minute; is it not the case that this argument can be repeated for LaTeX: \mathbb{Q} ? Sure it can, in the sense that between, say, LaTeX: 0 and LaTeX: \frac{1}{2}, there are still infinitely many rationals. It is only after we formalize the math behind it all that we can say that this is a countable infinity and not an uncountable one, as is the case of the reals. But still, we have to convince ourselves: why in the world is it that the fact that every one of these infinite numbers can be expressed as a ratio of integers make that infinity smaller than that of the reals?

Here’s another intuitive reason why we will be able to scan every single one of these numbers in finite time: everybody open the slide where we prove to you that LaTeX: \mathbb{Q}^{>0}  is countable using the snaking pattern. Make the crucial observation that every one of the diagonals scans fractions where the sum of the denominator and the numerator is static! The first diagonal scans the single fraction (LaTeX: \frac{1}{1}) where the sum is 2. The second one scans the fractions whose denominator and numerator sum is 3 (LaTeX: \frac{1}{2},\ \frac{2}{1}). In effect, the LaTeX: i^{th} diagonal scans the following fractions:

LaTeX: \{ \frac{a}{b} \mid (a,b \in \mathbb{N}^{\geq 1}) \land (a + b=i+1)\}

For those of you that know what equivalence classes are, we can then define LaTeX: \mathbb{Q}^{>0}  as follows:

LaTeX: \mathbb{Q}^{>0} = \bigcup_{i \in \mathbb{N}}\{ \frac{a}{b} \mid (a,b \in \mathbb{N^{\geq 1}}) \land (a + b=i+1)\}

Let’s see this in action…

LaTeX: \mathbb{Q}^{>0} = \{ \color{red}{\underbrace{ \frac{1}{1}}_{i=1}}, \color{blue}{ \underbrace{\frac{1}{2}, \frac{2}{1}}_{i=2}} , \color{brown}{\underbrace{\frac{1}{3}, \frac{2}{2}, \frac{3}{1}}_{i=3}}, \dots \}

Note that essentially, with this definition, we have defined a bijection from LaTeX: \mathbb{N^{\geq 1}} \times \mathbb{N^{\geq 1}} to LaTeX: \mathbb{Q}. We know that LaTeX: \mathbb{N}^{\geq 1} \times  \mathbb{N}^{\geq 1} is countable, so we now know that LaTeX: \mathbb{Q}^{> 0}  is also countable! 🙂

Let’s constrain ourselves now to the original challenge that we (I?) are faced with: we have selected 0 as our first element in the enumeration of both LaTeX: \mathbb{Q}  and LaTeX: \mathbb{R}  (the latter is assumed to exist), and no matter which our second element is (say it’s LaTeX: \frac{1}{2}), we have infinitely many elements in both sets between 0 and LaTeX: \frac{1}{2}But now we know that those infinites are different: in the case of LaTeX: \mathbb{Q} . we know for a fact that we will reach all of those fractions whose decimal values are in LaTeX: (0, 0.5). In the case of LaTeX: \mathbb{R} , there is no such enumeration: any enumeration we define will still leave an… uncountably infinite gap between any two elements in “sequence”.

Remember how in our lecture on Algebraic and Transcendental numbers, we gave only three examples of numbers in LaTeX: TN, yet the fact that LaTeX: TN is uncountable when LaTeX: ALG is countable guarantees that there are “many more” Transcendental numbers than Algebraic? Same thing applies here with the rationals and irrationals: given any interval of real numbers LaTeX: (r_1, r_2), there are many more irrationals than rationals inside that interval... If you define a system of whole numbers (integers), there are many more quantities that you will not be able to express as a ratio of integers. That’s why back in the day (300 B.C) when Euclid proved that LaTeX: \sqrt 2 is not expressible as such a ratio LaTeX: \frac{a}{b} (or, more accurately, that LaTeX: 2 cannot be expressed as the square LaTeX: \frac{a^2}{b^2}) his result was so unintuitive; those Hellenistic people did not have rulers. They did not have centimeters or other accepted forms of measurement. The only thing they had were shoestrings, or planks of wood which they put in line and “saw” that they were the same length, and then they measured everything else as the ratio of such “whole” lengths.


Recall something that we said when we were discussing the factorial function and its combinatorial interpretations when applied on positive integers. Bill’s explanation of why LaTeX: 0!=1 was purely algebraic: If it were LaTeX: 0, then, given the recursive definition LaTeX: n!\:=\:n\:\cdot\left(n-1\right)! for LaTeX: n\:\ge1, every LaTeX: n! would be LaTeX: 0rendering it a pretty useless operation. My explanation was combinatorial: we know that if we have a row of, say, LaTeX: n marbles, there are LaTeX: n! different ways to permute them, or LaTeX: n! different orderings of those marbles. When there are no marbles, so LaTeX: n=0there is only one way to order them: do nothing, and go watch Netflix. 

Let’s stick with Bill’s interpretation for a moment: the fact that some things need to be defined in order to make an observation about the real world work. In this case, the real world is defined as “algebra that makes some goddamn sense”. My explanation is more esoteric. You could say: “What do you mean there’s only one way to arrange zero things? I don’t understand, if there are zero things and there’s nothing to do, shouldn’t there be, like, 0 ways to arrange them?”. So, let’s stick with Bill’s interpretation to explain something that I attempted to explain to a group of students after our first lecture this semester: Why do negative numbers even exist?

Here’s one such utilitarian explanation: Because without negative numbers, Newtonian Physics, with their tremendous application in the real world, would not work. That is, the model of Newtonian Kinematics with its three basic laws, which has been empirically proven to describe very well things that we observe in the real world, needs the framework of negative numbers in order to, well, work. So, if you’re not ok with the existence of negative numbers, you had better also be able to describe to me a framework that explains a bunch of observations on the real world in some way that doesn’t use them. For example, you probably all remember the third law of Newtonian motion: For every action LaTeX: \color{red}{\vec{F}}, there exists an equal and opposite reaction LaTeX: \color{red}{-\vec{F}}:

Recall that force is a vectoral quantity since it is the case that LaTeX: \vec{F} = m \cdot \vec{a}, and acceleration LaTeX: \vec{a} is clearly vectoral, as the second derivative of transposition LaTeX: \vec{x}

The only way for Newton’s third law of motion can work is if LaTeX: \vec{F} + (-\vec{F}) = \vec{0}. This is only achievable if the two vectors have the same magnitude but exactly opposite directions. No other way. Hence the need to define the magnitudes as follows:

LaTeX: | |\vec{F}|| = \frac{1}{2} \cdot m \cdot a^2,\ | |\vec{\color{red}{-}F}|| = \color{red}{-}\frac{1}{2} \cdot m \cdot a^2

and the necessity for negative numbers becomes clear. Do you guys think the ancient Greeks or Egyptians cared much for negative numbers? They were building their theories in terms of things they could touch, and things that you can touch have positive mass, length, height…

Mathematics is not science. It is an agglomeration of models that try to axiomatize things that occur in the real world. For another example, ZFC Theory was developed in place of Cantorian Set Theory because Cantorian Set Theory can lead to crazy things such as Russel’s Paradox. Therefore, ZFC had to add more things to Set Theory to make sure that people can’t do crazy stuff like this. If we discover contradictions with the real world given our mathematical model, we have to refine our model by adding more constraints to it. Less constraints, more generality, potential for more contradictions. More constraints, less generality, less contradictions, but also more complexity.

So when discussing the cardinality of LaTeX: \mathbb{N}  and LaTeX: \mathbb{Z}  and finding it equal to LaTeX: \aleph_0, we are faced with a problem with our model: the fact that LaTeX: \color{magenta}{\mathbb{N} \subset \mathbb{Z}} (I have used the notation of proper subset here deliberately). Now, I just had a look at our cardinality slides, and it is with joy that I noticed that we don’t use the subset / superset notation anywhere. That’s gonna prove a point for us.

So, back to the original problem: intuitively understanding why the hell LaTeX: \mathbb{N}   and LaTeX: \mathbb{Z}  have the same cardinality when, if I think of them on the real number line, I clearly have LaTeX: \mathbb{N} \subset \mathbb{Z}:

LaTeX: \underbrace{\dots, -4, -3 , -2, -1, \underbrace{0, 1, 2, 3, 4, \dots}_{\mathbb{N}} }_{\mathbb{Z}}

The trouble here is that we have all been conditioned from childhood to think about the negative integers as “minus the corresponding natural”. This conditioning is not something bad: it makes a ton of sense when modeling the real world, but when comparing cardinalities between infinite sets, that is, sets that will never be counted entirely in finite time, we distance ourselves from the real world a bit, so we need a different mathematical model. To that end, let’s build a new model for the naturals. Here are the naturals under our original model:

LaTeX: 0, 1, 2, 3, \dots

This digits that we have all agreed to be using have not been around forever. The ancient Greeks used lowercase versions of their alphabet: LaTeX: \alpha, \beta, \gamma, \delta , \epsilon, \sigma \tau ', \zeta,\ \dots\ \omega  to name a total of 25 “digits”, while the Romans used a subset of their alphabet “stacked” in a certain way: LaTeX: I, II, III, IV, V, VI, \dots, X, XI\dots . These “stacked” symbols cannot be really called digits the way that we understand them, especially since new symbols appear long down the line (LaTeX: C, M) etc. These symbols we actually owe to the Arabic Renaissance of the early Middle Ages.

The point is that I can rename every single one these numbers in a unique way and still end up with a set that has the exact same properties (e.g closure of operations, cardinality, ordinality) as LaTeX: \color{red}{\mathbb{N}}. This is formally defined as the Axiom of Replacement. So, let’s go ahead and describe LaTeX: \mathbb{N}  by assigning a random string for every single number, assuming that no string is inserted twice:

LaTeX: foo, bar, otra, zing, tum, ghi,\dots

Which corresponds to our earlier

LaTeX: 0, 1, 2, 3, 4, 5,\dots

Cool! Now the axiom of replacement clearly applies to LaTeX: \mathbb{Z}  as well, so I will rewrite

LaTeX: \dots, \color{blue}{-5, -4, -3, -2, -1,}\ \color{magenta}{0, 1, 2, 3, 4, 5,}\dots


LaTeX: \dots, \color{blue}{qwerty, forg, vri, zaq,  nit,}\ \color{magenta}{bot, ware, yio, bunkm, ute, kue,}\dots

Call these “transformed” sets LaTeX: \mathbb{N}_{new} and LaTeX: \mathbb{Z}_{new} respectively. Under this encoding, guys, I believe it’s a lot more obvious that LaTeX: \mathbb{N}_{new} \not\subset \mathbb{Z}_{new} in the general case. LaTeX: \mathbb{N}_{new} \subset \mathbb{Z}_{new} under these random encodings is so not-gonna-happenish that its probability is not even axiomatically defined. Therefore, now we can view LaTeX: \mathbb{N}  and LaTeX: \mathbb{Z}  as infinite lines floating around space, lines that we have to somehow put next to each other and see whether we can line them up exactly. If you tell me that even under this visualization, the line that represents LaTeX: \mathbb{Z} _{new} is infinite in both directions, whereas that of LaTeX: \mathbb{N}_{new}  has a starting point (0), then I would tell you that I can effectively “break” the line that represents LaTeX: Z_{new} in the middle (0) and then mix the two lines together according to the mapping that corresponds to:

LaTeX: 0, 1, -1, 2, -2, 3, -3, \dots

Now we no longer have the pesky notation of the minus sign, which pulls us to scream “But the naturals are a subset of the integers! Look! If we just take a copy of the naturals and put a minus in front of them, we have the integers!”. We only have two infinite lines, that start from somewhere, extend infinitely, and it is up to us to find a 1-1 and onto mapping between them. That is, it is up to us find a 1-1 mapping between:

LaTeX: foo, bar, otra, zing, tum, ghi,\dots


LaTeX: bot, ware, nit, yio, zaq, bunkm\dots

(Note that I re-ordered the previous encoding LaTeX: \dots, \color{blue}{qwerty, forg, vri, zaq,  nit,}\ \color{magenta}{bot, ware, yio, bunkm, ute, kue,}\dots according to the “hopping” map into  LaTeX: \color{magenta}{bot}, \color{magenta}{ware}, \color{blue}{nit,} \color{magenta}{yio}, \color{blue}{zaq}, \color{magenta}{bunkm},\dots .)

Under this “visual”, you guys, it makes a lot of sense to try to estimate if the two sets have the same cardinality and, guess what, they do 🙂

Not much else to say on this topic everyone. We can have a bunch of applications of the axiom of replacement to prove, for example, that the cardinality of the integers, LaTeX: \aleph_0, is also the cardinality of LaTeX: \mathbb{N} \times \mathbb{N}LaTeX: \mathbb{Q} , etc. It is only when we start considering sets such as LaTeX: \mathbb{R} , \mathcal{P}(\mathbb{N}) and LaTeX: \{0, 1 \}^\omega  that this idea that we can be holding two infinite lines in space fails.


There’s not much to say here except that the easiest way to understand how an order differs from a set is to consider an ordering exactly as such: an order of elements! Think in terms of “first element less than second less than third less than …. “. The simplest way possible. It is then that we can prove rather easily that LaTeX: \omega \prec y \prec \zeta .

Things only become a bit more complicated when considering the ordering LaTeX: \omega + \omega:

LaTeX: 0 < \frac{1}{2} < \frac{3}{4} < \frac{5}{6} < \dots <1 < \frac{3}{2} < \frac{4}{3} <\dots <2 <\dots

Please note that this ordering is clearly not the same as LaTeX: \eta, the ordering of LaTeX: \mathbb{Q} . Between the first and the second element, for instance, there are countably many infinite rationals: LaTeX: \frac{1}{100}, \frac{2}{5}, \dots , \frac{3}{7}\dots  which are not included in the ordering. 

Finally, realize the meaning of “incomparable” orderings: a pair of orderings LaTeX: \alpha, \beta  will be called incomparable if, and only if:

LaTeX: (\alpha \npreceq \beta) \wedge (\beta \npreceq \alpha).

So please realize that this is not the same as saying, for instance, LaTeX: \beta \nprec\alpha .

I think this is all, I am bothered when I can’t explain something well to a student so I thought I’d share my views on countability in case the subject becomes easier to grasp.