# A semi-continuous function with a dense set of points of discontinuity

Let’s come back to Thomae’s function which is defined as:
$f: \left|\begin{array}{lrl} \mathbb{R} & \longrightarrow & \mathbb{R} \\ x & \longmapsto & 0 \text{ if } x \in \mathbb{R} \setminus \mathbb{Q} \\ \frac{p}{q} & \longmapsto & \frac{1}{q} \text{ if } \frac{p}{q} \text{ in lowest terms and } q > 0 \end{array}\right.$

We proved here that $$f$$ right-sided and left-sided limits vanish at all points. Therefore $$\limsup\limits_{x \to a} f(x) \le f(a)$$ at every point $$a$$ which proves that $$f$$ is upper semi-continuous on $$\mathbb R$$. However $$f$$ is continuous at all $$a \in \mathbb R \setminus \mathbb Q$$ and discontinuous at all $$a \in \mathbb Q$$.

# A strictly increasing continuous function that is differentiable at no point of a null set

We build in this article a strictly increasing continuous function $$f$$ that is differentiable at no point of a null set $$E$$. The null set $$E$$ can be chosen arbitrarily. In particular it can have the cardinality of the continuum like the Cantor null set.

### A set of strictly increasing continuous functions

For $$p \lt q$$ two real numbers, consider the function $f_{p,q}(x)=(q-p) \left[\frac{\pi}{2} + \arctan{\left(\frac{2x-p-q}{q-p}\right)}\right]$ $$f_{p,q}$$ is positive and its derivative is $f_{p,q}^\prime(x) = \frac{2}{1+\left(\frac{2x-p-q}{q-p}\right)^2}$ which is always strictly positive. Hence $$f_{p,q}$$ is strictly increasing. We also have $\lim\limits_{x \to -\infty} f_{p,q}(x) = 0 \text{ and } \lim\limits_{x \to \infty} f_{p,q}(x) = \pi(q-p).$ One can notice that for $$x \in (p,q)$$, $$f_{p,q}^\prime(x) \gt 1$$. Therefore for $$x, y \in (p,q)$$ distinct we have according to the mean value theorem $$\frac{f_{p,q}(y)-f_{p,q}(x)}{y-x} \ge 1$$.

### Covering $$E$$ with an appropriate set of open intervals

As $$E$$ is a null set, for each $$n \in \mathbb N$$ one can find an open set $$O_n$$ containing $$E$$ and measuring less than $$2^{-n}$$. $$O_n$$ can be written as a countable union of disjoint open intervals as any open subset of the reals. Then $$I=\bigcup_{m \in \mathbb N} O_m$$ is also a countable union of open intervals $$I_n$$ with $$n \in \mathbb N$$. The sum of the lengths of the $$I_n$$ is less than $$1$$. Continue reading A strictly increasing continuous function that is differentiable at no point of a null set

# A monotonic function whose points of discontinuity form a dense set

Consider a compact interval $$[a,b] \subset \mathbb R$$ with $$a \lt b$$. Let’s build an increasing function $$f : [a,b] \to \mathbb R$$ whose points of discontinuity is an arbitrary dense subset $$D = \{d_n \ ; \ n \in \mathbb N\}$$ of $$[a,b]$$, for example $$D = \mathbb Q \cap [a,b]$$.

Let $$\sum p_n$$ be a convergent series of positive numbers whose sum is equal to $$p$$ and define $$\displaystyle f(x) = \sum_{d_n \le x} p_n$$.

### $$f$$ is strictly increasing

For $$a \le x \lt y \le b$$ we have $f(y) – f(x) = \sum_{x \lt d_n \le y} p_n \gt 0$ as the $$p_n$$ are positive and dense so it exists $$p_m \in (x, y]$$.

### $$f$$ is right-continuous on $$[a,b]$$

We pick-up $$x \in [a,b]$$. For any $$\epsilon \gt 0$$ is exists $$N \in \mathbb N$$ such that $$0 \lt \sum_{n \gt N} p_n \lt \epsilon$$. Let $$\delta > 0$$ be so small that the interval $$(x,x+\delta)$$ doesn’t contain any point in the finite set $$\{p_1, \dots, p_N\}$$. Then $0 \lt f(y) – f(x) \le \sum_{n \gt N} p_n \lt \epsilon,$ for any $$y \in (x,x+\delta)$$ proving the right-continuity of $$f$$ at $$x$$. Continue reading A monotonic function whose points of discontinuity form a dense set

# Uniform continuous function but not Lipschitz continuous

