L' Hospital's Rule with general measurable function I come up with this question when I read L'Hospital's rule and think about non-continuous function case, more specifically, assume $0\leq g(x)\leq 1$, not necessarily continuous but a measurable function w.r.t Lebesgue measure and $$\lim_{\delta\rightarrow 0} \frac{1}{\delta}\int_0^\delta g(x)dx = C$$ for some real number C. The integration is defined in the Lebesgue sense.
For another function $f(x)$, defined on $[0,1]$, continuous and monotonic increasing, $f(0) = 0$, could we have the following hold: $$\lim_{\delta\rightarrow 0} \frac{\int_0^\delta f(x)g(x)dx}{\int_0^\delta f(x)dx} = C$$
I raise this question because if $g(x)$ is continuous, then by L'Hospital's rule, $g(\delta)\rightarrow C$ as $\delta\rightarrow 0$, and the above limit is clearly held by applying of the L'Hospital's rule again. But here what if there is no such good regularity of $g(x)$? For example, $g(x)$ could have no limit when $x$ goes to $0$.
If the second limit formula does not hold for all $f(x)$ function with the mentioned conditions, then could we impose more regularity of $f(x)$ to make this true?
Thank you so much!
 A: Counterexample:
Suppose $g(x) = \frac12 (1+\sin(1/x))$.  Then you can show that $C = \frac12$ (see below).  Now let $f(x) = x^{-2} \exp(-1/x)$, which for sufficiently small $x \ge 0$ satisfies your hypothesis.  Then
$$ \int_0^\delta f(x) \, dx = \exp(-1/\delta) $$
and
$$ \int_0^\delta f(x) g(x) \, dx = \tfrac12\exp(-1/\delta) (1 - \tfrac12(\sin(1/\delta) + \cos(1/\delta))) $$
and so you can see the ratio of the two quantities does not converge to $\frac12$ as $\delta \to 0$.
To see that $C = \frac12$, note that
\begin{aligned} \int_0^\delta \sin(1/x) \, dx &= \int_{1/\delta}^\infty y^{-2} \sin(y) \, dy  \\&= \big[- y^{-2} \cos(y) \big]_{1/\delta}^\infty - \int_{1/\delta}^\infty y^{-3} \cos(y) \, dy \\&= O(\delta^2) .\end{aligned}

What hypothesis on $f$ might make it work?  That $f$ satisfies an inequality like: there exists a constant $K>0$ such that for $t \ge 0$ sufficiently small:
$$ t f(t) \le K \int_0^t f(x) \, dx .$$
For example, if $f(x) \le \frac12K f(x/2)$.  So anything where $f(x)$ doesn't converge very rapidly to $0$ as $x \searrow 0$.
To see this, define
$$h(t) = \inf\{x : t \le f(x)\} $$
(in essence $h(t) = f^{-1}(t)$, but we don't know that such an inverse exists).
We show the formula:
\begin{aligned}
\int_0^\delta f(x) g(x) dx &= \int_{x =0}^\delta g(x) \int_{t=0}^{f(x)} \, dt \, dx \\
&= \int_{t=0}^{f(\delta)} \int_{\{x \in [0,\delta] : t \le f(x)\}} g(x) \, dx \, dt \\
\\
&= \int_{t=0}^{f(\delta)} \int_{x = h(t)}^\delta g(x) \, dx \, dt & (*)
\end{aligned}
Next, given $\epsilon>0$, there exists $\delta_0$ such that if $0 \le \delta < \delta_0$, then
$$ \delta C (1-\epsilon) \le \int_0^\delta g(x) \, dx \le \delta C (1+\epsilon). $$
Hence if $0 \le \eta \le \delta  < \delta_0$, then
$$ (\delta-\eta)C - (\delta + \eta) C \epsilon \le \int_\eta^{\delta} g(x) \, dx \le  (\delta-\eta)C + (\delta + \eta) C \epsilon $$
So if $0 < \delta < \delta_0$, then using formula $(*)$ twice (once where $g(x)$ replace by the constant function $C$)
\begin{aligned} \int_0^\delta f(x) g(x) dx &\le 
\int_{t=0}^{f(\delta)} (\delta - h(t))C + (\delta + h(t)) \epsilon \, dt \\
&\le
\int_{t=0}^{f(\delta)} \int_{h(t)}^\delta C \, dt + 2 \delta f(\delta) \epsilon \\
& = C \int_0^\delta f(x) \, dx + 2 \delta f(\delta) \epsilon \\
& = (C + 2 K \epsilon) \int_0^\delta f(x) \, dx . 
\end{aligned}
Similarly for a lower bound for $\int_0^\delta f(x) g(x) dx$.
