Skip to content
Other

Galileo's Paradox of Infinity Calculator

This calculator brings Galileo's paradox to life. Choose a range of natural numbers and instantly see how many perfect squares fall inside it, then watch the bijection map each natural number n to its square n squared. The tool shows you the apparent contradiction at the heart of infinity, the step-by-step reasoning that resolves it, and a density chart so you can see how quickly squares thin out as numbers grow.

Your details

The smallest natural number in your comparison range.
The largest natural number in your comparison range.
A specific natural number to demonstrate the bijection: this tool shows n and its partner square n squared.
Natural numbers in range
100

Count of integers from range start to range end

Perfect squares in range10
Squares as % of naturals0.1%
Square of sample n49
Is sample n a perfect square?No
Squares per 100 naturals (at your range end)10
Natural numbers in range100
Perfect squares in range10
0501001055100
Natural number (n)
  • Naturals density (always 100%)
  • Squares density (% of each window)

Finite range shows 10 squares vs 100 naturals, but both sets are equally infinite.

  • In your range, only 10 out of 100 numbers are perfect squares (10.0%), yet the bijection f(n) = n² pairs every natural number with a unique square.
  • Your sample n = 7 maps to 49 under the bijection. This pairing is one-to-one and covers every perfect square exactly once.
  • As numbers grow larger, squares become increasingly sparse. Near 100, roughly 10.00 out of every 100 naturals are squares. Yet the correspondence never breaks: every natural still has a square partner.
  • Galileo noticed this and concluded that 'less than', 'equal to', and 'greater than' cannot apply to infinite collections. Cantor later proved both sets share the same infinite cardinality, called aleph-null.

Next stepTry increasing the range end to 10,000 to see the density of perfect squares drop below 1%, while the bijection remains perfect.

Formula

f:NS,f(n)=n2N=S=0f: \mathbb{N} \to S,\quad f(n) = n^2 \quad\Rightarrow\quad |\mathbb{N}| = |S| = \aleph_0

Worked example

In the range 1 to 100: there are 100 natural numbers but only 10 perfect squares (1, 4, 9, 16, 25, 36, 49, 64, 81, 100). Yet the mapping n to n-squared pairs each natural uniquely with a square: 1 to 1, 2 to 4, 3 to 9, ..., 100 to 10000. Because every natural has exactly one square partner and every square has exactly one root, Cantor defines the two sets as having equal size (cardinality aleph-null), even though squares are sparse in any finite window.

What is Galileo's paradox?

In his 1638 work Two New Sciences, Galileo noticed two conflicting facts about natural numbers and their squares. First, some naturals are perfect squares (1, 4, 9, 16, ...) and most are not, so surely there are more naturals than squares. Second, every natural number n has exactly one square n-squared, and every perfect square has exactly one square root, so the two sets can be paired off completely with nothing left over. Galileo concluded the paradox was irresolvable: the concepts of 'more', 'equal', and 'fewer' simply do not apply to infinite collections. He was half right. The paradox is real, but it was resolved two centuries later by Georg Cantor, who built a rigorous theory of infinite sets.

The key insight: when Cantor defined two sets as having the same cardinality (size) if and only if a perfect one-to-one pairing exists between them, the paradox dissolved. Both sets can be put in bijection, so they are equally large - both countably infinite, written aleph-null.

How this calculator works

Enter a range of natural numbers and a sample value n. The calculator counts how many naturals and how many perfect squares fall inside your range, computes the percentage of naturals that are squares, and evaluates the bijection f(n) = n-squared for your sample. The steps panel shows the floor-of-square-root method: the number of perfect squares from 1 to k equals floor(sqrt(k)), so the count in [a, b] is floor(sqrt(b)) minus floor(sqrt(a - 1)).

The density chart plots how many of every 100 naturals are perfect squares as you move up the number line. Near 100, about 10 out of 100 are squares (10%). Near 10,000, only about 1 in 100 (1%). Near a million, roughly 0.1%. The density shrinks to zero in every finite window, yet the bijection remains globally perfect.

The bijection: why the sets are the same size

The function f(n) = n-squared defines a bijection from the natural numbers N to the perfect squares S. It is injective: if f(a) = f(b) then a = b for positive integers. It is surjective: every perfect square m has a natural square root sqrt(m) that maps to it. Because f is both injective and surjective, |N| = |S| = aleph-null.

Importantly, S is a proper subset of N: every square is a natural, but not vice versa. Yet they have the same cardinality. This is actually the modern definition of an infinite set (Dedekind-infinite): a set is infinite if and only if it has the same cardinality as one of its own proper subsets.

