Tutorials › Measure Theory › Constructing the Cantor Function

Absolutely Continuous Functions and the Fundamental Theorem · Tutorial 663 of 798

Constructing the Cantor Function

Build the Cantor function by refining ternary intervals, and verify its continuity, monotonicity, endpoint values, and digit-based description.

Advanced 9 min read

What You'll Learn

  • Define the retained ternary intervals and their assigned dyadic ranges at each stage.
  • Construct continuous, nondecreasing piecewise-linear approximations to the Cantor function.
  • Prove the approximations converge uniformly and their limit is continuous.
  • Establish the limit's monotonicity and endpoint values.
  • Compute values on Cantor-set points and removed intervals using ternary and binary digits.
  • Identify why the approximations need not increase pointwise with the stage.

From Ternary Intervals to a Function

The Cantor set is built by repeatedly removing open middle thirds from \([0,1]\). The Cantor function is a continuous, nondecreasing function on that interval that is constant on each removed interval, while increasing across the remaining set. We construct it by assigning a range to every retained interval and linearly joining the assigned endpoint values. Refining the construction produces a uniformly convergent sequence of continuous functions.

For \(n\ge 0\), let \(C_n\) be the union of the intervals remaining after \(n\) removal steps, with \(C_0=[0,1]\). Thus \(C_1=[0,1/3]\cup[2/3,1]\), and each interval of \(C_n\) is split into its left and right thirds to form \(C_{n+1}\). Let \(C=\bigcap_{n=0}^{\infty} C_n\), the Cantor set. Each interval of \(C_n\) has a label \(w=(\varepsilon_1,\ldots,\varepsilon_n)\), where every \(\varepsilon_i\) is 0 or 1: at step \(i\), choose the left third if \(\varepsilon_i=0\) and the right third if \(\varepsilon_i=1\). Its left endpoint is \(\sum_{i=1}^n 2\varepsilon_i3^{-i}\), and its length is \(3^{-n}\).

Definition: For a word \(w=(\varepsilon_1,\ldots,\varepsilon_n)\), define its rank \(j(w)=\sum_{i=1}^n\varepsilon_i2^{n-i}\). On the retained interval labelled \(w\), define \(F_n\) to be the linear function taking the left endpoint to \(j(w)/2^n\) and the right endpoint to \((j(w)+1)/2^n\). On every open gap removed by step \(n\), define \(F_n\) to be constant at the common endpoint value of its two adjacent retained intervals. Set \(F_0(x)=x\) on \([0,1]\).

The endpoint assignments fit together: the retained intervals occur in increasing order of rank, and the range assigned to rank \(j\) is \([j/2^n,(j+1)/2^n]\). A gap between consecutive retained intervals therefore has the shared endpoint value between their assigned ranges. In particular, if a gap is removed at step \(k\), after a prefix \((\varepsilon_1,\ldots,\varepsilon_{k-1})\), its constant value is \(\sum_{i=1}^{k-1}\varepsilon_i2^{-i}+2^{-k}\). The empty prefix is used when \(k=1\).

Approximations and Their Limit

Each \(F_n\) is real-valued, continuous, and nondecreasing on \([0,1]\). On a retained interval it is linear with positive slope, and on a removed gap it is constant. The pieces join at the assigned endpoint values, which are ordered by the interval ranks; hence no downward jump occurs at any join. Also \(F_n(0)=0\) and \(F_n(1)=1\).

Theorem: The sequence \((F_n)_{n\ge 0}\) converges uniformly on \([0,1]\) to a continuous, nondecreasing function \(F:[0,1]\to[0,1]\). It satisfies \(F(0)=0\), \(F(1)=1\), and is constant on every interval removed in constructing \(C\).

