$\epsilon$-$\delta$ proof that $f(x) = x \sin(1/x)$, $x \ne 0$, is continuous

I'm doing an exercise that asks me to prove that $f$ is continuous using a $\epsilon$-$\delta$ proof. I have that $$ f(x) = \begin{cases} x\cdot \sin \frac1x,&x\neq 0 \\ 0,&x = 0 \end{cases} $$ I've already managed to show this property for $x=0$. How can I show it for $x \ne 0$, also using a $\epsilon$-$\delta$ proof?

Thank you very much.


Solution 1:

Let $a\neq 0$. By the triangle inequality, $$\begin{array}{ccc} \left|f(x)-f(a)\right| &=& \left|x\sin \frac1x-a\sin \frac1a\right| \\ &=& \left|x\sin \frac 1x-a\sin \frac 1x+a\sin \frac 1x-a\sin \frac1a\right| \\ &\le& \left|x-a\right|\left|\sin \frac 1x\right|+a\left|\sin \frac 1x-\sin \frac1a\right| \\ &<& \delta+a\left|\sin \frac 1x-\sin \frac1a\right| \end{array}$$ It all comes down to bounding the second term. By the trigonometric identity \begin{equation}\sin \alpha-\sin \beta=2\sin \frac{\alpha-\beta}2\cos \frac{\alpha+\beta}2\end{equation} we have $$\begin{array}{ccc} \left|\sin \frac 1x-\sin \frac1a\right| &=& \left|2\sin \frac{\frac1x-\frac1a}{2}\cos\frac{\frac1x+\frac1a}{2} \right| \\ &=& 2\left|\sin \frac{x-a}{2xa}\cos\frac{x+a}{2xa} \right| \\ &\le& 2\left|\sin \frac{x-a}{2xa}\right|\end{array}$$

Because $\left|\sin \alpha\right|\le \alpha$, \begin{equation}2\left|\sin \frac{x-a}{2xa}\right|\le 2\left|\frac{x-a}{2xa}\right|=\frac{\left|x-a\right|}{\left|x\right|\left|a\right|}\end{equation} As $\left|x-a\right|<\delta\implies \left|x\right|>\left|a\right|-\delta$, the situation is simplified if we choose $\delta<\frac{\left|a\right|}2$. Then, \begin{equation}\left|x-a\right|<\delta\implies \left|x\right|>\left|a\right|-\delta>\frac{\left|a\right|}2\implies \frac1{\left|x\right|}<\frac{2}{\left|a\right|}\end{equation} and so \begin{equation}\left|\sin \frac 1x-\sin \frac1a\right|\le\frac{\left|x-a\right|}{\left|x\right|\left|a\right|}<\frac{2\delta}{a^2}\end{equation} I belive you can finish this off.

Solution 2:

The function $f$ is continuous on $\Bbb R$ if and only if it is continuous at any point of $\Bbb R$. Since $$ f(x) = a(x)b(x) $$ for $x\neq 0$ and functions $a,b$ are continuous for $x\neq 0$, their product $f$ is also continuous for any $x\neq 0$.

Solution 3:

Although the answer given by @Nameless is complete in itself, a slight change in the choice of added terms in the triangle inequality helps a lot. A modified version of his answer is as follows.

Consider \begin{align*} \big|f(x)-f(a)\big|&=\left|x\sin\frac{1}{x}-a\sin\frac{1}{a}\right|\\ &=\left|x\sin\frac{1}{x}-x\sin\frac{1}{a}+x\sin\frac{1}{a}-a\sin\frac{1}{a}\right|\\ &=\left|x\left(\sin\frac{1}{x}-\sin\frac{1}{a}\right)+\sin\frac{1}{a}(x-a)\right|\\ &\leq|x|\left|\sin\frac{1}{x}-\sin\frac{1}{a}\right|+\left|\sin\frac{1}{a}\right|\big|x-a\big| \end{align*} By the trigonometric identity $\sin\alpha-\sin\beta=2\sin\frac{\alpha-\beta}{2}\cos\frac{\alpha+\beta}{2}$, we have \begin{align*} \left|\sin\frac{1}{x}-\sin\frac{1}{a}\right|&=\left|2\sin\frac{\frac{1}{x}-\frac{1}{a}}{2}\cos\frac{\frac{1}{x}-\frac{1}{a}}{2}\right|=2\left|\sin\frac{a-x}{2ax}\cos\frac{x+a}{2ax}\right|\\ &\leq2\left|\sin\frac{a-x}{2ax}\right|\leq2\left|\frac{x-a}{2ax}\right|=\frac{|x-a|}{|a||x|} \end{align*} Therefore, \begin{align*} \big|f(x)-f(a)\big|&=|x|\left|\sin\frac{1}{x}-\sin\frac{1}{a}\right|+\left|\sin\frac{1}{a}\right|\big|x-a\big|\\ &\leq\frac{|x-a|}{|a|}+\frac{|x-a|}{|a|}=\frac{2|x-a|}{|a|} \end{align*} Thus we see that for any $\varepsilon>0$, we can find $\delta=\frac{|a|\varepsilon}{2}$ such that

$$\big|f(x)-f(a)\big|<\varepsilon\qquad\text{whenever}\qquad|x-a|<\delta$$

showing that $f$ is continuous at all points $a\neq0$