Constructions of  Cantor Sets

Steven R. Dunbar
Department of Mathematics and Statistics
University of Nebraska-Lincoln

David Fowler
Department of Curriculum and Instruction
University of Nebraska-Lincoln

© Copyright  Steven R. Dunbar, David Fowler, 1992, All rights reserved.  T

Before Starting

SetDirectory["mma"]

Get["CantorSet.ma"]

Terminology:

You will need to have an understanding of the following terms to use this Notebook and solve the problems: closed set, open set, isolated point, limit point, connected interval,  infinite series, cardinality, one-to-one correspondence

Excluded Portions Construction of the Cantor Set

The traditional Cantor set is defined by removing or excluding successive open middle thirds from a sequence of closed intervals.  Starting from the interval I1 = [0,1], the middle third (1/3,2/3) is removed, leaving the union of closed intervals 
I2 = [0,1/3] ⋃[2/3,1].  From the intervals in I2, the middle thirds (1/9,2/9) and (7/9,8/9) respectively are removed, and so on.  The Cantor set is then defined as the intersection of all the intervals:
	         ∞
	C =   ⋂     In.
	        n=1

intervals[1]

intervals[2]

Table[ intervals[n], {n,4}] // MatrixForm

showIntervals[5]

This definition can be generalized by allowing arbitrary intervals [a,b].  A further generalization is to consider retaining a fraction r1 on the left of each interval and a fraction r2 on the right of each interval for r1+r2 < 1.  This removes a portion 1-r1-r2 of each interval. Thus 
	I1 = [a,b] 
	I2 = [a, a +r1(b-a)] ⋃[b-r2(b-a), b].
The subintervals comprising  In are called complementary intervals.
 The intersection of all  sets so created is a Cantor set.  The generalized Cantor set is denoted C(a,b,r1,r2).  The traditional Cantor set is  C = C(0,1,1/3,1/3).

cantorSet[{0,2}, 1/4,1/4,1]

cantorSet[{0,2}, 1/4, 1/4, 2]

Table[ cantorSet[{0,2}, 1/4, 1/4, n], {n,4}] // MatrixForm

showCantorSet[{{0,2}}, 1/4, 1/4, 5]

For comparison, here are the stages of approximation on the way to a somewhat  ``fatter'' Cantor set.  We will make the notion of  ``fatter'' mathematically precise later.

showCantorSet[{{0,2}}, 1/2.5, 1/2.5, 5]

Number-Base Constructions of  Cantor Sets

The construction of the Cantor set C above is a set-theoretic or geometrical construction. There are other ways to characterize the Cantor set.   Just as every real number in [0,1]  has a decimal  or base-10 expansion x = 0.d1d2d3... = d1/10 + d2/102 + d3/103 + ... so too every number in [0,1] can be written in a ternary or base-three expansion,  x = 0.t1t2t3...
= t1/3 + t2/32 + t3/33 + ...
These defintions contain a slight ambiguity since a given number may have two expansions, for instance 1/2 = 0.510 and 0.499999...10.  When necessary to eliminate ambiguity, we always choose the non-trivial  infinite series expansion over the terminating or finite series representation.

BaseForm[1/3,3]
BaseForm[N[1/3],3]
BaseForm[2/3,3]
BaseForm[1/9,3]
BaseForm[N[1/9],3]

The Cantor set C can be characterized as the set of real numbers in [0,1] which do not contain a 1 in their ternary expansion.  This follows from the traditional set-theoretic definition by noting that all expansions with no 1 in the first location (remember the convention about terminating and non-terminating expansions) must be in the interval  I2 = [0,1/3] ⋃[2/3,1], those with no 1 in the first or second location must be in the intervals obtained by removing the middle third from these intervals and so on.   As we have seen in a pervious Notebook, this is Cantor's original definition of his set.

Generalized Cantor sets may sometimes be  characterized by number-base expansions, particularly if r1 and r2 are rational numbers.

cantorSet[{0,1}, 1/4, 1/4, 3]

BaseForm[N[%],4]

When converted to non-terminating base-4 expansions, this set would have no digits 1 or 2.  This should be clear from the definition of excluding the middle one-half at each stage.

Iterated-Function-System Constructions of Cantor Sets

Another way of constructing the Cantor set is by means of an Iterated Function System, or IFS for short.  We give an example of an IFS for the classical Cantor set C here in both the deterministic and random forms and discuss the theory in another section.