Proof. Fix \(n\ge0\). On every gap already removed by step \(n\), \(F_n\) and \(F_{n+1}\) have the same constant value. On a retained interval of \(C_n\) labelled \(w\), both functions take values in \([j(w)/2^n,(j(w)+1)/2^n]\). For \(F_{n+1}\), this follows because the two child intervals and the newly removed middle third divide this assigned range into its lower half, midpoint, and upper half; for \(F_n\), it follows from its linear definition on the parent interval. The range has width \(2^{-n}\), so \[ \sup_{x\in[0,1]}|F_{n+1}(x)-F_n(x)|\le 2^{-n}. \] For integers \(q>p\), the triangle inequality gives \[ \sup_{x\in[0,1]}|F_q(x)-F_p(x)| \le\sum_{n=p}^{q-1}2^{-n} \le 2^{1-p}. \] The last bound tends to zero as \(p\to\infty\), independently of \(q>p\). Thus \((F_n)\) is uniformly Cauchy. Completeness of the real numbers gives a pointwise limit \(F\), and the same bound, followed by \(q\to\infty\), gives \(\sup_x|F(x)-F_p(x)|\le2^{1-p}\). Hence convergence is uniform.

To check continuity directly, let \(x_0\in[0,1]\) and let \(\varepsilon>0\). Choose \(p\) so that \(\sup_x|F(x)-F_p(x)|<\varepsilon/3\). Since \(F_p\) is continuous at \(x_0\), there is \(\delta>0\) such that \(|x-x_0|<\delta\) implies \(|F_p(x)-F_p(x_0)|<\varepsilon/3\). Therefore \[ |F(x)-F(x_0)| \le |F(x)-F_p(x)|+|F_p(x)-F_p(x_0)|+|F_p(x_0)-F(x_0)| <\varepsilon. \] This proves continuity, including at the endpoints with the relative metric on \([0,1]\).

If \(x\le y\), then \(F_n(x)\le F_n(y)\) for every \(n\). Taking limits gives \(F(x)\le F(y)\), so \(F\) is nondecreasing. The equalities \(F(0)=0\) and \(F(1)=1\) follow by taking limits of \(F_n(0)=0\) and \(F_n(1)=1\). Finally, any interval removed at a finite step remains in the same gap at every later stage, where all subsequent approximations have the same constant value. Their limit is constant there as well. \(\square\)

Computing Values from the Construction

Worked Example: The Second Approximation

Compute \(F_2\) on the retained intervals and gaps, then evaluate it at \(1/9\), \(1/6\), and \(1/3\).

The four retained intervals at stage 2 have ranks \(0,1,2,3\). Their endpoint values are respectively \(0\) to \(1/4\), \(1/4\) to \(1/2\), \(1/2\) to \(3/4\), and \(3/4\) to \(1\). Thus \(F_2\) is linear on \([0,1/9]\), \([2/9,1/3]\), \([2/3,7/9]\), and \([8/9,1]\). It is constant at \(1/4\) on \((1/9,2/9)\), at \(1/2\) on \((1/3,2/3)\), and at \(3/4\) on \((7/9,8/9)\).

On \([0,1/9]\), the line joins \((0,0)\) and \((1/9,1/4)\), so its slope is \((1/4)/(1/9)=9/4\), and \(F_2(x)=(9/4)x\). Hence \(F_2(1/9)=(9/4)(1/9)=1/4\). Since \(1/9<1/6<2/9\), the point \(1/6\) lies in the first removed gap and \(F_2(1/6)=1/4\). Since \(1/3\) is the right endpoint of the rank-1 interval, \(F_2(1/3)=1/2\). Check: the formulas on the intervals on either side of \(1/3\) give \(1/2\) at that endpoint, so the pieces agree there.

Proposition: If \(x\in C\) has a ternary expansion \(x=\sum_{i=1}^{\infty}2\varepsilon_i3^{-i}\), where each \(\varepsilon_i\in\{0,1\}\), then \[ F(x)=\sum_{i=1}^{\infty}\varepsilon_i2^{-i}. \] If \(x\) lies in a gap first removed at step \(k\), after the prefix \((\varepsilon_1,\ldots,\varepsilon_{k-1})\), then \[ F(x)=\sum_{i=1}^{k-1}\varepsilon_i2^{-i}+2^{-k}. \]

