\documentclass[a4paper,12pt]{article}
\usepackage{epsfig}
\newcommand{\ds}{\displaystyle}
\setlength{\textwidth}{6.5in} \setlength{\textheight}{9in}
\setlength{\topmargin}{-.25in} \setlength{\oddsidemargin}{-.25in}
\newcommand\br{\textbf{R}}
\pagestyle{empty}
\begin{document}

\parindent=0pt

\bf{Question}

\quad Consider the function $f:\br\to\br$ defined by
$$f(x)=\cases{x^2\sin({1\over x}),&$x\ne0$\cr
                    0,&$x=0$.\cr}$$
Show that

(i)\quad $f$ is continuous everywhere (pay special attention to
$x=0$);

(ii)\quad $f$ is differentiable everywhere (likewise);

(iii)\quad its derivative $f'$ is {\it not} continuous at $x=0$.
\smallskip
[Thus $f$ is differentiable everywhere but not $C^1$ in any region
containing the origin.]
\medskip
Show that the function $f^2$ is $C^1$ but not $C^2$ in any region
containing the origin.



\bf{Answer}

\begin{description}
\item{(i)}
The function $f$ is continuous at every $x \ne 0$ since it is
obtained by multiplying and composing elementary continuous
functions.

($\sin x$ is continuous everywhere as it is given as a convergent
power series, or just check $|\sin (x+h) - \sin x| = |2 \cos (x +
\frac{h}{2} \sin \frac{h}{2} | < 2|\frac{h}{2}| = |h|$. So if
$h\to 0$ then $\sin (x+h) \to \sin x$.)

At $x=0$ we must verify explicitly
\begin{eqnarray*}
|f(h)-f(0)| & = & |h^2 \sin (\frac{1}{h}) - 0|\\ & \leq & |h^2|
\end{eqnarray*}
(as $|\sin\theta|\leq 1$ always)

so $f(h) \to f(0)$ as $h \to 0$.

\item{(ii)}
The function $f$ is differentiable at every $x\ne 0$ since it is
obtained by multiplying and composing elementary differentiable
forms.

Indeed, for $x \ne 0$ we have
\begin{eqnarray*}
f'(x) & = & 2x \sin \left ( \frac{1}{x} \right ) + x^2 \cos \left
( \frac{1}{x}\right ) . \left ( -\frac{1}{x^2} \right )\\ & = &
2x\sin \left ( \frac{1}{x} \right ) - \cos \left ( \frac{1}{x}
\right ).
\end{eqnarray*}

At $x=0$ we observe explicitly
\begin{eqnarray*}
f(0+h) -f(0) & = & h^2\sin \frac{1}{h}\\ & = & 0 + h \\
\textrm{and } |h\sin \left ( \frac{1}{h} \right )| & \leq & |h|
\to 0 \textrm{ as } h\to 0
\end{eqnarray*}
so $f$ is differentiable at $0$ with $f'(0)=0$.

\item{(iii)}
Looking at the above, we see $f'(x) \rightarrow f'(0)$ as $x\to
0$. (Indeed, $\lim_x\to 0 f'(x)$ doesn't exist). Thus $f$ is not
continuous at $x=0$.

We have $\left. \begin{array}{rlr} f^2{x} & = x^4
\sin^2(\frac{1}{x}) & ,x \ne 0\\ & = 0 &,x=0 \end{array} \right
\}.$

We find $$(f^2)'(x) = 4x^3 \sin \left ( \frac{1}{x} \right ) -2x^2
\sin \left (\frac{1}{x} \right ) \cos \left ( \frac{1}{x} \right
), \ x\ne 0$$ and (much as in (ii)) $(f^2)'(0) =0$.

Since $|\sin\theta \cos\theta | \leq 1$ for all $\theta$ we see
$$(f^2)'(x) \to (f^2)'(0), \ \ \textrm{as } x\to 0.$$ So $(f^2)'$
is continuous at $0$ (and elsewhere), which says $f^2$ is $c$.

However, $(f^2)'$ is not $c^1$ in any region containing $0$
($\Rightarrow f^2$ is not $c^2$ there) as the $2^{nd}$ term is
$-x^2\sin (\frac{2}{x})$: compare (ii), (iii) above.
\end{description}


\end{document}
