A pathological example of a differentiable function whose derivative is not integrable

First I’ll make a definition:
$$\operatorname{Loc-int}(g):=\left\lbrace x\in[0,1] : \exists \epsilon>0\text{ s.t. }\int_{(x-\epsilon,x+\epsilon)\cap[0,1]}|g|dm<\infty\right\rbrace,$$
where $m$ is the Lebesgue measure.

I’ve been searching for weeks now for an example that suits the next terms:
$$\forall \lambda \in(0,1) \exists f:[0,1] \to \mathbb{R}\text{ measurable, differentiable s.t. } m\left([0,1]/\operatorname{Loc-int}(f’)\right)>\lambda.$$

Until now I’ve only managed to find an example of differentiable function that is not locally integrable at $x=0$.
Any help would be appreciated!

Solutions Collecting From Web of "A pathological example of a differentiable function whose derivative is not integrable"

I’ll make a suggestion on the idea which might help. Let’s take a Cantor set of positive measure (the idea is to cut off the intervals of length ratio slightly less than one third; the exact value of this “slightly less” can be deduced). We can have that measure in $[0,1)$.

Now, on each interval that we cut off we introduce a function that behaves like $(x-x_i)^2\sin\left(\frac{1}{(x-x_i)^2}\right)$ near the ends of the interval with $x_i$ being those ends. Thanks Samprity for this function.

hHe hypothesis is that we have a function on the whole interval with a derivative being non-integrable on a set of positive measure (still need a formal proof of this fact, as JonathanY. mentioned).

This is an example of such type of functions.

$$f(x) = \begin{cases}x^2 \sin{(\frac{1}{x^2})} & \text{when } x \neq 0 \\ 0 &\text{when } x = 0\end{cases}$$

$f$ is differentiable in $\mathbb{R}$. Its derivative will be

$$f'(x) = \begin{cases}2x \sin{(\frac{1}{x^2})} – \frac{1}{x} \cos{(\frac{1}{x^2})} &\text{when } x\neq 0 \\ 0 &\text{when } x = 0\end{cases}$$

Now see $f'(x)$ is unbounded in any closed interval around $0$, like $[-1,1]$ as it contains an unbounded term $\frac{1}{x}$, so not Riemann integrable. So $f(x)$ is a differentiable function whose derivative is not integrable. I hope you can fined explanation in Lebesgue measure as I do not know it properly.

Thank you for a little Latex correction.