Countable vs uncountable infinity

Galileo's paradox applies to many sets. Even numbers, odd numbers, integers, and rational numbers all share cardinality aleph-null and are called countably infinite. What cannot be done is listing all real numbers: Cantor's diagonal argument proves that any attempted pairing with naturals always misses some reals. The real numbers are uncountably infinite - a strictly larger infinity.

This hierarchy of infinities is one of the most surprising structures in mathematics. Galileo's observation about squares and naturals is the simplest entry point into it, which is why it still appears in every introductory set-theory course. The reference table below summarises the cardinality of common infinite sets.

Cardinality of common infinite sets

SetExamplesCardinalityBijection with N
Natural numbers (N)1, 2, 3, 4, ...Aleph-nullIdentity
Perfect squares (S)1, 4, 9, 16, ...Aleph-nullf(n) = n^2
Even numbers2, 4, 6, 8, ...Aleph-nullf(n) = 2n
Odd numbers1, 3, 5, 7, ...Aleph-nullf(n) = 2n - 1
Integers (Z)..., -2, -1, 0, 1, 2, ...Aleph-nullInterleave +/-
Rational numbers (Q)p/q fractionsAleph-nullCantor's diagonal
Real numbers (R)All decimalsUncountable (aleph-one)No bijection with N

All sets marked 'countably infinite' can be put in one-to-one correspondence with the natural numbers, confirming Galileo's paradox applies far beyond just squares.

Frequently asked questions

What is Galileo's paradox of infinity in simple terms?

Galileo noticed that every natural number (1, 2, 3, ...) can be paired with its square (1, 4, 9, ...) with nothing left over on either side, yet squares are a tiny fraction of all naturals. His paradox: how can two sets be 'the same size' when one is so much sparser? The modern answer is that for infinite sets, 'same size' means a perfect one-to-one pairing exists, not that the sets look equally dense.

What does bijection mean?

A bijection (or one-to-one correspondence) is a pairing between two sets where every element of each set is matched with exactly one element of the other. No element is left unpaired, and none is double-counted. The function f(n) = n-squared is a bijection from natural numbers to perfect squares: every natural n maps to the unique square n-squared, and every square m maps back to the unique root sqrt(m).

How does this calculator count perfect squares in a range?

The number of perfect squares from 1 to k is floor(sqrt(k)), because the squares are 1, 4, 9, ..., k-squared, and the largest square-root that fits is floor(sqrt(k)). So the count in a range [a, b] is floor(sqrt(b)) minus floor(sqrt(a - 1)). For example, in [10, 50]: floor(sqrt(50)) = 7 and floor(sqrt(9)) = 3, giving 7 - 3 = 4 squares (16, 25, 36, 49).

Why do squares become increasingly rare as numbers grow?

Because square roots grow much slower than the numbers themselves. Up to n there are only floor(sqrt(n)) perfect squares but n natural numbers. As n grows, the ratio floor(sqrt(n)) / n approaches zero, so squares become vanishingly sparse. Yet the bijection f(n) = n-squared still works globally: even at n = 1,000,000 there are exactly 1,000,000 naturals but only 1,000 squares in [1, 1,000,000], and each of those naturals still has a unique square partner somewhere on the number line.

What is aleph-null?

Aleph-null (written with the Hebrew letter aleph and subscript 0) is Georg Cantor's name for the cardinality of the natural numbers - the smallest infinite size. Any set that can be put in bijection with the natural numbers has cardinality aleph-null: the even numbers, the integers, the rationals, and the perfect squares all share this cardinality.

How did Cantor resolve Galileo's paradox?

Cantor defined two sets as having the same cardinality if and only if a bijection exists between them, regardless of subset relations or density. Under this definition, the paradox becomes a theorem rather than a contradiction: the natural numbers and the perfect squares have the same cardinality (aleph-null) precisely because the bijection f(n) = n-squared exists. What Galileo called irresolvable is, in Cantor's framework, the defining property of infinite sets.

Are there infinities larger than the natural numbers?

Yes. Cantor proved with his diagonal argument that the real numbers cannot be put in bijection with the natural numbers - there are too many reals for any list to capture. The cardinality of the reals is called aleph-one (or the cardinality of the continuum) and is strictly larger than aleph-null. Cantor showed there is an entire hierarchy of infinities, each strictly larger than the one before.

Sources

Written by Grace Mbeki, MSc Data Scientist & Educator · Nairobi, Kenya

Turning everyday numbers into clear, actionable answers for the decisions that matter most.

Search 3,500+ calculators

Loading search…