Thomae's function
![](/wiki/images/thumb/1/15/Thomae_function_%280%2C1%29.svg/200px-Thomae_function_%280%2C1%29.svg.png)
Thomae's function is a real-valued function of a real variable that can be defined as:[1]:{{{1}}} [math]\displaystyle{ f(x) = \begin{cases} \frac{1}{q} &\text{if }x = \tfrac{p}{q}\quad (x \text{ is rational), with } p \in \mathbb Z \text{ and } q \in \mathbb N \text{ coprime}\\ 0 &\text{if }x \text{ is irrational.} \end{cases} }[/math]
It is named after Carl Johannes Thomae, but has many other names: the popcorn function, the raindrop function, the countable cloud function, the modified Dirichlet function, the ruler function,[2] the Riemann function, or the Stars over Babylon (John Horton Conway's name).[3] Thomae mentioned it as an example for an integrable function with infinitely many discontinuities in an early textbook on Riemann's notion of integration.[4]
Since every rational number has a unique representation with coprime (also termed relatively prime) [math]\displaystyle{ p \in \mathbb Z }[/math] and [math]\displaystyle{ q \in \mathbb N }[/math], the function is well-defined. Note that [math]\displaystyle{ q = +1 }[/math] is the only number in [math]\displaystyle{ \mathbb N }[/math] that is coprime to [math]\displaystyle{ p = 0. }[/math]
It is a modification of the Dirichlet function, which is 1 at rational numbers and 0 elsewhere.
Properties
- Thomae's function [math]\displaystyle{ f }[/math] is bounded and maps all real numbers to the unit interval:[math]\displaystyle{ f : \mathbb R \to [0, 1]. }[/math]
- [math]\displaystyle{ f }[/math] is periodic with period [math]\displaystyle{ 1:\; f(x + n) = f(x) }[/math] for all integers n and all real x.
Proof of periodicity
For all [math]\displaystyle{ x \in \mathbb R \setminus \mathbb Q, }[/math] we also have [math]\displaystyle{ x+n \in \mathbb R \setminus \mathbb Q }[/math] and hence [math]\displaystyle{ f(x+n) = f(x)= 0, }[/math]
For all [math]\displaystyle{ x \in \mathbb Q,\; }[/math] there exist [math]\displaystyle{ p \in \mathbb Z }[/math] and [math]\displaystyle{ q \in \mathbb N }[/math] such that [math]\displaystyle{ \;x = p/q,\; }[/math] and [math]\displaystyle{ \gcd(p,\;q) = 1. }[/math] Consider [math]\displaystyle{ x + n = (p + nq) / q }[/math]. If [math]\displaystyle{ d }[/math] divides [math]\displaystyle{ p }[/math] and [math]\displaystyle{ q }[/math], it divides [math]\displaystyle{ p + nq }[/math] and [math]\displaystyle{ q }[/math]. Conversely, if [math]\displaystyle{ d }[/math] divides [math]\displaystyle{ p + nq }[/math] and [math]\displaystyle{ q }[/math], it divides [math]\displaystyle{ (p + nq) - nq = p }[/math] and [math]\displaystyle{ q }[/math]. So [math]\displaystyle{ \gcd(p + nq, q) = \gcd(p, q) = 1 }[/math], and [math]\displaystyle{ f(x + n) = 1/q = f(x) }[/math].
- [math]\displaystyle{ f }[/math] is discontinuous at every rational number, so its points of discontinuity are dense within the real numbers.
Proof of discontinuity at rational numbers
Let [math]\displaystyle{ x_0 = p/q }[/math] be an arbitrary rational number, with [math]\displaystyle{ \;p \in \mathbb Z,\; q \in \mathbb N, }[/math] and [math]\displaystyle{ p }[/math] and [math]\displaystyle{ q }[/math] coprime.
This establishes [math]\displaystyle{ f(x_0) = 1/q. }[/math]
Let [math]\displaystyle{ \;\alpha \in \mathbb R \setminus \mathbb Q\; }[/math] be any irrational number and define [math]\displaystyle{ x_n = x_0 + \frac{\alpha}{n} }[/math] for all [math]\displaystyle{ n \in \mathbb N. }[/math]
These [math]\displaystyle{ x_n }[/math] are all irrational, and so [math]\displaystyle{ f(x_n) = 0 }[/math] for all [math]\displaystyle{ n \in \mathbb N. }[/math]
This implies [math]\displaystyle{ |x_0 - x_n| = \frac{\alpha}{n}, }[/math] and [math]\displaystyle{ |f(x_0) - f(x_n)| = \frac{1}{q}. }[/math]
Let [math]\displaystyle{ \;\varepsilon = 1/q\; }[/math], and given [math]\displaystyle{ \delta \gt 0 }[/math] let [math]\displaystyle{ n = 1 + \left\lceil\frac{\alpha}{\delta }\right\rceil. }[/math] For the corresponding [math]\displaystyle{ \;x_n }[/math] we have [math]\displaystyle{ |f(x_0) - f(x_n)|= 1/q \ge \varepsilon }[/math] and [math]\displaystyle{ |x_0 - x_n| = \frac{\alpha}{n} = \frac{\alpha}{1 + \left\lceil\frac{\alpha}{\delta}\right\rceil} \lt \frac{\alpha}{\left\lceil\frac{\alpha}{\delta}\right\rceil} \le \delta, }[/math]
which is exactly the definition of discontinuity of [math]\displaystyle{ f }[/math] at [math]\displaystyle{ x_0 }[/math].
- [math]\displaystyle{ f }[/math] is continuous at every irrational number, so its points of continuity are dense within the real numbers.
Proof of continuity at irrational arguments
Since [math]\displaystyle{ f }[/math] is periodic with period [math]\displaystyle{ 1 }[/math] and [math]\displaystyle{ 0 \in \Q, }[/math] it suffices to check all irrational points in [math]\displaystyle{ I=(0,1).\; }[/math] Assume now [math]\displaystyle{ \varepsilon \gt 0,\; i \in \N }[/math] and [math]\displaystyle{ x_0 \in I \setminus \Q. }[/math] According to the Archimedean property of the reals, there exists [math]\displaystyle{ r \in \N }[/math] with [math]\displaystyle{ 1/r \lt \varepsilon , }[/math] and there exist [math]\displaystyle{ \; k_i \in \N, }[/math] such that
for [math]\displaystyle{ i = 1, \ldots, r }[/math] we have [math]\displaystyle{ 0 \lt \frac{k_i}{i} \lt x_0 \lt \frac{k_i +1}{i}. }[/math]
The minimal distance of [math]\displaystyle{ x_0 }[/math] to its i-th lower and upper bounds equals [math]\displaystyle{ d_i := \min\left\{\left|x_0 - \frac{k_i}{i}\right|,\; \left|x_0 - \frac{k_i + 1}{i}\right| \right\}. }[/math]
We define [math]\displaystyle{ \delta }[/math] as the minimum of all the finitely many [math]\displaystyle{ d_i. }[/math] [math]\displaystyle{ \delta := \min_{1\le i\le r}\{d_i\},\; }[/math] so that for all [math]\displaystyle{ i = 1, \dots, r, }[/math] [math]\displaystyle{ |x_0 - k_i/i| \ge \delta }[/math] and [math]\displaystyle{ |x_0 - (k_i+1)/i| \ge \delta. }[/math]
This is to say, all these rational numbers [math]\displaystyle{ k_i/i,\;(k_i + 1)/i,\; }[/math] are outside the [math]\displaystyle{ \delta }[/math]-neighborhood of [math]\displaystyle{ x_0. }[/math]
Now let [math]\displaystyle{ x \in \mathbb{Q} \cap (x_0 - \delta, x_0 + \delta) }[/math] with the unique representation [math]\displaystyle{ x = p/q }[/math] where [math]\displaystyle{ p, q \in \mathbb N }[/math] are coprime. Then, necessarily, [math]\displaystyle{ q \gt r,\; }[/math] and therefore, [math]\displaystyle{ f(x)=1/q \lt 1/r \lt \varepsilon. }[/math]
Likewise, for all irrational [math]\displaystyle{ x \in I, \; f(x) = 0 = f(x_0),\; }[/math] and thus, if [math]\displaystyle{ \varepsilon \gt 0 }[/math] then any choice of (sufficiently small) [math]\displaystyle{ \delta \gt 0 }[/math] gives [math]\displaystyle{ |x - x_0| \lt \delta \implies |f(x_0) - f(x)| = f(x) \lt \varepsilon. }[/math]
Therefore, [math]\displaystyle{ f }[/math] is continuous on [math]\displaystyle{ \mathbb R \setminus \mathbb Q. }[/math]
- [math]\displaystyle{ f }[/math] is nowhere differentiable.
Proof of being nowhere differentiable
- For rational numbers, this follows from non-continuity.
- For irrational numbers:
- For any sequence of irrational numbers [math]\displaystyle{ (a_n)_{n=1}^\infty }[/math] with [math]\displaystyle{ a_n \ne x_0 }[/math] for all [math]\displaystyle{ n \in \mathbb{N}_{+} }[/math] that converges to the irrational point [math]\displaystyle{ x_0,\; }[/math] the sequence [math]\displaystyle{ (f(a_n))_{n=1}^\infty }[/math] is identically [math]\displaystyle{ 0,\; }[/math] and so [math]\displaystyle{ \lim_{n \to \infty}\left|\frac{f(a_n)-f(x_0)}{a_n - x_0}\right| = 0. }[/math]
- According to Hurwitz's theorem, there also exists a sequence of rational numbers [math]\displaystyle{ (b_n)_{n=1}^{\infty} = (k_n/n)_{n=1}^\infty,\; }[/math] converging to [math]\displaystyle{ x_0,\; }[/math] with [math]\displaystyle{ k_n \in \mathbb Z }[/math] and [math]\displaystyle{ n \in \mathbb N }[/math] coprime and [math]\displaystyle{ |k_n/n - x_0| \lt \frac{1}{\sqrt{5}\cdot n^2}.\; }[/math]
- Thus for all [math]\displaystyle{ n, }[/math] [math]\displaystyle{ \left|\frac{f(b_n)-f(x_0)}{b_n - x_0} \right| \gt \frac{1/n - 0}{1/(\sqrt{5}\cdot n^2)} =\sqrt{5}\cdot n \ne 0\; }[/math] and so [math]\displaystyle{ f }[/math] is not differentiable at all irrational [math]\displaystyle{ x_0. }[/math]
- [math]\displaystyle{ f }[/math] has a strict local maximum at each rational number.[citation needed] See the proofs for continuity and discontinuity above for the construction of appropriate neighbourhoods, where [math]\displaystyle{ f }[/math] has maxima.
- [math]\displaystyle{ f }[/math] is Riemann integrable on any interval and the integral evaluates to [math]\displaystyle{ 0 }[/math] over any set. The Lebesgue criterion for integrability states that a bounded function is Riemann integrable if and only if the set of all discontinuities has measure zero.[5] Every countable subset of the real numbers - such as the rational numbers - has measure zero, so the above discussion shows that Thomae's function is Riemann integrable on any interval. The function's integral is equal to [math]\displaystyle{ 0 }[/math] over any set because the function is equal to zero almost everywhere.
- If [math]\displaystyle{ G = \{ \, (x,f(x)) : x \in (0,1) \, \} \subset \mathbb{R}^2 }[/math] is the graph of the restriction of [math]\displaystyle{ f }[/math] to [math]\displaystyle{ (0,1) }[/math], then the box-counting dimension of [math]\displaystyle{ G }[/math] is [math]\displaystyle{ 4/3 }[/math].[6]
Related probability distributions
Empirical probability distributions related to Thomae's function appear in DNA sequencing.[7] The human genome is diploid, having two strands per chromosome. When sequenced, small pieces ("reads") are generated: for each spot on the genome, an integer number of reads overlap with it. Their ratio is a rational number, and typically distributed similarly to Thomae's function.
If pairs of positive integers [math]\displaystyle{ m, n }[/math] are sampled from a distribution [math]\displaystyle{ f(n,m) }[/math] and used to generate ratios [math]\displaystyle{ q=n/(n+m) }[/math], this gives rise to a distribution [math]\displaystyle{ g(q) }[/math] on the rational numbers. If the integers are independent the distribution can be viewed as a convolution over the rational numbers, [math]\displaystyle{ g(a/(a+b)) = \sum_{t=1}^\infty f(ta)f(tb) }[/math]. Closed form solutions exist for power-law distributions with a cut-off. If [math]\displaystyle{ f(k) =k^{-\alpha} e^{-\beta k}/\mathrm{Li}_\alpha(e^{-\beta}) }[/math] (where [math]\displaystyle{ \mathrm{Li}_\alpha }[/math] is the polylogarithm function) then [math]\displaystyle{ g(a/(a+b)) = (ab)^{-\alpha} \mathrm{Li}_{2\alpha}(e^{-(a+b)\beta})/\mathrm{Li}^2_{\alpha}(e^{-\beta}) }[/math]. In the case of uniform distributions on the set [math]\displaystyle{ \{1,2,\ldots , L\} }[/math] [math]\displaystyle{ g(a/(a+b)) = (1/L^2) \lfloor L/\max(a,b) \rfloor }[/math], which is very similar to Thomae's function.[7]
The ruler function
For integers, the exponent of the highest power of 2 dividing [math]\displaystyle{ n }[/math] gives 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, ... (sequence A007814 in the OEIS). If 1 is added, or if the 0s are removed, 1, 2, 1, 3, 1, 2, 1, 4, 1, 2, 1, 3, 1, 2, 1, ... (sequence A001511 in the OEIS). The values resemble tick-marks on a 1/16th graduated ruler, hence the name. These values correspond to the restriction of the Thomae function to the dyadic rationals: those rational numbers whose denominators are powers of 2.
Related functions
A natural follow-up question one might ask is if there is a function which is continuous on the rational numbers and discontinuous on the irrational numbers. This turns out to be impossible. The set of discontinuities of any function must be an Fσ set. If such a function existed, then the irrationals would be an Fσ set. The irrationals would then be the countable union of closed sets [math]\displaystyle{ \bigcup_{i = 0}^\infty C_i }[/math], but since the irrationals do not contain an interval, neither can any of the [math]\displaystyle{ C_i }[/math]. Therefore, each of the [math]\displaystyle{ C_i }[/math] would be nowhere dense, and the irrationals would be a meager set. It would follow that the real numbers, being the union of the irrationals and the rationals (which, as a countable set, is evidently meager), would also be a meager set. This would contradict the Baire category theorem: because the reals form a complete metric space, they form a Baire space, which cannot be meager in itself.
A variant of Thomae's function can be used to show that any Fσ subset of the real numbers can be the set of discontinuities of a function. If [math]\displaystyle{ A = \bigcup_{n=1}^{\infty} F_n }[/math] is a countable union of closed sets [math]\displaystyle{ F_n }[/math], define [math]\displaystyle{ f_A(x) = \begin{cases} \frac{1}{n} & \text{if } x \text{ is rational and } n \text{ is minimal so that } x \in F_n\\ -\frac{1}{n} & \text{if } x \text{ is irrational and } n \text{ is minimal so that } x \in F_n\\ 0 & \text{if } x \notin A \end{cases} }[/math]
Then a similar argument as for Thomae's function shows that [math]\displaystyle{ f_A }[/math] has A as its set of discontinuities.
See also
- Blumberg theorem
- Cantor function
- Dirichlet function
- Euclid's orchard – Thomae's function can be interpreted as a perspective drawing of Euclid's orchard
- Volterra's function
References
- ↑ Beanland, Kevin; Roberts, James W.; Stevenson, Craig (2009), "Modifications of Thomae's Function and Differentiability", The American Mathematical Monthly 116 (6): 531–535, doi:10.4169/193009709x470425
- ↑ Dunham, William (2008), The Calculus Gallery: Masterpieces from Newton to Lebesgue (Paperback ed.), Princeton: Princeton University Press, page 149, chapter 10, ISBN 978-0-691-13626-4, https://books.google.com/books?id=aYTYBQAAQBAJ&pg=PA149, ""...the so-called ruler function, a simple but provocative example that appeared in a work of Johannes Karl Thomae ... The graph suggests the vertical markings on a ruler—hence the name.""
- ↑ John Conway. "Topic: Provenance of a function". The Math Forum. Archived from the original on 13 June 2018. https://web.archive.org/web/20180613235037/mathforum.org/kb/message.jspa?messageID=1375516.
- ↑ Thomae, J. (1875) (in german), Einleitung in die Theorie der bestimmten Integrale, Halle a/S: Verlag von Louis Nebert, p. 14, §20
- ↑ Spivak, M. (1965), Calculus on manifolds, Perseus Books, page 53, Theorem 3-8, ISBN 978-0-8053-9021-6
- ↑ Chen, Haipeng; Fraser, Jonathan M.; Yu, Han (2022). "Dimensions of the popcorn graph". Proceedings of the American Mathematical Society 150 (11): 4729–4742. doi:10.1090/proc/15729.
- ↑ 7.0 7.1 Trifonov, Vladimir; Pasqualucci, Laura; Dalla-Favera, Riccardo; Rabadan, Raul (2011). "Fractal-like Distributions over the Rational Numbers in High-throughput Biological and Clinical Data". Scientific Reports 1 (191): 191. doi:10.1038/srep00191. PMID 22355706. Bibcode: 2011NatSR...1E.191T.
- Abbott, Stephen (2016), Understanding Analysis (Softcover reprint of the original 2nd ed.), New York: Springer, ISBN 978-1-4939-5026-3
- Bartle, Robert G.; Sherbert, Donald R. (1999), Introduction to Real Analysis (3rd ed.), Wiley, ISBN 978-0-471-32148-4, https://archive.org/details/introductiontore00bart_1 (Example 5.1.6 (h))
External links
- Hazewinkel, Michiel, ed. (2001), "Dirichlet-function", Encyclopedia of Mathematics, Springer Science+Business Media B.V. / Kluwer Academic Publishers, ISBN 978-1-55608-010-4, https://www.encyclopediaofmath.org/index.php?title=p/d032860
- Weisstein, Eric W.. "Dirichlet Function". http://mathworld.wolfram.com/DirichletFunction.html.
![]() | Original source: https://en.wikipedia.org/wiki/Thomae's function.
Read more |