Consider the function $\begin{array}{l|rcl} f : & [0,1] & \longrightarrow & [0,1] \\ & x & \longmapsto & \sqrt{x} \end{array}$

$$f$$ is continuous on the compact interval $$[0,1]$$. Hence $$f$$ is uniform continuous on that interval according to Heine-Cantor theorem. For a direct proof, one can verify that for $$\epsilon > 0$$, one have $$\vert \sqrt{x} – \sqrt{y} \vert \le \epsilon$$ for $$\vert x – y \vert \le \epsilon^2$$.

However $$f$$ is not Lipschitz continuous. If $$f$$ was Lipschitz continuous for a Lipschitz constant $$K > 0$$, we would have $$\vert \sqrt{x} – \sqrt{y} \vert \le K \vert x – y \vert$$ for all $$x,y \in [0,1]$$. But we get a contradiction taking $$x=0$$ and $$y=\frac{1}{4 K^2}$$ as $\vert \sqrt{x} – \sqrt{y} \vert = \frac{1}{2 K} > \frac{1}{4 K} = K \vert x – y \vert$

# Pointwise convergence not uniform on any interval

We provide in this article an example of a pointwise convergent sequence of real functions that doesn’t converge uniformly on any interval.

Let’s consider a sequence $$(a_p)_{p \in \mathbb N}$$ enumerating the set $$\mathbb Q$$ of rational numbers. Such a sequence exists as $$\mathbb Q$$ is countable.

Now let $$(g_n)_{n \in \mathbb N}$$ be the sequence of real functions defined on $$\mathbb R$$ by $g_n(x) = \sum_{p=1}^{\infty} \frac{1}{2^p} f_n(x-a_p)$ where $$f_n : x \mapsto \frac{n^2 x^2}{1+n^4 x^4}$$ for $$n \in \mathbb N$$.

### $$f_n$$ main properties

$$f_n$$ is a rational function whose denominator doesn’t vanish. Hence $$f_n$$ is indefinitely differentiable. As $$f_n$$ is an even function, we can study it only on $$[0,\infty)$$.

We have $f_n^\prime(x)= 2n^2x \frac{1-n^4x^4}{(1+n^4 x^4)^2}.$ $$f_n^\prime$$ vanishes at zero (like $$f_n$$) is positive on $$(0,\frac{1}{n})$$, vanishes at $$\frac{1}{n}$$ and is negative on $$(\frac{1}{n},\infty)$$. Hence $$f_n$$ has a maximum at $$\frac{1}{n}$$ with $$f_n(\frac{1}{n}) = \frac{1}{2}$$ and $$0 \le f_n(x) \le \frac{1}{2}$$ for all $$x \in \mathbb R$$.

Also for $$x \neq 0$$ $0 \le f_n(x) =\frac{n^2 x^2}{1+n^4 x^4} \le \frac{n^2 x^2}{n^4 x^4} = \frac{1}{n^2 x^2}$ consequently $0 \le f_n(x) \le \frac{1}{n} \text{ for } x \ge \frac{1}{\sqrt{n}}.$

### $$(g_n)$$ converges pointwise to zero

First, one can notice that $$g_n$$ is well defined. For $$x \in \mathbb R$$ and $$p \in \mathbb N$$ we have $$0 \le \frac{1}{2^p} f_n(x-a_p) \le \frac{1}{2^p} \cdot\ \frac{1}{2}=\frac{1}{2^{p+1}}$$ according to previous paragraph. Therefore the series of functions $$\sum \frac{1}{2^p} f_n(x-a_p)$$ is normally convergent. $$g_n$$ is also continuous as for all $$p \in \mathbb N$$ $$x \mapsto \frac{1}{2^p} f_n(x-a_p)$$ is continuous. Continue reading Pointwise convergence not uniform on any interval

# A Riemann-integrable map that is not regulated

For a Banach space $$X$$, a function $$f : [a,b] \to X$$ is said to be regulated if there exists a sequence of step functions $$\varphi_n : [a,b] \to X$$ converging uniformly to $$f$$.

One can prove that a regulated function $$f : [a,b] \to X$$ is Riemann-integrable. Is the converse true? The answer is negative and we provide below an example of a Riemann-integrable real function that is not regulated. Let’s first prove following theorem.

THEOREM A bounded function $$f : [a,b] \to \mathbb R$$ that is (Riemann) integrable on all intervals $$[c, b]$$ with $$a < c < b$$ is integrable on $$[a,b]$$.

