Let $f(x)=\sin(1/x)$, $x≠0$ and $f(0)=0$ then does there exist any function $g$ such that $g'=f$? My initial thought was in he direction let consider $\phi(x)=\int_0^{x} f(t) dt$. Now $\phi'(x)=f(x)$ if $f(t)$ is continuous at $x$. But here $f$ is not continuous so any help will be appreciated.
 A: Set $g(x)=x^2\cos(1/x)$ $(x \not=0)$, $g(0)=0$ and
$h(x)=2x\cos(1/x)$ $(x \not=0)$, $h(0)=0$. Note that $g$ is differentiable
and $h$ is continuous on $\mathbb{R}$. Set
$$
F(x)=g(x)-\int_0^x h(t)dt 
$$
Now for $x \not=0$
$$
F'(x)= 2x\cos(1/x) + \sin(1/x) -  2x\cos(1/x) =  \sin(1/x),
$$
and
$$
F'(0)=g'(0)-h(0)=0.
$$
Thus $F$ is a primitive of $f$.
A: The function $f$ has an antiderivative $g$ with the simple form,
$$g(x) = \int_0^x f(t) \, dt = \int_0^x \sin \frac{1}{t} \, dt$$
As observed, the continuity of $f$ away from $0$  implies that $g'(x) = f(x)$ for $x \neq 0$. It remains to show that $g'(0) = f(0) = 0$.  By definition of the derivative, we have
$$g'(0) = \lim_{h \to 0}\frac{1}{h}\int_0^h \sin \frac{1}{t} \, dt$$
Without loss of generality we can consider $h > 0$, since for $h < 0$ we have
$$\frac{1}{h}\int_0^h \sin \frac{1}{t} \, dt= -\frac{1}{|h|}\int_0^{-|h|} \sin \frac{1}{t} \, dt = -\frac{1}{|h|}\int_0^{|h|} \sin \frac{1}{(-t)} \, d(-t) =  -\frac{1}{|h|}\int_0^{|h|} \sin \frac{1}{t} \, dt$$
With the change of variables $y = 1/t$ and using integration by parts, we get
$$\int_0^h \sin \frac{1}{t} \, dt = \int_{1/h}^\infty \frac{\sin y}{y^2} \, dy = \left. \frac{2 \cos y}{y^3}\right|_{1/h}^\infty - 2 \int_{1/h}^\infty\frac{\cos y}{y^3} \, dy = -2h^3\cos \frac{1}{h}-  2\int_{1/h}^\infty\frac{\cos y}{y^3} \, dy $$
Thus,
$$g'(0) = \lim_{h \to 0}\left(-2h^2 \cos \frac{1}{h}\right) - \lim_{h \to 0}\frac{2}{h}\int_{1/h}^\infty \frac{\cos y}{y^3} \, dy $$
The first limit on the RHS is clearly $0$ since $\left|\cos \frac{1}{h}\right| \leqslant 1$.  The second limit is also $0$ since,
$$\left|\frac{2}{h}\int_{1/h}^\infty \frac{\cos y}{y^3} \, dy  \right|\leqslant \frac{2}{h}\int_{1/h}^\infty \frac{|\cos y|}{y^3}\leqslant \frac{2}{h} \int_{1/h}^\infty \frac{dy}{y^3} = h \underset{h \to 0} \longrightarrow 0$$
Therefore, $g'(0) = 0 = f(0)$.
