Prove that a function f is continuous (1) $f:\mathbb{R} \rightarrow \mathbb{R}$ such that

$$f(x) =
\begin{cases}
x \sin(\ln(|x|))& \text{if $x\neq0$} \\
0 & \text{if $x=0$}  \\
\end{cases}$$
Is $f$ continuous on  $\mathbb{R}$?

I want to use the fact that 2 continuous functions:

$$f:I \rightarrow J ( \subset \mathbb{R})$$
$$g:J \rightarrow \mathbb{R}$$
$$g \circ f:I \rightarrow \mathbb{R}, x \mapsto g(fx) $$
1)For $f=\ln(|x|)$:

"By the inverse of the Fundamental Theorem of Calculus, $\ln x$ is defined as an
integral, it is differentiable and its derivative is the integrand $1=\frac{1}{x}$.
As every differentiable
function is continuous, therefore $\ln x$ is continuous."
 so $f=\ln(|x|) ,I \in ]0, \infty)$ 
$f$ is continuous.


2)For $g= \sin(x)$:

if $\epsilon > 0, \exists \delta>0:$
 $$x \in J \wedge |x - x_0| < \delta  , x_0  \in \mathbb{R} $$

$$\Rightarrow |f(x) - f(x_0)| \epsilon \Leftrightarrow |\sin(x)-\sin(x_0)|< \epsilon$$
$$|\sin(x)| \leq |x|$$
$$\Leftrightarrow |\sin(x)-\sin(x_0)|<|x - x_0| < \delta = \epsilon$$
So $g$ is continuous on  $\mathbb{R}$

3)Because x is also continous on $\mathbb{R}$

$ \Rightarrow x \sin(\ln(|x|))$  is continuous.


Is my proof correct?

Are there shorter ways to get this result?

At any $x\ne 0$ the function $f$ is a composite of continuous functions ($\ln$, $\sin$, and $|-|$ are continuous functions). Since the composite of continuous functions is continuous, it follows that $f$ is continuous for all $x\ne 0$. Now, at $x=0$ you need to use something else. In this case, use the fact that if $g(x)$ is a bounded function and $h(x)$ has $\lim _{x\to 0}h(x)=0$, then $\lim_{x\to 0}g(x)\cdot h(x)=0$. Thus, write $f$ as a product $g(x)\cdot h(x)$ for suitable functions that satisfy the conditions. With that you will have proven that $\lim_{x\to 0} f(x)=0=f(0)$ and thus that $f$ is also continuous at $x=0$.
