# Cantor function

The is a canonical example of a singular function. It is based on the Cantor set  , and is usually defined as follows. Let $x$ be a real number in $[0,1]$ with the ternary expansion $0.a_{1}a_{2}a_{3}\ldots$, then let $N$ be $\infty$ if no $a_{n}=1$ and otherwise let $N$ be the smallest value such that $a_{n}=1$. Next let $b_{n}=\frac{1}{2}a_{n}$ for all $n and let $b_{N}=1$. We define the Cantor function (or the Cantor ternary function) as

 $f(x)=\sum_{n=1}^{N}\frac{b_{n}}{2^{n}}.$

This function can be easily checked to be continuous   and monotonic on $[0,1]$ and also $f^{\prime}(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 formula  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 pathological  oddity.

## References

• 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