Calculating Dini derivatives for $f(x)=\begin{cases}x\,\sin{\left(\frac{1}{x}\right)} & x\neq 0\\ 0 & x=0\end{cases}$

Define $D^+f(x) = \limsup\limits_{h\to 0^+}{\left(\dfrac{f(x+h)-f(x)}{h}\right)}$. Given the function $f(x)=\begin{cases}x\,\sin{\left(\frac{1}{x}\right)} & x\neq 0\\ 0 & x=0\end{cases}\,,$ find $D^+f(x)$.

There are also three other approximate derivatives to work out (lim inf from the right, lim sup and lim inf from the left), but I figure if I can get one I can get the others.

The problem is that, while I understand lim sup's for sequences, I still haven't grokked lim sup's for functions... The definition seems totally unclear. (This is also the first time I've ever had to calculate the lim sup of a function, somehow.)

EDIT: Edited title for accuracy. Original title was "Calculating an 'approximate' derivative"


The four "approximate derivatives" are usually called Dini derivatives. They encapsulate best approximations to the usual derivative (and are always defined even if the latter fails to exist) in four ways: they are upper and lower approximations to the derivative from the left and the right.

If you know what the graph of $x\sin{\frac{1}{x}}$ looks like then it should be rather easy to imagine what they are supposed to be:

graph

Note that the graph of $x \sin{\frac{1}{x}}$ touches each of the four rays issuing from the origin infinitely often. Every ray with smaller slope will intersect infinitely often, while every ray with larger slope will be too far away

Concerning the definition of $\limsup$, remember the reason for the notation. If $(x_n)_{n \in \mathbb{N}}$ is a sequence of real numbers, then $\limsup_{n\to \infty} x_{n} = \lim_{n \to \infty} \sup_{k \geq n} x_{k}$. If the sequence is bounded then this limit exists because $s_{n} = \sup_{k \geq n} x_{k}$ is a decreasing sequence and because the real numbers are complete. You can also write $$\limsup_{n \to \infty} x_{n} = \inf_{n \geq 0} \sup_{k \geq n} x_{k}.$$ As for the generalization to functions remember that a sequence is a function $x(n)$ from the natural numbers to the real numbers. Now if $f: (0,\varepsilon) \to \mathbb{R}$ is a function you can generalize the last expression for the $\limsup$ by writing $$\limsup_{h \searrow 0} f(h) = \inf_{h \geq 0}{\sup_{x \in (0, h)}} f(x).$$

If you understand the definition of infimum and supremum properly, you should have no problem in solving the following:

Exercise: If $a = \limsup_{h \searrow 0} f(h)$ then there exists a sequence $x_{n} \searrow 0$ such that $a = \limsup_{n \to \infty} f(x_{n})$ and for every other sequence $\limsup_{n \to \infty} y_{n} \leq a$.

In other words, in order to calculate $\limsup_{h \searrow 0} f(h)$, find the maximum possible $\limsup_{n \to \infty} f(x_{n})$ among all sequences $x_{n} \searrow 0$.


Note that if $x\neq 0$, the function is differentiable at $x$, the limsups and liminfs equal the limit, and you know how to find this from calculus. If $x=0$, the expression becomes quite simple, and unwinding the definitions and using what you know about values of $\sin(1/h)$ for arbitrarily small values of $h$ will give you the limsups and liminfs.

Roughly speaking, the limsup of $g$ at $x$ is the largest value that $g(y)$ gets arbitrarily close to for $y$ arbitrarily close to $x$. Similarly for liminfs, but with "largest" replaced with "smallest". In your case, the limsups and liminfs at $0$ are actually attained as values of the expression for $h$ arbitrarily small.