An IFS for the Cantor set is specified by giving a set A of subintervals of  [0,1].  A set of 2 linear affine mappings w1(x) = x/3, and w2(x) = x/3 + 2/3 is given.  Each mapping is applied to the each subinterval in A, and the union of all images produces a new set, say W(A).  The process is repeated on W(A), giving W(W(A)), and so on.  The resulting sequence of sets converges in a sense to be made precise later to the Cantor set C.

i0 = {{0,1}}  (* A list of intervals, here 1 interval *)

affinemaps = {{0,1/3},{2/3, 1/3}}
(* Affine maps 0 + (1/3)x and 2/3 + (1/3)x  *)

mapUnion[i0,affinemaps]

mapUnion[%, affinemaps]

NestList[mapUnion[#, affinemaps] &, i0, 4] //MatrixForm

Another way to generate the Cantor set C with an IFS is to use the random iteration algorithm. Again we use the set of 2 linear mappings w1(x) = x/3, and w2(x) = x/3 + 2/3.  One of the  mappings is chosen at random and applied a point  x in the interval [0,1] producing a new point  wi(x), where i is one of 1 or 2.  This random procedure is reapplied to the point wi(x) and so on.  This is called the chaos game or random iteration algorithm.  Excluding the first, say, 10 or so transient points, the resulting collection converges to the Cantor set C in a sense to be made precise later.

chaosGame[x_] :=
	{#/3 &, #/3 +2/3 &}[[Random[Integer,{1,2}]]][x]

chaosGame[1/3]

NestList[chaosGame, 1/3, 40]

The Cantor set is rather ``thin'' and ``small'' as the pictures above suggest.  This will be made precise later.  This makes graphical determination of whether a point set is close to C difficult.  Rather than examining the results of the chaosGame iteration graphically, it is easier to look at the base-three expansion of the points.

BaseForm[N[%], 3]

Note that except for the first few elements, the elements are ``close '' to having only 0's and 2's in the expansion.

Basic Exercises

Are the endpoints of the subintervals comprising In contained in C(a,b,r1,r2)?  Explain why or why not.

Is C(a,b,r1,r2) always a closed set?  Cite a reason why or provide a counterexample.

Find the base-3 expansion of  2/9, 4/9, 5/9, 7/9, 8/9, 1/2, and 1/4.

BaseForm[ N[1/4, 20], 3]

BaseForm[N[1/2,20], 3]

Explain why 1/3 is in the Cantor set even though its ternary expansion (as shown above) has a 1 in the first digit.

Apply the IFS method to the sets {{0,1/3}}, {{0,1/4},{3/4,1}} ,{{1/3,2/3}} and the set consisting of a single point {{1/2,1/2}}. Plot the results.   Do they appear to converge to the Cantor set?

Try the chaosGame  iteration on x = 1/5 as above.  Except for the first few transients, do the results seem to converge to the Cantor Set C?  Do the number of transient points seem to depend on the starting value?

Try For Yourself

Show that the Cantor set C has no isolated points.

Show that the Cantor set C contains no intervals.

Show that the point x = 1/4 is  a point in the Cantor set, but it is not an endpoint of a complementary interval.

Show that an endpoint of intervals is a limit point of endpoints.

Show that for any two distinct points a, b of C, there exist disjoint closed sets A, B with a∈Α and b∈B, and A⋃Β = C.

Show that there is a one-to-one correspondence between the real numbers and the elements of the Cantor set.

Find a set of 3 and a set of 4 affine mappings whose IFS or map union generates the traditional Cantor set C.

Find a characterization of the set of all points in [0,1] whose decimal expansions contains only the digits 4 and 7.

References

Information on the traditional Cantor set can be found in many places.  Two readily available sources are
Principles of  Mathematical  Analysis,3rd edition, Walter Rudin, McGraw-Hill, New York, 1976
and
A Primer of Real Functions, Carus Mathematical Monographs 13, R. P. Boas, Mathematical Association of America, Washington, 1981.

The idea for the generalized Cantor sets comes from ``An Interesting Cantor Set'', W. A. Coppel, Amer. Math. Monthly, Volume 90, number 7, August-September 1983, pp.456-461.

The notion of an iterated function system and the chaos game are explained and elaborated in 
Fractals Everywhere,  Michael Barnsley, Academic Press, NewYork, 1988.

The ideas for the Mathematica code, and the displays of the construction of the Cantor sets are adapted from
Mathematica in Action, Stan Wagon, W. H. Freeman, New York, 1991