Uniform continuity of $f(x) = x \sin{\frac{1}{x}}$ for $x \neq 0$ and $f(0) = 0.$

For the $f(x) = x \sin{\frac{1}{x}}$ for $x \neq 0$ and $f(0) = 0,$ my text book asks the following questions.

(b) Why is $f$ uniformly continuous on any bounded subset of $\mathbb{R}$?

(c) Is $f$ uniformly continuous on $\mathbb{R}$??

The graph for the function is this.

Graph

For the question (b), if I take subset between $[0.2,0.6]$ or the subset where the slope is steep, I don't think the function is uniformly continuous because I think for a given $\epsilon>0$, there is no unique $\delta >0$ for the bounded subset. Therefore, it also cannot be uniformly continuous on $\mathbb{R}.$ However, the questions sounds like the function is uniformly continuous and the book says that it is uniformly continuous. The answer on the book says something but I need more explanation. Thanks.


For b:

1) Show that $f$ is continuous at $0$. To do so, notice that $|f(x) - f(0)| = |x \sin(1/x)| \leq |x|$, so $\lim_{x \to 0} |f(x)-f(0)| \leq \lim_{x \to 0}|x| = 0$. Therefore $\lim_{x \to 0} f(x) = f(0)$ and this tells us that $f$ is continuous at $0$.

2) Now argue that $f$ is continuous on all $\mathbb{R}$ since it is continuous at $0$ (from 1) and on $\mathbb{R} \backslash\{0\}$ (as the product and composition of continuous functions there).

3) Since $f : \mathbb{R} \to \mathbb{R}$ is continuous, then on any bounded subset it is uniformly continuous. Why? Let $U \subset \mathbb{R}$ be continuous. Then for some $R > 0$, $U \subset [-R, R]$. Since $f$ restricted to $[-R,R]$ is uniformly continuous (a continuous function restricted to a compact set is uniformly continuous), then $f$ is uniformly continuous for any subset of $[-R,R]$ (in particular, $U$).

For c:

$f$ is uniformly continuous on $\mathbb{R}$. Why? You know that $f$ is uniformly continuous on $[-1, 1]$, say. Outside of $[-1,1]$, notice that the derivative of $f$ is $f'(x) = \sin(1/x) - \cos(1/x)/x$ and (since we're restricted away from the orgin), this means that $f'(x)$ is bounded. In particular $|f'(x)| \leq 2$ for every $|x| \geq 1$. This means that $f$ is Lipschitz continuous with Lipschitz constant at most $2$ on the compliment of $[-1,1]$. That means that if $x, y\in [-1,1]^c$ then $|f(x)-f(y)|\leq 2 |x-y|$. To put these pieces together, you can say the following:

Let $\epsilon > 0$. Find $\delta_1 > 0$ such that if $x,y \in [-2, 2]$ then $|f(x)-f(y)|<\epsilon$ (which you can do by part b). Let $\delta = \min(\delta_1, \epsilon/2, 1)$. Now, if $x, y \in \mathbb{R}$ such that $|x-y| < \delta$, then either $x,y \in [-2,2]$ or $x,y \in [-1,1]^c$ (since we chose $\delta \leq 1$). If $x,y \in [-2,2]$ then $|x-y|<\delta \leq \delta_1$, so $|f(x)-f(y)|<\epsilon$. Otherwise, if $x,y \in [-1,1]^c$ then $$|f(x) - f(y)|\leq 2 |x-y| < 2 \delta \leq 2 (\epsilon/2) = \epsilon$$ In either case, $|x-y|<\delta \implies |f(x)-f(y)|<\epsilon$ showing that $f$ is uniformly continuous.


This function $f(x)=x\sin (1/x)$ is even so I show uniformness on $[0,∞)$ spilit this as $[0,1]$ and $[1,∞]$ now note that this is a continuous on $[0,1]$ so uniform there. And $f'(x)=\sin(1/x)-\cos (1/x)/x$ and limit $x$ tends to $∞$, $f'(x)$ becomes $0$ so $f'(x)$ is bounded for $x\geq 1$ hence $f$ is uniform on $[1,∞)$ & hence the result.


