Few numbers have exercised more fascination, and confusion, than infinity. I can remember asking my father at a young age whether space went on forever. He replied that this must be so because, however far you travelled into space, you could always stretch out your arm into a void beyond.

Credit: Alex Teuscher / Getty Images

Same thing with time: will it go on for all eternity, and does it stretch back infinitely far into the past?

Philosophers and scientists have wrestled with these questions throughout the ages, but for most of that time ‘infinity’ as a concept was not well-defined.

All that changed in the 19th century when mathematicians learned how to manipulate infinity as a number in a consistent way. But those rules spring many surprises.

Consider the natural numbers – 1, 2, 3 and so on. They go on without limit. There are an infinity of natural numbers. Now ask, are there more natural numbers than even numbers? After all, the even numbers – 2, 4, 6 and so on – are contained within the natural numbers, interspersed with odd ones.

It is tempting to say there are twice as many natural numbers as even numbers. But that’s wrong.

When we say two sets of objects are equal, we put them into correspondence on a one-by-one basis. For example, if I claim I have the same number of fingers as toes, I mean that for every one finger there corresponds one toe, with no toes left over and no fingers left unmatched at the finish.

Now do the same for natural numbers and even numbers: pair 1 with 2, 2 with 4, 3 with 6, and so on. There will be exactly one even number for every natural number. The fact that each series forms an infinite set means the sets of numbers are the same size, even though one set is contained within the other!

This result gives a definition of infinity: an infinite set of objects is so big it isn’t made any bigger by adding to it or doubling it; nor is it made any smaller by subtracting from it or halving it.

It is a paradox made famous by the German mathematician David Hilbert (see the video below) who, in a lecture delivered in 1924, envisaged a hotel with an infinite number of rooms. Even when the hotel is full, he pointed out, it can still accommodate new guests if every guest vacates their room and moves one along, thus freeing up room number 1. This can be done an infinite number of times.

It is a paradox made famous by German David Hilbert in 1924.

In spite of this, it would be wrong to think of the infinity of natural numbers – which mathematicians refer to as a ‘countably’ infinite set, because you can count the members one by one – as the biggest conceivable number.

Between 1 and 2, for example, lie an infinite number of numbers, such as 3/5 and 7917/384431. There is no limit to how many digits we can add to the numerator and denominator to make more fractions. Nevertheless, it won’t surprise you to learn that the set of all fractions is in fact no bigger than the set of natural numbers: they form a countably infinite set too.

But not all numbers between 1 and 2 are fractions: some decimals (with infinite numbers of digits after the point) cannot be expressed as fractions. For example, the square root of 2 is one such number. It is known as an ‘irrational’ number because it cannot be expressed as the ratio of two integers. This is best understood by envisaging a continuous line, labelled by equally spaced natural numbers: 1, 2, 3 and so on. There will be an infinite number of points between 1 and 2, for example, with each point corresponding to a decimal number. No matter how small an interval on that line and how much you magnify it, there will still be an infinite number of points corresponding to an infinite number of decimals.

It turns out that the set of all points on a continuous line is a bigger infinity than the natural numbers; mathematicians say there is an uncountably infinite number of points on the line (and in three-dimensional space). You simply can’t match up each point on the line with the natural numbers in a one-to-one correspondence.

So there are two types of infinity, and it doesn’t stop there, but I will; I have been allocated only a finite number of words for this column. Let me finish by returning to my father’s answer about space: is it infinite? Well, yes and no.

If it is continuous (and some physicists think it may not be) then it will contain an uncountably infinite number of points. But that doesn’t mean it has to go on forever. As Einstein discovered, it may be curved in on itself to form a finite volume.

This led him to once remark: “Only two things are infinite, the universe and human stupidity, and I’m not sure about the former.”