Proof. First let \(x\in C\) have the stated ternary expansion. For each \(n\), \(x\) belongs to the retained interval labelled by its first \(n\) digits. Write \(j_n=\sum_{i=1}^n\varepsilon_i2^{n-i}\). By construction, \(F_n(x)\) lies in \([j_n/2^n,(j_n+1)/2^n]\). For every \(m\ge n\), \(F_m(x)\) lies in that same range, since later refinements stay within the parent interval's assigned range. Thus its limit \(F(x)\) lies in that range. The binary series in the statement also lies there: its first \(n\) terms sum to \(j_n/2^n\), and its remaining terms lie between zero and \(\sum_{i>n}2^{-i}=2^{-n}\). Both values are therefore in an interval of length \(2^{-n}\), for every \(n\). Their difference is at most \(2^{-n}\) for every \(n\), so it is zero.

Now suppose \(x\) lies in a gap first removed at step \(k\). All later approximations are constant on that gap at its assigned midpoint value. The prefix selects a parent interval whose assigned range has width \(2^{-(k-1)}\). Its midpoint is the prefix's binary value plus half that width, namely \(\sum_{i=1}^{k-1}\varepsilon_i2^{-i}+2^{-k}\). Taking the limit gives the claimed value. \(\square\)

Worked Example: A Cantor-Set Point from Its Digits

Compute \(F(1/4)\) using ternary and binary expansions, and verify that the ternary expansion represents a point of \(C\).

The repeating ternary expansion \(0.020202\ldots_3\) has value \[ \sum_{r=1}^{\infty}2\cdot3^{-2r} =\frac{2/9}{1-1/9} =\frac{2/9}{8/9} =\frac14. \] Every digit is 0 or 2, so its point lies in every retained stage and hence in \(C\). The corresponding binary digits are \(0.010101\ldots_2\), with value \[ \sum_{r=1}^{\infty}2^{-2r} =\frac{1/4}{1-1/4} =\frac{1/4}{3/4} =\frac13. \] The proposition gives \(F(1/4)=1/3\). Check: the first \(n\) ternary digits place \(1/4\) in the retained interval labelled by the alternating word \(0101\ldots\); the corresponding binary prefix intervals shrink to the binary value \(1/3\), as the proposition requires.

Worked Example: A Value on a Removed Interval

Find the value of \(F\) at \(x=5/6\).

The interval \((7/9,8/9)\) is removed at step 2: it is the middle third of the retained interval \([2/3,1]\), whose prefix is the first-step choice \(\varepsilon_1=1\). The gap formula gives \[ F(5/6)=\varepsilon_1 2^{-1}+2^{-2} =\frac12+\frac14 =\frac34. \] Membership is strict: \(7/9<5/6<8/9\), since \(7/9=42/54\), \(5/6=45/54\), and \(8/9=48/54\). Thus \(5/6\) is in the open gap, not merely at an endpoint. Check: at stage 2 that gap has assigned value \(3/4\), and every later approximation keeps that value, so the limit also equals \(3/4\).

A Common Misreading of the Approximations

The approximations converge uniformly, but they need not increase pointwise as the stage number grows. For example, \(F_0(9/10)=9/10\). Since \(9/10\) lies in the right third, \(F_1(9/10)=\frac12+\frac12(3(9/10)-2)=\frac12+\frac12(7/10)=17/20\). Since \(17/20=0.85<0.9=9/10\), \(F_1(9/10)<F_0(9/10)\). It would therefore be incorrect to justify the limit by claiming \(F_n\uparrow F\). The valid argument is the uniform Cauchy estimate, which proves convergence without any monotonicity in \(n\).

The construction establishes the Cantor function's continuity, monotonicity, endpoint values, and digit-based values. These properties identify how the function is assembled from the ternary construction while leaving its finer differentiation properties for separate study.

Check Your Understanding

Use the interval assignments and the limit construction to answer the following.

  1. What are the assigned endpoint values on the stage-3 interval labelled \((1,0,1)\)?
  2. At what constant value does \(F\) take every point of the gap \((1/9,2/9)\)?
  3. Use a ternary expansion with digits 0 and 2 to compute \(F(1/3)\), taking care to specify an allowed expansion.
  4. Why does the estimate \(\sup_x|F_{n+1}(x)-F_n(x)|\le 2^{-n}\) prove uniform convergence even though the approximations need not be increasing?
  5. For a gap first removed at step \(k\), explain why its assigned value is the midpoint of the binary range belonging to its parent interval.