In mathematics, the Cantor function is an example of a function that is continuous, but not absolutely continuous. It is also referred to as the Cantor ternary function, the Lebesgue function, Lebesgue’s singular function, the Cantor-Vitali function, the Devil’s staircase, the Cantor staircase function, and the Cantor-Lebesgue function. Georg Cantor introduced the Cantor function and mentioned that Scheeffer pointed out that it was a counterexample to an extension of the fundamental theorem of calculus claimed by Harnack.
To formally define the Cantor function c : [0,1] → [0,1], let x be in [0,1] and obtain c(x) by the following steps:
- Express x in base 3.
- If x contains a 1, replace every digit after the first 1 by 0.
- Replace all 2s with 1s.
- Interpret the result as a binary number. The result is c(x).
- 1/4 becomes 0.02020202… in base 3. There are no 1s so the next stage is still 0.02020202… This is rewritten as 0.01010101… When read in base 2, this corresponds to 1/3 in base 10, so c(1/4) = 1/3.
- 1/5 becomes 0.01210121… in base 3. The digits after the first 1 are replaced by 0s to produce 0.01000000… This is not rewritten since there are no 2s. When read in base 2, this corresponds to 1/4 in base 10, so c(1/5) = 1/4.
- 200/243 becomes 0.21102 (or 0.211012222…) in base 3. The digits after the first 1 are replaced by 0s to produce 0.21. This is rewritten as 0.11. When read in base 2, this corresponds to 3/4 in base 10, so c(200/243) = 3/4.
The Cantor function challenges naive intuitions about continuity and measure; though it is continuous everywhere and has zero derivative almost everywhere, goes from 0 to 1 as goes from 0 to 1, and takes on every value in between. The Cantor function is the most frequently cited example of a real function that is uniformly continuous (precisely, it is Hölder continuous of exponent α = log 2/log 3) but not absolutely continuous. It is constant on intervals of the form (0.x1x2x3…xn022222…, 0.x1x2x3…xn200000…), and every point not in the Cantor set is in one of these intervals, so its derivative is 0 outside of the Cantor set. On the other hand, it has no derivative at any point in an uncountable subset of the Cantor set containing the interval endpoints described above.
The Cantor function can also be seen as the cumulative probability distribution function of the 1/2-1/2 Bernoulli measure μ supported on the Cantor set: . This distribution, called the Cantor distribution, has no discrete part. That is, the corresponding measure is atomless. This is why there are no jump discontinuities in the function; any such jump would correspond to an atom in the measure.
However, no non-constant part of the Cantor function can be represented as an integral of a probability density function; integrating any putative probability density function that is not almost everywhere zero over any interval will give positive probability to some interval to which this distribution assigns probability zero. In particular, as Vitali (1905) pointed out, the function is not the integral of its derivative even though the derivative exists almost everywhere.
The Cantor function is the standard example of a singular function.