PROOF Take $$M > 0$$ such that for all $$x \in [a,b]$$ we have $$\vert f(x) \vert < M$$. For $$\epsilon > 0$$, denote $$c = \inf(a + \frac{\epsilon}{4M},b + \frac{b-a}{2})$$. As $$f$$ is supposed to be integrable on $$[c,b]$$, one can find a partition $$P$$: $$c=x_1 < x_2 < \dots < x_n =b$$ such that $$0 \le U(f,P) - L(f,P) < \frac{\epsilon}{2}$$ where $$L(f,P),U(f,P)$$ are the lower and upper Darboux sums. For the partition $$P^\prime$$: $$a= x_0 < c=x_1 < x_2 < \dots < x_n =b$$, we have \begin{aligned} 0 \le U(f,P^\prime) - L(f,P^\prime) &\le 2M(c-a) + \left(U(f,P) - L(f,P)\right)\\ &< 2M \frac{\epsilon}{4M} + \frac{\epsilon}{2} = \epsilon \end{aligned} We now prove that the function $$f : [0,1] \to [0,1]$$ defined by $f(x)=\begin{cases} 1 &\text{ if } x \in \{2^{-k} \ ; \ k \in \mathbb N\}\\ 0 &\text{otherwise} \end{cases}$ is Riemann-integrable (that follows from above theorem) and not regulated. Let's prove it. If $$f$$ was regulated, there would exist a step function $$g$$ such that $$\vert f(x)-g(x) \vert < \frac{1}{3}$$ for all $$x \in [0,1]$$. If $$0=x_0 < x_1 < \dots < x_n=1$$ is a partition associated to $$g$$ and $$c_1$$ the value of $$g$$ on the interval $$(0,x_1)$$, we must have $$\vert 1-c_1 \vert < \frac{1}{3}$$ as $$f$$ takes (an infinite number of times) the value $$1$$ on $$(0,x_1)$$. But $$f$$ also takes (an infinite number of times) the value $$0$$ on $$(0,x_1)$$. Hence we must have $$\vert c_1 \vert < \frac{1}{3}$$. We get a contradiction as those two inequalities are not compatible.

# A discontinuous midpoint convex function

Let’s recall that a real function $$f: \mathbb R \to \mathbb R$$ is called convex if for all $$x, y \in \mathbb R$$ and $$\lambda \in [0,1]$$ we have $f((1- \lambda) x + \lambda y) \le (1- \lambda) f(x) + \lambda f(y)$ $$f$$ is called midpoint convex if for all $$x, y \in \mathbb R$$ $f \left(\frac{x+y}{2}\right) \le \frac{f(x)+f(y)}{2}$ One can prove that a continuous midpoint convex function is convex. Sierpinski proved the stronger theorem, that a real-valued Lebesgue measurable function that is midpoint convex will be convex.

Can one find a discontinuous midpoint convex function? The answer is positive but requires the Axiom of Choice. Why? Because Robert M. Solovay constructed a model of Zermelo-Fraenkel set theory (ZF), exclusive of the axiom of choice where all functions are Lebesgue measurable. Hence convex according to Sierpinski theorem. And one knows that convex functions defined on $$\mathbb R$$ are continuous.

Referring to my previous article on the existence of discontinuous additive map, let’s use a Hamel basis $$\mathcal B = (b_i)_{i \in I}$$ of $$\mathbb R$$ considered as a vector space on $$\mathbb Q$$. Take $$i_1 \in I$$, define $$f(i_1)=1$$ and $$f(i)=0$$ for $$i \in I\setminus \{i_1\}$$ and extend $$f$$ linearly on $$\mathbb R$$. $$f$$ is midpoint convex as it is linear. As the image of $$\mathbb R$$ under $$f$$ is $$\mathbb Q$$, $$f$$ is discontinuous as explained in the discontinuous additive map counterexample.

Moreover, $$f$$ is unbounded on all open real subsets. By linearity, it is sufficient to prove that $$f$$ is unbounded around $$0$$. Let’s consider $$i_1 \neq i_2 \in I$$. $$G= b_{i_1} \mathbb Z + b_{i_2} \mathbb Z$$ is a proper subgroup of the additive $$\mathbb R$$ group. Hence $$G$$ is either dense of discrete. It cannot be discrete as the set of vectors $$\{b_1,b_2\}$$ is linearly independent. Hence $$G$$ is dense in $$\mathbb R$$. Therefore, one can find a non vanishing sequence $$(x_n)_{n \in \mathbb N}=(q_n^1 b_{i_1} + q_n^2 b_{i_2})_{n \in \mathbb N}$$ (with $$(q_n^1,q_n^2) \in \mathbb Q^2$$ for all $$n \in \mathbb N$$) converging to $$0$$. As $$\{b_1,b_2\}$$ is linearly independent, this implies $$\vert q_n^1 \vert, \vert q_n^2 \vert \underset{n\to+\infty}{\longrightarrow} \infty$$ and therefore $\lim\limits_{n \to \infty} \vert f(x_n) \vert = \lim\limits_{n \to \infty} \vert f(q_n^1 b_{i_1} + q_n^2 b_{i_2}) \vert = \lim\limits_{n \to \infty} \vert q_n^1 \vert = \infty.$

