Galileo's Paradox of Infinity Calculator

Enter an upper bound N and a specific natural number n to explore Galileo's Paradox: count the perfect squares up to N, see their shrinking density, and view the exact bijection n ↔ n² that pairs every natural number with a unique square.

Quick Facts

The bijection
f(n) = n²
Pairs every natural number with exactly one perfect square, and vice versa.
Squares up to N
⌊√N⌋
Count of perfect squares in the range 1 to N.
Density as N grows
√N / N = 1/√N → 0
Squares get rarer in any finite range, even though the full sets are equinumerous.
Cardinality
ℵ₀ (aleph-null)
Both ℕ and the perfect squares are countably infinite — same "size" by Cantor's definition.

Your Results

Calculated
Perfect squares from 1 to N
-
Count = ⌊√N⌋
Density of squares in [1, N]
-
⌊√N⌋ ÷ N, as a percentage
Bijection pair for n
-
n ↔ n² correspondence
Paradox interpretation
-
Density vs. cardinality

Ready

Enter an upper bound N and a number n, then press Calculate.

How Galileo's Paradox of Infinity Works

In his 1638 book Two New Sciences, Galileo Galilei noticed something strange about infinite sets. Every natural number n has exactly one perfect square, n², and every perfect square has exactly one square root. That means the map f(n) = n² pairs each natural number with a unique perfect square, and no square is ever left unpaired — a perfect one-to-one correspondence (a bijection). Yet, if you look at any finite stretch of numbers, like 1 to 100, the perfect squares (1, 4, 9, 16, ..., 100) are clearly a small minority — only 10 out of 100. So are there "more" natural numbers than squares, or exactly as many? Galileo's answer was that the ideas of "more," "fewer," and "equal" simply do not carry over from finite sets to infinite ones the way intuition suggests. This calculator lets you explore both sides of the paradox at once: the shrinking density of squares in a finite range, and the exact bijection that pairs every number with its square.

The two formulas behind the paradox

Given an upper bound N, the count of perfect squares in the range 1 to N is ⌊√N⌋ (the greatest integer whose square does not exceed N) — for example, ⌊√100⌋ = 10, since 10² = 100 and 11² = 121 overshoots. The density of squares in that range is that count divided by N, or ⌊√N⌋ / N ≈ 1/√N, which shrinks toward 0 as N grows — at N = 10,000 only about 1% of the numbers are perfect squares, and at N = 1,000,000 only about 0.1% are. At the same time, the bijection n ↔ n² never breaks down: for any n you pick, there is exactly one square n² waiting for it, no matter how large n gets. This calculator computes both the density for your chosen N and the specific pair (n, n²) for your chosen n.

Why it looks like a paradox — and how it's resolved

The apparent contradiction is between two different ways of comparing sets: subset comparison ("a proper subset should be smaller") and bijection comparison ("if every element can be uniquely paired, the sets are the same size"). For finite sets these two methods always agree, so we never notice a conflict. Georg Cantor's 19th-century set theory resolved the paradox by making bijection the actual mathematical definition of "same cardinality" (size). Under that definition, the natural numbers and the perfect squares both have cardinality ℵ₀ (aleph-null, "countably infinite") — even though the squares are a proper subset of the naturals. In fact, mathematicians now define an infinite set as precisely one that can be put into bijection with a proper subset of itself; finite sets can never do this. Galileo's puzzle wasn't a flaw in the math — it was an early, accurate observation of exactly how infinite sets behave, two centuries before Cantor gave it a rigorous foundation.

Frequently Asked Questions

What is Galileo's Paradox of Infinity?
In Two New Sciences (1638), Galileo observed that every natural number n can be paired with exactly one perfect square n² via the map n → n², and every perfect square has exactly one square root, so the two sets can be put into a perfect one-to-one correspondence. Yet perfect squares are only a small, thinning-out subset of the natural numbers. Galileo concluded that "less than," "equal to," and "greater than" do not work the same way for infinite sets as they do for finite ones.
How is the paradox resolved mathematically today?
Georg Cantor's set theory resolved it by defining the size (cardinality) of a set through the existence of a bijection rather than through subset comparison. Because n ↔ n² is a bijection between the natural numbers and the perfect squares, both sets have the same cardinality, ℵ₀ (aleph-null, countably infinite), even though the squares form a proper subset of the naturals. A set that can be placed in bijection with a proper subset of itself is, by definition, infinite.
Why does the density of squares still shrink toward zero?
Density and cardinality measure different things. Among the integers from 1 to N there are exactly ⌊√N⌋ perfect squares, so the fraction √N/N = 1/√N shrinks toward 0 as N grows, meaning squares become vanishingly rare in any finite range. That thinning is a statement about finite ranges only; the full, infinite set of perfect squares is still matched one-to-one with all natural numbers by n ↔ n².
How does Hilbert's Hotel relate to Galileo's paradox?
David Hilbert's Infinite Hotel thought experiment, where a fully booked hotel with infinitely many rooms can still make room for more guests by shifting each guest from room n to room n+1, illustrates the same principle Galileo noticed: an infinite set can be placed in bijection with a proper subset of itself, which modern mathematics uses as the defining property of an infinite (Dedekind-infinite) set.