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

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.


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)$.