# A differentiable real function with unbounded derivative around zero

Consider the real function defined on $$\mathbb R$$$f(x)=\begin{cases} 0 &\text{for } x = 0\\ x^2 \sin \frac{1}{x^2} &\text{for } x \neq 0 \end{cases}$

$$f$$ is continuous and differentiable on $$\mathbb R\setminus \{0\}$$. For $$x \in \mathbb R$$ we have $$\vert f(x) \vert \le x^2$$, which implies that $$f$$ is continuous at $$0$$. Also $\left\vert \frac{f(x)-f(0)}{x} \right\vert = \left\vert x \sin \frac{1}{x^2} \right\vert \le \vert x \vert$ proving that $$f$$ is differentiable at zero with $$f^\prime(0) = 0$$. The derivative of $$f$$ for $$x \neq 0$$ is $f^\prime(x) = \underbrace{2x \sin \frac{1}{x^2}}_{=g(x)}-\underbrace{\frac{2}{x} \cos \frac{1}{x^2}}_{=h(x)}$ On the interval $$(-1,1)$$, $$g(x)$$ is bounded by $$2$$. However, for $$a_k=\frac{1}{\sqrt{k \pi}}$$ with $$k \in \mathbb N$$ we have $$h(a_k)=2 \sqrt{k \pi} (-1)^k$$ which is unbounded while $$\lim\limits_{k \to \infty} a_k = 0$$. Therefore $$f^\prime$$ is unbounded in all neighborhood of the origin.

# 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.

# Counterexample around L’Hôpital’s rule

Let us consider two differentiable functions $$f$$ and $$g$$ defined in an open interval $$(a,b)$$, where $$b$$ might be $$\infty$$. If
$\lim\limits_{x \to b^-} f(x) = \lim\limits_{x \to b^-} g(x) = \infty$ and if $$g^\prime(x) \neq 0$$ in some interval $$(c,b)$$, then a version of l’Hôpital’s rule states that $$\lim\limits_{x \to b^-} \frac{f^\prime(x)}{g^\prime(x)} = L$$ implies $$\lim\limits_{x \to b^-} \frac{f(x)}{g(x)} = L$$.

We provide a counterexample when $$g^\prime$$ vanishes in all neighborhood of $$b$$. The counterexample is due to the Austrian mathematician Otto Stolz.

We take $$(0,\infty)$$ for the interval $$(a,b)$$ and $\begin{cases} f(x) &= x + \cos x \sin x\\ g(x) &= e^{\sin x}(x + \cos x \sin x) \end{cases}$ which derivatives are $\begin{cases} f^\prime(x) &= 2 \cos^2 x\\ g^\prime(x) &= e^{\sin x} \cos x (x + \cos x \sin x + 2 \cos x) \end{cases}$ We have $\lim\limits_{x \to \infty} \frac{f^\prime(x)}{g^\prime(x)} = \lim\limits_{x \to \infty} \frac{2 \cos x}{e^{\sin x} (x + \cos x \sin x + 2 \cos x)} = 0,$ however $\frac{f(x)}{g(x)} = \frac{1}{e^{\sin x}}$ doesn’t have any limit at $$\infty$$ as it oscillates between $$\frac{1}{e}$$ and $$e$$.

# On limit at infinity of functions and their derivatives

We consider continuously differentiable real functions defined on $$(0,\infty)$$ and the limits $\lim\limits_{x \to \infty} f(x) \text{ and } \lim\limits_{x \to \infty} f^\prime(x).$

### A map $$f$$ such that $$\lim\limits_{x \to \infty} f(x) = \infty$$ and $$\lim\limits_{x \to \infty} f^\prime(x) = 0$$

Consider the map $$f : x \mapsto \sqrt{x}$$. It is clear that $$\lim\limits_{x \to \infty} f(x) = \infty$$. As $$f^\prime(x) = \frac{1}{2 \sqrt{x}}$$, we have as announced $$\lim\limits_{x \to \infty} f^\prime(x) = 0$$

### A bounded map $$g$$ having no limit at infinity such that $$\lim\limits_{x \to \infty} g^\prime(x) = 0$$

One idea is to take an oscillating map whose wavelength is increasing to $$\infty$$. Let’s take the map $$g : x \mapsto \cos \sqrt{x}$$. $$g$$ doesn’t have a limit at $$\infty$$ as for $$n \in \mathbb N$$, we have $$g(n^2 \pi^2) = \cos n \pi = (-1)^n$$. However, the derivative of $$g$$ is $g^\prime(x) = – \frac{\sin \sqrt{x}}{2 \sqrt{x}},$ and as $$\vert g^\prime(x) \vert \le \frac{1}{2 \sqrt{x}}$$ for all $$x \in (0,\infty)$$, we have $$\lim\limits_{x \to \infty} g^\prime(x) = 0$$.

# Counterexamples around differentiation of sequences of functions

We consider here sequences of real functions defined on a closed interval. Following theorem is the main one regarding the differentiation of the limit.

