# Example of an integrable, but discontinuous function

Define  $g:ℝ\to ℝ$ by  .  For g we have:

1. g is differentiable and  .

2. ${g}^{\prime }$ is discontinuous (at 0).

Proof:

1.  If $x\ne 0$ we see that g is differentiable at x due to the product and the chain rule [7.6.3/11]. The derivation at x calculates to

${g}^{\prime }\left(x\right)=2x\cdot \mathrm{sin}\frac{1}{x}+{x}^{2}\cdot \mathrm{cos}\frac{1}{x}\cdot \left(-\frac{1}{{x}^{2}}\right)=2x\cdot \mathrm{sin}\frac{1}{x}-\mathrm{cos}\frac{1}{x}$

If $x=0$ we need to check if the difference quotient function $\frac{g-g\left(0\right)}{\mathrm{X}-0}$ has a limit. But as the following estimate holds for all $x\ne 0$ (note that sin is bounded by 1)

$0\le |\frac{g\left(x\right)-g\left(0\right)}{x-0}|=|\frac{{x}^{2}\cdot \mathrm{sin}\frac{1}{x}}{x}|=|x|\cdot |\mathrm{sin}\frac{1}{x}|\le |x|$

the identity $\underset{x\to 0}{\mathrm{lim}}\frac{g\left(x\right)-g\left(0\right)}{x-0}=0$ is valid, so that g is differentiable at 0 with ${g}^{\prime }\left(0\right)=0$.

2.  As e.g. $\frac{1}{2\pi n}\to 0$, but ${g}^{\prime }\left(\frac{1}{2\pi n}\right)=\frac{1}{\pi n}\mathrm{sin}\left(2\pi n\right)-\mathrm{cos}\left(2\pi n\right)=-1\to -1\ne {g}^{\prime }\left(0\right)$, we find ${g}^{\prime }$ to be discontinuous at 0.

So we know that  $f≔{g}^{\prime }$ is discontinuous and has a primitive.