
Inmathematics, theCantor function is an example of afunction that iscontinuous, but notabsolutely continuous. It is a notoriouscounterexample in analysis, because it challenges naive intuitions about continuity,derivative, andmeasure. Although it is continuous everywhere, and has zero derivativealmost everywhere, its value still goes from 0 to 1 as its argument goes from 0 to 1. Thus, while the function seems like a constant one that cannot grow, it does indeedmonotonically grow.
It is also called theCantor ternary function, theLebesgue function,[1]Lebesgue's singular function, theCantor–Vitali function, theDevil's staircase,[2] theCantor staircase function,[3] and theCantor–Lebesgue function.[4]Georg Cantor (1884) introduced the Cantor function and mentioned that Scheeffer pointed out that it was acounterexample to an extension of thefundamental theorem of calculus claimed byHarnack. The Cantor function was discussed and popularized byScheeffer (1884),Lebesgue (1904), andVitali (1905).

To define the Cantor function, let be any number in and obtain by the following steps:
For example:
Equivalently, letting be theCantor set on [0,1], the Cantor function can be defined as
This formula is well-defined, since every member of the Cantor set has aunique base 3 representation that only contains the digits 0 or 2. (For some members of, the ternary expansion is repeating with trailing 2's and there is an alternative non-repeating expansion ending in 1. For example, = 0.13 = 0.02222...3 is a member of the Cantor set). Since and, and is monotonic on, it is clear that also holds for all.
The Cantor function challenges naive intuitions aboutcontinuity andmeasure; though it is continuous everywhere and has zero derivativealmost 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 isuniformly continuous (precisely, it isHölder continuous of exponent) but notabsolutely 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 noderivative at any point in anuncountable subset of theCantor set containing the interval endpoints described above.
The Cantor function can also be seen as thecumulative probability distribution function of the 1/2-1/2Bernoulli measureμ supported on the Cantor set:. This probability distribution, called theCantor distribution, has no discrete part. That is, the corresponding measure isatomless. 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 aprobability density function; integrating any putativeprobability density function that is notalmost everywhere zero over any interval will give positive probability to some interval to which this distribution assigns probability zero. In particular, asVitali (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 asingular function.
The Cantor function is also a standard example of a function withbounded variation but, as mentioned above, is not absolutely continuous. However, every absolutely continuous function is continuous with bounded variation.
The Cantor function is non-decreasing, and so in particular its graph defines arectifiable curve.Scheeffer (1884) showed that the arc length of its graph is 2. Note that the graph of any nondecreasing function such that and has length not greater than 2. In this sense, the Cantor function is extremal.
The property of the graph being a rectifiable curve is not to be confused with the property of being a1-rectifiable set. Letting for, the graph can be decomposed into the purely 1-unrectifiable set and 1-rectifiable set, both of which have a 1-dimensionalHausdorff measure equal to. The fact that is purely 1-unrectifiable follows from theBesicovitch-Federer projection theorem.
TheLebesgue measure of theCantor set is 0. Therefore, for any positiveε < 1 and anyδ > 0, there exists a finite sequence ofpairwise disjoint sub-intervals with total length < δ over which the Cantor function cumulatively rises more than ε.
In fact, for everyδ > 0 there are finitely many pairwise disjoint intervals (xk,yk) (1 ≤ k ≤ M) with and.

Below we define a sequence of functions on the unit interval that converges to the Cantor function.
Let.
Then, for every integer, the next function will be defined in terms of as follows:The three definitions are compatible at the end-points and, because and for every, by induction. One may check that converges pointwise to the Cantor function defined above. Furthermore, the convergence is uniform. Indeed, separating into three cases, according to the definition of, one sees that
If denotes the limit function, it follows that, for every,
The Cantor function is closely related to theCantor set. The Cantor setC can be defined as the set of those numbers in the interval [0, 1] that do not contain the digit 1 in theirbase-3 (triadic) expansion, except if the 1 is followed by zeros only (in which case the tail 1000 can be replaced by 0222 to get rid of any 1). It turns out that the Cantor set is afractal with (uncountably) infinitely many points (zero-dimensional volume), but zero length (one-dimensional volume). Only theD-dimensional volume (in the sense of aHausdorff-measure) takes a finite positive value, where is the fractal dimension ofC. We may define the Cantor function alternatively as theD-dimensional volume of sections of the Cantor set
The Cantor function possesses severalsymmetries. For, there is a reflection symmetry
and a pair of magnifications, one on the left and one on the right:
and
The magnifications can be cascaded; they generate thedyadic monoid. This is exhibited by defining several helper functions. Define the reflection as
The first self-symmetry can be expressed as
where the symbol denotes function composition. That is, and likewise for the other cases. For the left and right magnifications, write the left-mappings
Then the Cantor function obeys
Similarly, define the right mappings as
Then, likewise,
The two sides can be mirrored one onto the other, in that
and likewise,
These operations can be stacked arbitrarily. Consider, for example, the sequence of left-right moves Adding the subscripts C and D, and, for clarity, dropping the composition operator in all but a few places, one has:
Arbitrary finite-length strings in the letters L and R correspond to thedyadic rationals, in that every dyadic rational can be written as both for integern andm and as finite length of bits with Thus, every dyadic rational is in one-to-one correspondence with some self-symmetry of the Cantor function.
Some notational rearrangements can make the above slightly easier to express. Let and stand for L and R. Function composition extends this to amonoid, in that one can write and generally, for some binary strings of digitsA,B, whereAB is just the ordinaryconcatenation of such strings. The dyadic monoidM is then the monoid of all such finite-length left-right moves. Writing as a general element of the monoid, there is a corresponding self-symmetry of the Cantor function:
The dyadic monoid itself has several interesting properties. It can be viewed as a finite number of left-right moves down an infinitebinary tree; the infinitely distant "leaves" on the tree correspond to the points on the Cantor set, and so, the monoid also represents the self-symmetries of the Cantor set. In fact, a large class of commonly occurring fractals are described by the dyadic monoid; additional examples can be found in the article onde Rham curves. Other fractals possessing self-similarity are described with other kinds of monoids. The dyadic monoid is itself a sub-monoid of themodular group
Note that the Cantor function bears more than a passing resemblance toMinkowski's question-mark function. In particular, it obeys analogous symmetry relations, with only a slightly altered form.
Let
be thedyadic (binary) expansion of the real number 0 ≤y ≤ 1 in terms of binary digitsbk ∈ {0,1}. This expansion is discussed in greater detail in the article on thedyadic transformation. Then consider the function
Forz = 1/3, the inverse of the functionx = 2 C1/3(y) is the Cantor function. That is,y = y(x) is the Cantor function. In general, for anyz < 1/2,Cz(y) looks like the Cantor function turned on its side, with the width of the steps getting wider asz approaches zero.
As mentioned above, the Cantor function is also the cumulative distribution function of a measure on the Cantor set. Different Cantor functions, or Devil's Staircases, can be obtained by considering different atom-less probability measures supported on the Cantor set or other fractals. While the Cantor function has derivative 0 almost everywhere, current research focuses on the question of the size of the set of points where the upper right derivative is distinct from the lower right derivative, causing the derivative to not exist. This analysis of differentiability is usually given in terms offractal dimension, with the Hausdorff dimension the most popular choice. This line of research was started in the 1990s by Darst,[5] who showed that the Hausdorff dimension of the set of non-differentiability of the Cantor function is the square of the dimension of the Cantor set,. SubsequentlyFalconer[6] showed that this squaring relationship holds for all Ahlfors's regular, singular measures, i.e.Later, Troscheit[7] obtain a more comprehensive picture of the set where the derivative does not exist for more general normalized Gibb's measures supported on self-conformal andself-similar sets.
Hermann Minkowski'squestion mark function loosely resembles the Cantor function visually, appearing as a "smoothed out" form of the latter; it can be constructed by passing from a continued fraction expansion to a binary expansion, just as the Cantor function can be constructed by passing from a ternary expansion to a binary expansion. The question mark function has the interesting property of having vanishing derivatives at all rational numbers.