# A positive smooth function with all derivatives vanishing at zero

Let’s consider the set $$\mathcal C^\infty(\mathbb R)$$ of real smooth functions, i.e. functions that have derivatives of all orders on $$\mathbb R$$.

Does a positive function $$f \in \mathcal C^\infty(\mathbb R)$$ with all derivatives vanishing at zero exists?

Such a map $$f$$ cannot be expandable in power series around zero, as it would vanish in a neighborhood of zero. However, the answer to our question is positive and we’ll prove that $f(x) = \left\{\begin{array}{lll} e^{-\frac{1}{x^2}} &\text{if} &x \neq 0\\ 0 &\text{if} &x = 0 \end{array}\right.$ provides an example.

$$f$$ is well defined and positive for $$x \neq 0$$. As $$\lim\limits_{x \to 0} -\frac{1}{x^2} = -\infty$$, we get $$\lim\limits_{x \to 0} f(x) = 0$$ proving that $$f$$ is continuous on $$\mathbb R$$. Let’s prove by induction that for $$x \neq 0$$ and $$n \in \mathbb N$$, $$f^{(n)}(x)$$ can be written as $f^{(n)}(x) = \frac{P_n(x)}{x^{3n}}e^{-\frac{1}{x^2}}$ where $$P_n$$ is a polynomial function. The statement is satisfied for $$n = 1$$ as $$f^\prime(x) = \frac{2}{x^3}e^{-\frac{1}{x^2}}$$. Suppose that the statement is true for $$n$$ then $f^{(n+1)}(x)=\left[\frac{P_n^\prime(x)}{x^{3n}} – \frac{3n P_n(x)}{x^{3n+1}}+\frac{2 P_n(x)}{x^{3n+3}}\right] e^{-\frac{1}{x^2}}$ hence the statement is also true for $$n+1$$ by taking $$P_{n+1}(x)= x^3 P_n^\prime(x) – 3n x^2 P_n(x) + 2 P_n(x)$$. Which concludes our induction proof.

Finally, we have to prove that for all $$n \in \mathbb N$$, $$\lim\limits_{x \to 0} f^{(n)}(x) = 0$$. For that, we use the power expansion of the exponential map $$e^x = \sum_{n=0}^\infty \frac{x^n}{n!}$$. For $$x \neq 0$$, we have $\left\vert x \right\vert^{3n} e^{\frac{1}{x^2}} \ge \frac{\vert x \vert^{3n}}{(2n)! \vert x \vert ^{4n}} = \frac{1}{(2n)! \vert x \vert^n}$ Therefore $$\lim\limits_{x \to 0} \left\vert x \right\vert^{3n} e^{\frac{1}{x^2}} = \infty$$ and $$\lim\limits_{x \to 0} f^{(n)}(x) = 0$$ as $$f^{(n)}(x) = \frac{P_n(x)}{x^{3n} e^{\frac{1}{x^2}}}$$ with $$P_n$$ a polynomial function.

# Counterexamples around Lebesgue’s Dominated Convergence Theorem

Let’s recall Lebesgue’s Dominated Convergence Theorem. Let $$(f_n)$$ be a sequence of real-valued measurable functions on a measure space $$(X, \Sigma, \mu)$$. Suppose that the sequence converges pointwise to a function $$f$$ and is dominated by some integrable function $$g$$ in the sense that $\vert f_n(x) \vert \le g (x)$ for all $$n \in \mathbb N$$ and all $$x \in X$$.
Then $$f$$ is integrable and $\lim\limits_{n \to \infty} \int_X f_n(x) \ d \mu = \int_X f(x) \ d \mu$

### Let’s see what can happen if we drop the domination condition.

We consider the space $$\mathbb R$$ endowed with Lebesgue measure and for $$E \subseteq \mathbb R$$ we denote by $$\chi_E$$ the indicator function of $$E$$ defined by $\chi_E(x)=\begin{cases} 1 \text{ if } x \in E\\ 0 \text{ otherwise}\end{cases}$ For $$n \in \mathbb N$$, the function $$f_n=\frac{1}{2n}\chi_{(n^2-n,n^2+n)}$$ is measurable and we have $\int_{\mathbb R} \frac{1}{2n}\chi_{(n^2-n,n^2+n)}(x) \ dx = \int_{n^2-n}^{n^2+n} \frac{1}{2n} \ dx = 1$ The sequence $$(f_n)$$ converges uniformly (and therefore pointwise) to the always vanishing function as for $$n \in \mathbb N$$ we have for all $$x \in \mathbb R$$ $$\vert f_n(x) \vert \le \frac{1}{2n}$$. Hence the conclusion of Lebesgue’s Dominated Convergence Theorem doesn’t hold for the sequence $$(f_n)$$.

Let’s verify that the sequence $$(f_n)$$ is not dominated by some integrable function $$g$$. For $$p < q$$ integers, we have \begin{aligned} q^2-q-(p^2+p) &= q^2-p^2 -q-p\\ &= (q-p)(q+p) -q -p\\ &\ge (q+p) -q-p=0 \end{aligned} Hence for $$p \neq q$$ integers the intervals $$(p^2-p,p^2+p)$$ and $$(q^2-q,q^2+q)$$ are disjoint. Consequently for all $$x \in \mathbb R$$ the sum $$\sum_{n \in \mathbb N} f_n(x)$$ amounts to only one term and the function $$\sum_{n \in \mathbb N} f_n$$ is well defined. If $$g$$ dominates the sequence $$(f_n)$$, it satisfies $$0 \le \sum_{n \in \mathbb N} f_n \le g$$. But $\int_{\mathbb R} \sum_{n \in \mathbb N} f_n(x) \ dx = \sum_{n \in \mathbb N} \int_{\mathbb R} f_n(x) \ dx = \sum_{n \in \mathbb N} 1 = \infty$ and $$g$$ cannot be integrable. Continue reading Counterexamples around Lebesgue’s Dominated Convergence Theorem

# Bounded functions and infimum, supremum

According to the extreme value theorem, a continuous real-valued function $$f$$ in the closed and bounded interval $$[a,b]$$ must attain a maximum and a minimum, each at least once.

Let’s see what can happen for non-continuous functions. We consider below maps defined on $$[0,1]$$.

First let’s look at $f(x)=\begin{cases} x &\text{ if } x \in (0,1)\\ 1/2 &\text{otherwise} \end{cases}$ $$f$$ is bounded on $$[0,1]$$, continuous on the interval $$(0,1)$$ but neither at $$0$$ nor at $$1$$. The infimum of $$f$$ is $$0$$, its supremum $$1$$, and $$f$$ doesn’t attain those values. However, for $$0 < a < b < 1$$, $$f$$ attains its supremum and infimum on $$[a,b]$$ as $$f$$ is continuous on this interval.

### Bounded function that doesn’t attain its infimum and supremum on all $$[a,b] \subseteq [0,1]$$

The function $$g$$ defined on $$[0,1]$$ by $g(x)=\begin{cases} 0 & \text{ if } x \notin \mathbb Q \text{ or if } x = 0\\ \frac{(-1)^q (q-1)}{q} & \text{ if } x = \frac{p}{q} \neq 0 \text{, with } p, q \text{ relatively prime} \end{cases}$ is bounded, as for $$x \in \mathbb Q \cap [0,1]$$ we have $\left\vert g(x) \right\vert < 1.$ Hence $$g$$ takes values in the interval $$[-1,1]$$. We prove that the infimum of $$g$$ is $$-1$$ and its supremum $$1$$ on all intervals $$[a,b]$$ with $$0 < a < b <1$$. Consider $$\varepsilon > 0$$ and an odd prime $$q$$ such that $q > \max(\frac{1}{\varepsilon}, \frac{1}{b-a}).$ This is possible as there are infinitely many prime numbers. By the pigeonhole principle and as $$0 < \frac{1}{q} < b-a$$, there exists a natural number $$p$$ such that $$\frac{p}{q} \in (a,b)$$. We have $-1 < g \left(\frac{p}{q} \right) = \frac{(-1)^q (q-1)}{q} = - \frac{q-1}{q} <-1 +\varepsilon$ as $$q$$ is supposed to be an odd prime with $$q > \frac{1}{\varepsilon}$$. This proves that the infimum of $$g$$ is $$-1$$. By similar arguments, one can prove that the supremum of $$g$$ on $$[a,b]$$ is $$1$$.