Would anyone be so kind as to critique the following direct demonstration that $\displaystyle x \sin \frac{1}{x}$ is uniformly continuous on $(0,1)$ ?

Let $\epsilon > 0$ and let $x, y \in (0,1)$. Then \begin{align*} x\sin\frac{1}{x} - y \sin\frac{1}{y} &= x\sin\frac{1}{x} - y\sin\frac{1}{x} + y\sin\frac{1}{x} - y \sin\frac{1}{y} \\ &= (x-y)\sin\frac{1}{x} + y \left ( \sin\frac{1}{x} - \sin\frac{1}{y} \right ), \end{align*} so \begin{equation} \label{eq: star} \left | x\sin\frac{1}{x} - y \sin\frac{1}{y} \right | \leq |x - y| + y \left | \sin\frac{1}{x} - \sin\frac{1}{y} \right |. \end{equation} But \begin{align} \label{eq: starstar} \left | \sin\frac{1}{x} - \sin\frac{1}{y} \right | &= \left | 2 \cos \left ( \frac{1}{2} \left ( \frac{1}{x} + \frac{1}{y} \right ) \right ) \sin \left ( \frac{1}{2} \left ( \frac{1}{x} - \frac{1}{y} \right ) \right ) \right | \notag \\ &\leq 2 \left | \sin \frac{y-x}{2xy} \right | \notag \\ &\leq \frac{|y - x|}{|xy|} \notag \\ &= \frac{|x - y|}{xy}. \end{align} By \eqref{eq: star} and \eqref{eq: starstar} we have \begin{equation} \label{eq: potato} \left | x \sin\frac{1}{x} - y \sin\frac{1}{y} \right | \leq |x-y| + \frac{|x-y|}{x} =|x-y| \left ( 1 + \frac{1}{x} \right ). \end{equation} By symmetry, we also have \begin{equation} \label{eq: banana} \left | x \sin\frac{1}{x} - y \sin\frac{1}{y} \right | \leq |x-y| \left ( 1 + \frac{1}{y} \right ). \end{equation} Now let $\gamma > 0$. \

\noindent \textbf{Case I:} Suppose $x \geq \gamma$ or $y \geq \gamma$. Then \eqref{eq: potato} and \eqref{eq: banana} imply that \begin{equation} \left | x \sin\frac{1}{x} - y \sin\frac{1}{y} \right | \leq |x-y| \left (1 + \frac{1}{\gamma} \right ), \end{equation} so we should let $\displaystyle \delta = \frac{\epsilon}{1 + \frac{1}{\gamma}}$. \

\noindent \textbf{Case II:} Suppose instead that $x < \gamma$ and $y < \gamma$. Then $\displaystyle \left | x \sin\frac{1}{x} - y \sin\frac{1}{y} \right |$ equals either $\displaystyle x \sin\frac{1}{x} - y \sin\frac{1}{y}$ or $\displaystyle y \sin\frac{1}{y} - x \sin\frac{1}{x}$. But \begin{equation} x \sin\frac{1}{x} - y \sin\frac{1}{y} \leq x - (-y) = x + y < 2 \gamma, \end{equation} and similarly, \begin{equation} y \sin\frac{1}{y} - x \sin\frac{1}{x} < 2 \gamma, \end{equation} hence \begin{equation} \left | x \sin\frac{1}{x} - y \sin\frac{1}{y} \right | < 2 \gamma, \end{equation} so we should set $\displaystyle \gamma = \frac{\epsilon}{2}$.

\noindent To summarise, let \begin{equation} \delta = \frac{\epsilon}{1 + \frac{1}{\epsilon/2}} = \frac{\epsilon}{1 + \frac{2}{\epsilon}} = \frac{\epsilon^2}{\epsilon + 2}. \end{equation} Then \begin{equation} |x-y| < \delta \Rightarrow \left | x \sin \frac{1}{x} - y \sin \frac{1}{y} \right | < \epsilon. \end{equation}

\noindent Therefore $\displaystyle h(x) = x \sin \frac{1}{x}$ is uniformly continuous on $(0,1)$.