Theorem: Suppose $$(f_n)$$ is a sequence of functions, differentiable on $$[a,b]$$ and such that $$(f_n(x_0))$$ converges for some point $$x_0 \in [a,b]$$. If $$(f_n^\prime)$$ converges uniformly on $$[a,b]$$, then $$(f_n)$$ converges uniformly on $$[a,b]$$ to a function $$f$$ and for all $$x \in [a,b]$$ $f^\prime(x)=\lim\limits_{n \to \infty} f_n^\prime(x)$ What happens if we drop some hypothesis of the theorem? Continue reading Counterexamples around differentiation of sequences of functions

# A function whose derivative at 0 is one but which is not increasing near 0

From the mean value theorem, a real function whose derivative is strictly positive at every point of an interval is strictly increasing. In particular, a continuously differentiable function $$f$$ defined in a non-degenerate interval $$I$$ with a strictly positive derivative at a point $$a$$ of the interval is strictly increasing near that point. For the proof, we just have to notice that as $$f^\prime$$ is continuous and $$f^\prime(a) > 0$$, $$f^\prime$$ is strictly positive within an interval $$J \subset I$$ containing $$a$$. By the mean value theorem, $$f$$ is strictly increasing on $$J$$.

We now suppose that $$f$$ is differentiable on an interval $$I$$ containing $$0$$ with $$f^\prime(0)>0$$. For $$x>0$$ sufficiently close to zero we have $$\displaystyle \frac{f(x)-f(0)}{x-0} > \frac{f^\prime(0)}{2}>0$$, hence $$f(x)>f(0)$$. But that doesn’t imply that $$f$$ is strictly increasing in a neighborhood of zero. Let’s prove it with a counterexample. Continue reading A function whose derivative at 0 is one but which is not increasing near 0

# A decreasing function converging to zero whose derivative diverges (part2)

In that article, I gave examples of real valued functions defined on $$(0,+\infty)$$ that converge to zero and whose derivatives diverge. But those functions were not monotonic. Here I give an example of a decreasing real valued function $$g$$ converging to zero at $$+\infty$$ and whose derivative is unbounded.

We first consider the polynomial map:
$P(x)=(1+2x)(1-x)^2=1-3x^2+2x^3$ on the segment $$I=[0,1]$$. $$P$$ derivative equals $$P^\prime(x)=-6x(1-x)$$. Therefore $$P$$ is decreasing on $$I$$. Moreover we have $$P(0)=1$$, $$P(1)=P^\prime(0)=P^\prime(1)=0$$ and $$P^\prime(1/2)=-3/2$$. Continue reading A decreasing function converging to zero whose derivative diverges (part2)

# Differentiable functions converging to zero whose derivatives diverge (part1)

In this article, I consider real valued functions $$f$$ defined on $$(0,+\infty)$$ that converge to zero, i.e.:
$\lim\limits_{x \to +\infty} f(x) = 0$ If $$f$$ is differentiable what can be the behavior of its derivative as $$x$$ approaches $$+\infty$$?

Let’s consider a first example:
$\begin{array}{l|rcl} f_1 : & (0,+\infty) & \longrightarrow & \mathbb{R} \\ & x & \longmapsto & \frac{1}{x} \end{array}$ $$f_1$$ derivative is $$f_1^\prime(x)=-\frac{1}{x^2}$$ and we also have $$\lim\limits_{x \to +\infty} f_1^\prime(x) = 0$$. Let’s consider more sophisticated cases! Continue reading Differentiable functions converging to zero whose derivatives diverge (part1)

# A continuous function not differentiable at the rationals but differentiable elsewhere

We build here a continuous function of one real variable whose derivative exists on $$\mathbb{R} \setminus \mathbb{Q}$$ and doesn’t have a left or right derivative on each point of $$\mathbb{Q}$$.

As $$\mathbb{Q}$$ is (infinitely) countable, we can find a bijection $$n \mapsto r_n$$ from $$\mathbb{N}$$ to $$\mathbb{Q}$$. We now reuse the function $$f$$ defined here. Recall $$f$$ main properties: Continue reading A continuous function not differentiable at the rationals but differentiable elsewhere

# A differentiable function except at one point with a bounded derivative

We build here a continuous function of one real variable whose derivative exists except at $$0$$ and is bounded on $$\mathbb{R^*}$$.

We start with the even and piecewise linear function $$g$$ defined on $$[0,+\infty)$$ with following values:
$g(x)= \left\{ \begin{array}{ll} 0 & \mbox{if } x =0\\ 0 & \mbox{if } x \in \{\frac{k}{4^n};(k,n) \in \{1,2,4\} \times \mathbb{N^*}\}\\ 1 & \mbox{if } x \in \{\frac{3}{4^n};n \in \mathbb{N^*}\}\\ \end{array} \right.$
The picture below gives an idea of the graph of $$g$$ for positive values. Continue reading A differentiable function except at one point with a bounded derivative