{
  "id": "cantor-function",
  "title": "Cantor Function",
  "lang": "en",
  "source_lang": "en",
  "summary": "The Cantor function is a continuous, nondecreasing function that rises from zero to one while having derivative zero almost everywhere.",
  "category": "mathematics",
  "subcategory": "analysis",
  "type": "concept",
  "aliases": [
    "Cantor–Lebesgue function",
    "Devil’s staircase",
    "Cantor staircase"
  ],
  "generated_at": "2026-11-06",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/cantor-function/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/cantor-function/",
      "json": "https://aiwiki.page/zh/cantor-function.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "The Cantor function is a continuous function \\(F:[0,1]\\to[0,1]\\) that is nondecreasing, satisfies \\(F(0)=0\\) and \\(F(1)=1\\), and has derivative zero almost everywhere. Its increase is concentrated on the middle-thirds Cantor set, a set of Lebesgue measure zero. Named after Georg Cantor, it is a central example in mathematical analysis showing that continuity and monotonicity do not suffice to recover a function by integrating its derivative."
    },
    {
      "heading": "Construction from the Cantor set",
      "text": "Let \\(C\\) be the middle-thirds Cantor set, obtained by repeatedly removing the open middle third of each remaining interval in \\([0,1]\\). A point belongs to \\(C\\) exactly when it has a ternary expansion using only the digits \\(0\\) and \\(2\\).\n\nFor \\(x\\in C\\), choose such an expansion:\n\n\\[x=\\sum_{n=1}^{\\infty}\\frac{a_n}{3^n}, \\qquad a_n\\in\\{0,2\\}.\\]\n\nDefine\n\n\\[F(x)=\\sum_{n=1}^{\\infty}\\frac{a_n/2}{2^n}.\\]\n\nThus the construction replaces each ternary digit \\(0\\) by the binary digit \\(0\\), and each ternary digit \\(2\\) by the binary digit \\(1\\).\n\nThe expansion convention matters at endpoints. For example,\n\n\\[\\frac13=0.02222\\ldots{}_3, \\qquad \\frac23=0.20000\\ldots{}_3.\\]\n\nTheir images are\n\n\\[F\\left(\\frac13\\right)=0.01111\\ldots{}_2=\\frac12, \\qquad F\\left(\\frac23\\right)=0.10000\\ldots{}_2=\\frac12.\\]\n\nThe two endpoints of every deleted interval similarly receive the same value. Extend \\(F\\) to the interior of each deleted interval by assigning that common endpoint value throughout the interval.\n\nConsequently,\n\n\\[F(x)=\\frac12 \\quad\\text{for }\\frac13\\le x\\le\\frac23.\\]\n\nAt the next stage,\n\n\\[F(x)=\\frac14 \\quad\\text{for }\\frac19\\le x\\le\\frac29,\\]\n\nand\n\n\\[F(x)=\\frac34 \\quad\\text{for }\\frac79\\le x\\le\\frac89.\\]\n\nThese horizontal plateaus, repeated at every scale, give the graph its staircase appearance."
    },
    {
      "heading": "Self-similarity and approximation",
      "text": "The function satisfies\n\n\\[F(x)= \\begin{cases} \\frac12F(3x), & 0\\le x\\le\\frac13,\\\\[4pt] \\frac12, & \\frac13\\le x\\le\\frac23,\\\\[4pt] \\frac12+\\frac12F(3x-2), & \\frac23\\le x\\le1. \\end{cases}\\]\n\nThe overlapping formulas agree at the boundary points. Each outer third contains a copy of the whole graph, compressed horizontally by a factor of \\(3\\) and vertically by a factor of \\(2\\).\n\nThis relation also gives a construction by uniform convergence. Begin with \\(F_0(x)=x\\), and define \\(F_{n+1}\\) by substituting \\(F_n\\) for \\(F\\) on the right-hand side. Each \\(F_n\\) is continuous and piecewise linear. On the intervals remaining after \\(n\\) stages of the Cantor-set construction, its slope is \\((3/2)^n\\); on intervals already removed, it is constant.\n\nIf \\(T\\) denotes this recursive operation, then\n\n\\[\\|Tg-Th\\|_\\infty\\le\\frac12\\|g-h\\|_\\infty.\\]\n\nSuccessive approximations therefore converge uniformly to \\(F\\). The Banach fixed-point theorem also establishes uniqueness among continuous functions with endpoint values \\(0\\) and \\(1\\) satisfying the recursion."
    },
    {
      "heading": "Continuity, monotonicity, and regularity",
      "text": "The Cantor function is a nondecreasing function, but it is not strictly increasing because it is constant on every deleted interval. Nevertheless, continuity and its endpoint values imply that it is a surjection onto \\([0,1]\\).\n\nIts restriction to \\(C\\) is also onto \\([0,1]\\): every binary expansion determines a corresponding ternary expansion using \\(0\\) and \\(2\\). Thus a set of measure zero is mapped onto an entire interval. This illustrates why continuous functions need not preserve sets of measure zero.\n\nThe function has the symmetry\n\n\\[F(1-x)=1-F(x).\\]\n\nIts regularity is described more precisely by Hölder continuity. With\n\n\\[\\alpha=\\frac{\\log 2}{\\log 3},\\]\n\nthere is a constant \\(K\\) such that\n\n\\[|F(x)-F(y)|\\le K|x-y|^\\alpha \\qquad(x,y\\in[0,1]).\\]\n\nThis exponent is optimal. Indeed,\n\n\\[F(3^{-n})=2^{-n},\\]\n\nso for any \\(\\beta>\\alpha\\),\n\n\\[\\frac{|F(3^{-n})-F(0)|}{|3^{-n}-0|^\\beta} =\\left(\\frac{3^\\beta}{2}\\right)^n \\longrightarrow\\infty.\\]\n\nIn particular, \\(F\\) is not Lipschitz continuous."
    },
    {
      "heading": "Derivative and failure of integral recovery",
      "text": "Every point of \\([0,1]\\setminus C\\) lies in an open interval on which \\(F\\) is constant. Hence\n\n\\[F'(x)=0 \\qquad\\text{for every }x\\in(0,1)\\setminus C.\\]\n\nBecause \\(C\\) has measure zero, the derivative is zero almost everywhere.\n\nThis does not mean that the derivative exists everywhere. For example, at \\(x=1/3\\), right-hand difference quotients are zero because of the central plateau. On the other hand, setting\n\n\\[x_n=\\frac13-3^{-n}, \\qquad n\\ge2,\\]\n\ngives\n\n\\[F(x_n)=\\frac12-2^{-n},\\]\n\nand therefore\n\n\\[\\frac{F(1/3)-F(x_n)}{1/3-x_n} =\\left(\\frac32\\right)^n.\\]\n\nThus no finite two-sided derivative exists there.\n\nSince \\(F'=0\\) almost everywhere, its Lebesgue integral is zero:\n\n\\[\\int_0^1F'(x)\\,dx=0,\\]\n\nwhere the derivative may be assigned arbitrary values on the exceptional null set. Yet\n\n\\[F(1)-F(0)=1.\\]\n\nThis is not a contradiction of the fundamental theorem of calculus. The Lebesgue version that reconstructs a function from its derivative requires absolute continuity, not merely continuity and monotonicity. The Cantor function is not absolutely continuous.\n\nA direct demonstration uses the \\(2^n\\) intervals remaining at stage \\(n\\). Their total length is \\((2/3)^n\\), which tends to zero, while the sum of the increases of \\(F\\) across them is always \\(1\\). This violates the defining condition for absolute continuity."
    },
    {
      "heading": "Probability and singular measure",
      "text": "Extended by \\(F(x)=0\\) for \\(x<0\\) and \\(F(x)=1\\) for \\(x>1\\), the Cantor function is the cumulative distribution function of the Cantor distribution.\n\nOne construction uses independent random variables \\(B_1,B_2,\\ldots\\), each taking the values \\(0\\) and \\(1\\) with equal probability. The convergent random series\n\n\\[X=\\sum_{n=1}^{\\infty}\\frac{2B_n}{3^n}\\]\n\ntakes values in \\(C\\), and\n\n\\[F(x)=\\mathbb P(X\\le x).\\]\n\nIts probability distribution assigns probability \\(1\\) to \\(C\\), even though \\(C\\) has Lebesgue measure zero. It assigns probability zero to each individual point. It is therefore singular continuous: singular with respect to Lebesgue measure, but without point masses.\n\nIn particular, this distribution has no probability density function with respect to Lebesgue measure. The almost-everywhere derivative of its cumulative distribution function cannot serve as such a density: that derivative is zero and would integrate to zero rather than one."
    },
    {
      "heading": "Bounded variation and generalized differentiation",
      "text": "As a nondecreasing function with endpoint increase \\(1\\), \\(F\\) has bounded variation, with total variation equal to \\(1\\). Its associated Lebesgue–Stieltjes measure \\(\\mu\\) satisfies\n\n\\[\\mu((a,b])=F(b)-F(a) \\qquad(0\\le a<b\\le1).\\]\n\nThis is precisely the probability measure of the Cantor distribution.\n\nIn distribution theory, the derivative of \\(F\\) is the measure \\(\\mu\\), rather than the zero function. More explicitly, for every smooth test function \\(\\varphi\\) compactly supported in \\((0,1)\\),\n\n\\[-\\int_0^1F(x)\\varphi'(x)\\,dx =\\int_{[0,1]}\\varphi(x)\\,d\\mu(x).\\]\n\nThe classical derivative records the local slopes wherever a finite derivative exists; the distributional derivative also records the singular increase concentrated on \\(C\\). This distinction makes the Cantor function a standard example in the study of integration, measures, and generalized derivatives."
    }
  ],
  "links": [
    "continuous-function",
    "derivative",
    "almost-everywhere",
    "cantor-set",
    "lebesgue-measure",
    "georg-cantor",
    "mathematical-analysis",
    "uniform-convergence",
    "banach-fixed-point-theorem",
    "monotonic-function",
    "surjective-function",
    "lipschitz-continuity",
    "lebesgue-integral",
    "fundamental-theorem-of-calculus",
    "absolute-continuity",
    "cumulative-distribution-function",
    "statistical-independence",
    "random-variable",
    "probability-distribution",
    "probability-density-function"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}