Cantor Set Generator
Generate and visualize the classic Cantor Set fractal by recursively removing the middle third of line segments with custom sizing.
What is the Cantor Set?
The Cantor Set (first introduced by the German mathematician Georg Cantor in 1883) is one of the most fundamental, famous, and mathematically significant constructions in modern set theory and topology. It is constructed by taking a solid unit interval and recursively removing the open middle third of every remaining line segment.
Despite its simple geometric definition, the Cantor Set possesses mind-bending properties: it is a set of points that is completely dust-like (nowhere dense), contains infinitely many points, has a total length (measure) of exactly zero, yet has the exact same cardinality (number of points) as the entire continuous real line!
Mathematical Formulation
In the classic Cantor Ternary Set construction at each level $n$:
- Every solid line segment is split, creating $N = 2$ new segments.
- The middle third is removed, meaning each new segment is scaled down by a factor of $S = \frac{1}{3}$.
To compute the Hausdorff fractal dimension $D$ of the Cantor Ternary Set: $$D = \frac{\ln(N)}{\ln(1/S)} = \frac{\ln(2)}{\ln(3)} \approx 0.6309$$
Having a dimension of approximately $0.6309$ indicates that the Cantor Set is more complex than a discrete set of isolated points ($D = 0$), but is much simpler than a continuous one-dimensional line ($D = 1.0$).
Generalized and Asymmetric Cantor Sets
Our tool goes beyond the classic standard Cantor Set, allowing you to explore generalized and asymmetric Cantor sets:
- Asymmetric Cantor Set: What if we keep $40\%$ of the segment on the left and only $20\%$ on the right, removing the middle $40\%$? Our sliders let you customize the left and right kept proportions to visually explore asymmetric Cantor dusts.
- Generalized Cantor Set: By adjusting the spacing, order, and ratios, you can construct custom Cantor dusts with any specific dimensions.
- Color Gradients: Color each row sequentially with beautiful custom two-color gradients, solid colors, or rainbow spectrums.
- Asset Export: Download high-resolution PNGs, scale-free vector SVGs, or copy the computed raw segments coordinate arrays as JSON.
Frequently Asked Questions
How can the Cantor Set have a total length of zero?
If we start with a line segment of length $1$, at each step we remove the middle third of every segment. The total length of the removed portions at iteration $n$ is: $$\sum_{k=1}^{\infty} \frac{2^{k-1}}{3^k} = \frac{1}{3} \cdot \sum_{k=1}^{\infty} \left(\frac{2}{3}\right)^{k-1} = \frac{1}{3} \cdot \frac{1}{1 - 2/3} = 1.0$$ Since the sum of the lengths of all removed intervals is exactly equal to $1.0$, the remaining set of points must have a total length (Lebesgue measure) of exactly $0$.
What does it mean for the Cantor Set to be "nowhere dense"?
In topology, a set is nowhere dense if its closure has an empty interior. For the Cantor Set, this means that no matter how much you zoom in on any portion of the Cantor Set, you will always find infinite empty "gaps" containing no Cantor points at all. It is completely disconnected and dust-like.
How many points are in the Cantor Set?
Remarkably, the Cantor Set contains an uncountable number of points, having the same cardinality as the continuum ($\aleph_1$). This can be proved by representing every number in the interval $[0, 1]$ in base-3 (ternary). The numbers that remain in the Cantor Set are precisely those that can be written using only the digits $0$ and $2$ (no $1$s), which maps bijectively to the binary representation of all real numbers in $[0, 1]$.
Related tools
Your recent visits