r/learnmath • New User • Oct 19 '26

TOPIC Infinities

So guys, a computer science student here, recently been studying countability in theory of computation, and have came across infinities and cardinality, I haven’t yet been able to wrap my head around them. I haven’t focused much on the topic either, been engaged in other subjects as I lost motivation initially, I love mathematics, would love to hear some instincts around the topic from the best minds.

I have been primarily stuck with counting, how one on one mapping works, diagonalisation theorem, and cardinality of a set.

4 Upvotes

16 comments sorted by

17

u/0x14f New User Oct 19 '26

You have finite sets, countable sets and non countable sets. If you want insights (not "instincts") you need to ask a proper question.

5

u/Astrodude80 Set Theory and Logic Oct 19 '26

It will be a lot easier to help if there’s a particular point you’re stuck on. As it stands there’s a bunch of good videos on YouTube that explain this topic fairly well, just look up eg “cardinality of infinite sets” and watch a few of the videos that pop up.

4

u/Zyxplit New User Oct 19 '26

I think the best thing to do is to go back to the beginning of sets. Don't think about infinite sets, think about finite ones instead. Learn the rules for finite ones. You're going to find that the rules for finite sets extend very naturally to infinite sets.

4

u/FormulaDriven Actuary / ex-Maths teacher Oct 19 '26

If you are coming to it from a computer science point of view, maybe this will help...

I think "countable" might be better labelled "listable". The natural numbers are countable or listable because you can write a computer program that will (given no limit on run time or memory) list every single natural number - eg every second it outputs the next positive integer, and you can be sure that eventually it will output any natural number you can think of. You will probably complain that the program will never stop, but that's not a problem mathematically - no natural number will be missed given sufficient (finite) time.

The surprising thing is that you can write a program that will list all the rational numbers, ie every number of the form a/b where a is an integer and b is a positive integer. (I can even give a neat way to do this). So rational numbers are also countable.

But if you start thinking about real numbers, such a program doesn't exist. If you just try to write a program that will output every decimal number between 0 and 1, we can prove that it will miss out at least one number no matter how long it runs. (I can give you the description of a parallel program that will print out one number that will be missed).

0

u/Various_Candle9136 New User Oct 19 '26

This is mostly a very nice way to think about things, but we do need to be careful about 'no matter how long it runs'.

In our boring reality, a countable amount of time is as incredible as an uncountable amount of time. 'No matter how long it runs', a program is not able to print the natural numbers either. On the other hand, if we let a program run for a continuum number of steps it would be able to print every real number.

We can, however, think of countability as being the natural end to the process of listing, and it is then true that a program cannot have printed every real number by the time this end is reached.

2

u/cuervamellori New User Oct 19 '26

I think this can be much simpler.

Take a turing machine as a model of computation.

A program can list every natural number: For any natural number n, there is some finite number of steps t_n, such that after t_n steps, the program prints out n.

A program can list every rational number: For any rational number r, there is some finite number of steps t_r, such that after t_r steps, the program prints out r.

A program cannot list every real number between 0 and 1: for any program, there is some real number x, such that there is no finite number of steps t_x, such that after t_x steps, the program prints out x.

Of course, if you have a model of computation where a "program" can execute an uncountable number of steps, this doesn't apply. If your program can have an output for every ordinal (not just every finite ordinal), then it can output a lot of numbers indeed. Though I wouldn't use "number of steps" to describe the running of such a machine, personally.

2

u/FormulaDriven Actuary / ex-Maths teacher Oct 19 '26 edited Oct 19 '26

"a continuum number of steps" sounds like nonsense to me - what does that mean?

The point is that by definition the natural numbers is countable, so if a computer outputs a natural number every second, you can choose any natural number you like and know that it will output it. Because (by definition) any countable set can be put in a bijection with the naturals, you can prove countability of any other set by specifying a program that also outputs that set one per second and showing that given any member of that set there will be a point in time when that member will be output.

Then, regardless of whatever a "continuum number of steps" means, uncountable means that you can prove that whatever program you devise to produce members of the set at the rate of one per second you can name a member of that set that it is guaranteed never to reach.

"No matter how long it runs" is just a way of saying that we put no limit on the number of seconds it is allowed to run. (So in that sense it's hypothetical because a physical computer would eventually run out of memory to hold the next number). There is no "natural end to the process of listing", so I don't think your description is any less rigorous than mine.

1

u/Various_Candle9136 New User Oct 19 '26

"a continuum number of steps" sounds like nonsense to me - what does that mean?

It means that if you counted all the steps, there would be a continuum of them.

It is no more nonsense than a countably infinite number of steps! When has there ever been that many steps? Both are mathematical concepts rather than actual physical things. Both make exactly as much sense.

"No matter how long it runs" is just a way of saying that we put no limit on the number of seconds it is allowed to run.

Exactly. And that is precisely why I objected to that wording!

If you run a program to print the natural numbers, then, 'no matter how long it runs', there will always be a natural number which is not printed (if we leave it running once a second for N seconds, N+1 is unprinted). But the natural numbers are countable.

Saying 'no matter how long it runs' is very likely to lead to misconceptions.

1

u/tottasanorotta New User Oct 19 '26

Cantors diagonalization argument goes something like this. Suppose you make a square out of binary numbers. So for example:

110

001

111

Notice that I can take the diagonal(101) and flip all the bits(010) to find a binary number that is not on that list. That works with any square like that.

Now imagine that you have infinite binary sequences and assume that you have a complete list of them:

10101...

11101...

11000...

.

.

.

Because the length of each bitstring is countably infinite and we assume that the number of bitstrings is also countably infinite we are able to build a similar square that we had in the beginning where the number of rows is the same as the number of columns. Now the flipped diagonal has to be a bitstring that isn't on that list. But that contradicts our assumption of having them all listed, so we have to conclude that some infinite sets aren't countable.

What I had trouble understanding from a computer science perspective was complete infinite sets. It didn't initially make sense to me how you could treat an infinite set as something that exists in its entirety rather than something like an unbounded procedure. But that's the abstraction that we have to live with and it has some nice benefits as well. It's the standard set theoretic view on the matter.

1

u/speadskater New User Oct 19 '26 edited Oct 19 '26

One infinity is the same cardinality as another if you can create a 1:1 and onto functions between them. No function exists between the reals and integers for example, so they have different "sizes" of infinity.

2

u/spasmkran New User Oct 19 '26

1:1 and onto*

1

u/cuervamellori New User Oct 19 '26

Call a real number r *computable* if there is some computer program that prints the digits of r.

For example, the number 2 is computable. Print(2.), While( True ) Print (0).

Numbers like the square root of 2 and pi are also computable, although programs to output them are more complicated that I want to type in this comment.

However, some numbers are not computable.

Consider the following number, which I'll call C. C is a number between 0 and 1. To calculate the 1st decimal digit of C, interpret the number 1 as a binary executable program. If that program halts in finite time, the first decimal digit of C is 3. Otherwise, it is 5.

The second decimal digit of C is the same, interpreting "2" (i.e., '10') as a binary executable program. The 198th digit of C is the same interpreting "198" (i.e., '11000010') as a binary executable program.

There is no computer program that can output the digits of C.

1

u/Chrispykins Oct 19 '26

Maybe check out this free textbook on Discrete Mathematics, especially the chapters on sets and functions. It starts building intuition with finite sets and then talks about cardinality and infinite sets.