Cantor function

The Cantor functionMathworldPlanetmath is a canonical example of a singular function. It is based on the Cantor setMathworldPlanetmath, and is usually defined as follows. Let x be a real number in [0,1] with the ternary expansion 0.a1a2a3, then let N be if no an=1 and otherwise let N be the smallest value such that an=1. Next let bn=12an for all n<N and let bN=1. We define the Cantor function (or the Cantor ternary function) as


This function can be easily checked to be continuousMathworldPlanetmathPlanetmath and monotonic on [0,1] and also f(x)=0 almost everywhere (it is constant on the complement of the Cantor set), with f(0)=0 and f(1)=1. Another interesting fact about this function is that the arclength of the graph is 2, hence the calculus arclength formulaMathworldPlanetmath does not work in this case.

Figure 1: Graph of the cantor function using 20 iterations.

This function, and functions similar to it are frequently called the Devil’s staircase. Such functions sometimes occur naturally in various areas of mathematics and mathematical physics and are not just a pathologicalMathworldPlanetmath oddity.


  • 1 H. L. Royden. . Prentice-Hall, Englewood Cliffs, New Jersey, 1988
Title Cantor function
Canonical name CantorFunction
Date of creation 2013-03-22 14:08:23
Last modified on 2013-03-22 14:08:23
Owner jirka (4157)
Last modified by jirka (4157)
Numerical id 9
Author jirka (4157)
Entry type Definition
Classification msc 26A30
Synonym Cantor ternary function
Synonym Cantor-Lebesgue function
Synonym Devil’s staircase
Related topic CantorSet
Related topic SingularFunction
Defines Cantor function
Defines Cantor ternary function