Find all functions $f$ such that $f(x)\sin(1/x)$ continuous at $x_0 = 0$ A high-school problem. There is a mistake with the problem setting since $f(x)\sin(1/x)$ is undefined at $x=0$. You may alternatively use the limit here. The problem would thus become finding all functions $f$ such that $\lim_{x\to 0} f(x)\sin(1/x)$ exists.
 A: 
Find all the function $\,f\!:\!\big[\!-1,1\big]\to\mathbb R\,$ such that there exists $\,\lim_\limits{x\to0}f(x)\sin\left(\dfrac1x\right)=l\in\mathbb R\,.$

We will prove that
If $\,f\!:\!\big[\!-\!1,1\big]\!\to\!\mathbb R\,$ is a function such that there exists $\lim_\limits{x\to0}f(x)\sin\left(\!\dfrac1x\!\right)=l\in\mathbb R\;,\;$ then
$f(x)=\begin{cases}\dfrac{g(x)}{\sin\left(\frac1x\right)}\qquad\text{if }\;x\in\big[-1,1\big]\setminus A\\\\h(x)\qquad\quad\text{ if }\;x\in A\end{cases}$
where $\,g\!:\!\big[\!-\!1,1\big]\!\to\!\mathbb R\,$ is a function such that $\,\lim_\limits{x\to0}g(x)=0\,,\,$ $A=\left\{\dfrac1{\lambda\pi}\,,\;\lambda\in\mathbb Z\setminus\{0\}\right\}\cup\big\{0\big\}\;$ and $\;\;h:A\to\mathbb R\;$ is a real function defined on $\,A\,.\\$
Proof :
Let $\,x_n=\dfrac1{2n\pi}\in\big]0,1\big[\;$ for any $\,n\in\mathbb N\,.$
Since $\,\lim_\limits{n\to\infty}x_n=0\,,\,$ by applying the sequential Criterion for a limit of a function, we get that
$\lim_\limits{n\to\infty}f(x_n)\sin\left(\dfrac1{x_n}\right)=l\in\mathbb R\,.$
On the other hand, it results that
$\lim_\limits{n\to\infty}f(x_n)\sin\left(\dfrac1{x_n}\right)=\lim_\limits{n\to\infty}f(x_n)\sin\left(2n\pi\right)=0\,.$
Hence, by applying the Uniqueness of limits Theorem, it follows that $\,l=0\,,\,$ consequently ,
$\lim_\limits{x\to0}f(x)\sin\left(\!\dfrac1x\!\right)\!=\!0\,.$
Let $\,A\!=\!\left\{\!\dfrac1{\lambda\pi}\,,\;\lambda\in\mathbb Z\setminus\{0\}\!\right\}\!\cup\!\big\{0\big\}\;$ and let $\;h:\!A\to\mathbb R\;$ be the function defined as $\;h(x)=f(x)\;$ for all $\;x\in A\,.$
Now we define the function $\,g\!:\!\big[-1,1\big]\to\mathbb R\,$ as follows
$g(x)=\begin{cases} f(x)\sin\left(\!\dfrac1x\!\right)\qquad\text{if }\;x\in\big[-1,1\big]\setminus\big\{0\big\}\\\beta\in\mathbb R\qquad\qquad\text{ if }\;x=0\end{cases}$
It results that $\,\lim_\limits{x\to0}g(x)=0\,,\,$ moreover ,
$f(x)=\dfrac{g(x)}{\sin\left(\frac1x\right)}\quad\forall\,x\in\big[\!-\!1,1\big]\setminus A\;,$
$f(x)=h(x)\quad$ for all $\;x\in A\,.$

Now we will prove that
If $\,f\!:\!\big[\!-\!1,1\big]\!\to\!\mathbb R\,$ is a function such that
$f(x)=\begin{cases}\dfrac{g(x)}{\sin\left(\frac1x\right)}\qquad\text{if }\;x\in\big[-1,1\big]\setminus A\\\\h(x)\qquad\quad\text{ if }\;x\in A\end{cases}$
where $\,g\!:\!\big[\!-\!\!1,\!1\big]\!\!\to\!\mathbb R\,$ is any function such that $\,\lim_\limits{x\to0}g(x)=0\,,$ $A=\left\{\dfrac1{\lambda\pi}\,,\;\lambda\in\mathbb Z\setminus\{0\}\right\}\cup\big\{0\big\}\;$ and $\;\;h:A\to\mathbb R\;$ is any real function defined on $\,A\,,\,$ then
$\,\exists\lim_\limits{x\to0}f(x)\sin\left(\!\dfrac1x\!\right)\!=\!l\!\in\!\mathbb R\;.$
Proof :
Since $\; f(x)\sin\left(\!\dfrac1x\!\right)\!=\!g(x)\quad\forall\;x\in\big[\!-\!1,1\big]\!\setminus A\;\;,$
$f(x)\sin\left(\!\dfrac1x\!\right)\!=\!h(x)\sin\left(\lambda\pi\right)=0\quad\forall\;x\in A\setminus\{0\}$
and $\;\lim_\limits{x\to0}g(x)=0\;,\;$ it follows that
$\exists\lim_\limits{x\to0}f(x)\sin\left(\!\dfrac1x\!\right)=0=l\in\mathbb R\,.$

Consequently, all the function $\,f\!:\!\big[\!-1,1\big]\to\mathbb R\,$ such that there exists $\,\lim_\limits{x\to0}f(x)\sin\left(\dfrac1x\right)=l\in\mathbb R\;,\;$ are the following ones :
$f(x)=\begin{cases}\dfrac{g(x)}{\sin\left(\frac1x\right)}\qquad\text{if }\;x\in\big[-1,1\big]\setminus A\\\\h(x)\qquad\quad\text{ if }\;x\in A\end{cases}$
where $\,g\!:\!\big[\!-\!\!1,\!1\big]\!\!\to\!\mathbb R\,$ is any function such that $\,\lim_\limits{x\to0}g(x)=0\,,$ $A=\left\{\dfrac1{\lambda\pi}\,,\;\lambda\in\mathbb Z\setminus\{0\}\right\}\cup\big\{0\big\}\;$ and $\;\;h:A\to\mathbb R\;$ is any real function defined on $\,A\,.$

Addendum :
A subset of the set of all the function $\,f\!:\!\big[\!-1,1\big]\to\mathbb R\,$ such that there exists $\,\lim_\limits{x\to0}f(x)\sin\left(\dfrac1x\right)=l\in\mathbb R\;,\;$ is
$S=\left\{\varphi\!:\!\big[\!-\!1,1\big]\!\to\!\mathbb R\;\text{ such that }\;\exists\lim_\limits{x\to0}\varphi(x)=0\right\}.$
Proof :
Let $\,\varphi\!:\!\big[\!-\!1,1\big]\!\to\!\mathbb R\,$ be any function such that $\,\lim_\limits{x\to0}\varphi(x)=0\,.$
We will prove that $\;f=\varphi:\big[-1,1\big]\to\mathbb R\;$ is a function such that there exists $\,\lim_\limits{x\to0}f(x)\sin\left(\dfrac1x\right)=l\in\mathbb R\;.$
All the function $\,f\!:\!\big[\!-1,1\big]\to\mathbb R\,$ such that there exists $\,\lim_\limits{x\to0}f(x)\sin\left(\dfrac1x\right)=l\in\mathbb R\;,\;$ are the following ones :
$f(x)=\begin{cases}\dfrac{g(x)}{\sin\left(\frac1x\right)}\qquad\text{if }\;x\in\big[-1,1\big]\setminus A\\\\h(x)\qquad\quad\text{ if }\;x\in A\end{cases}$
where $\,g\!:\!\big[\!-\!\!1,\!1\big]\!\!\to\!\mathbb R\,$ is any function such that $\,\lim_\limits{x\to0}g(x)=0\,,$ $A=\left\{\dfrac1{\lambda\pi}\,,\;\lambda\in\mathbb Z\setminus\{0\}\right\}\cup\big\{0\big\}\;$ and $\;\;h:A\to\mathbb R\;$ is any real function defined on $\,A\,.$
If $\,g\!:\!\big[\!-\!\!1,1\big]\!\!\to\!\mathbb R\,$ is the real function defined as
$g(x)=\begin{cases}\varphi(x)\sin\left(\dfrac1x\right)\qquad\text{if }\;x\in\big[\!-\!1,1\big]\setminus\big\{0\big\}\\\;\;0\qquad\qquad\qquad\text{if }\;x=0\end{cases}$
and if $\;h:A\to\mathbb R\;$ is the real function defined as
$h(x)=\varphi(x)\quad$ for all $\;x\in A\;,$
then it results that
$\lim_\limits{x\to0}g(x)=\lim_\limits{x\to0}\varphi(x)\sin\left(\dfrac1x\right)=0\;\;$ and
$f(x)=\begin{cases}\dfrac{g(x)}{\sin\left(\frac1x\right)}=\varphi(x)\qquad\text{if }\;x\in\big[-1,1\big]\setminus A\\\\h(x)=\varphi(x)\qquad\quad\text{ if }\;x\in A\end{cases}$
Hence ,
$f=\varphi:\big[-1,1\big]\to\mathbb R\;$ is a function such that there exists $\,\lim_\limits{x\to0}f(x)\sin\left(\dfrac1x\right)=l\in\mathbb R\;.$
A: Let $g(x)=f(x)\sin\frac{1}{x}$ and $g(0)=0.$
We show that $$g(x)=x^2\sin\frac{1}{x}$$ is continuous at $x=0.$.
We find $\lim_{x\to 0} g(x)=0$ by sandwich theorem by noting that
$$-x^2\le x^2\sin \frac{1}{x}\le x^2\implies \lim_{x \to 0} -x^2= \lim_{x \to 0} x^2 \sin \frac{1}{x}=\lim_{x\to 0} x^2$$
Next,  $$\frac{dg(x)}{dx}=\lim_{h \to 0} \frac{h^2\sin \frac{1}{h}-0}{h}=\lim_{h\to 0} h \sin \frac{1}{h}=0, $$
by sandwich theorem as
$$-x\le x\sin \frac{1}{x}\le x\implies \lim_{x \to 0} -x= \lim_{x \to 0} x \sin \frac{1}{x}=\lim_{x\to 0} x=0.$$
Hence $g(x)$ when $f(x)=x^2$ is both continuous and differentiable at $x=0.$
