In mathematics, the Cantor function is an example of a function that is continuous, but not absolutely continuous. It is a notorious counterexample in analysis, because it challenges naive intuitions about continuity, derivative, and measure. Though it is continuous everywhere and has zero derivative almost everywhere, its value still goes from 0 to 1 as its argument reaches from 0 to 1. Thus, in one sense the function seems very much like a constant one which cannot grow, and in another, it does indeed monotonically grow.
It is also called 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. 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. The Cantor function was discussed and popularized by , and .
To define the Cantor function , let be any number in and obtain by the following steps:
Express in base 3.
If the base-3 representation of contains a 1, replace every digit strictly after the first 1 by 0.
Replace any remaining 2s with 1s.
Interpret the result as a binary number. The result is .
For example:
has the ternary representation 0.02020202... There are no 1s so the next stage is still 0.02020202... This is rewritten as 0.01010101... This is the binary representation of , so .
has the ternary representation 0.01210121... The digits after the first 1 are replaced by 0s to produce 0.01000000... This is not rewritten since it has no 2s. This is the binary representation of , so .
has the ternary representation 0.21102 (or 0.211012222...). The digits after the first 1 are replaced by 0s to produce 0.21. This is rewritten as 0.11. This is the binary representation of , so .
Equivalently, if is the Cantor set on [0,1], then the Cantor function can be defined as
This formula is well-defined, since every member of the Cantor set has a unique base 3 representation that only contains the digits 0 or 2.