Understanding proof of L'Hopital's Rule I'm going over the proof for L'Hopital's rule from class, but there is a small but crucial point that I just can't get.
I'll copy the proof and highlight the problematic point. (EDIT: I see that I cannot highlight. My question is about the last line: why can we assume that $c_{x}\in\left(a,a+\delta\right)\,$? I saw in the internet explanations that if $x\to a$, then also $c_{x}\to a$, but it doesn't convince me. How would you justify/explain that $c_{x}$ is also within the $\delta$-neighbourhood of $a\,$?


given: $\underset{x\to a^{+}}{\lim}f\left(x\right)=\underset{x\to 
> a^{+}}{\lim}g\left(x\right)=0$,
$f,g$ differentiable in $(a,b]$,
$g'\left(x\right)\neq0$ for all $x\in(a,b]$,
$\underset{x\to a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)}$
exists.
So we get $\underset{x\to
> a^{+}}{\lim}\frac{f\left(x\right)}{g\left(x\right)}=\underset{x\to
> a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)}.$


And now for the proof:
let $\hat{g}\left(x\right)=\begin{cases}
g\left(x\right) & x\neq a\\
0 & x=a
\end{cases}\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\,\hat{f}\left(x\right)=\begin{cases}
f\left(x\right) & x\neq a\\
0 & x=a
\end{cases}$
such that $\hat{f}$ and $\hat{g} $ continuous in $\left[a,b\right]$ and differentiable in $\left(a,b\right)$.
Now, let $x\in(a,b]$ such that $\hat{f}$ and $\hat{g} $ continuous in $\left[a,x\right]$ and differentiable in $\left(a,x\right)$, so we can apply Cauchy's theorem and get $c_{x}\in\left(a,x\right)$ such that:
$$\frac{\hat{f}'\left(c_{x}\right)}{\hat{g}'\left(c_{x}\right)}=\frac{\hat{f}\left(x\right)-\hat{f}\left(a\right)}{\hat{g}\left(x\right)-\hat{g}\left(a\right)}.$$
Now, we defined $\hat{f}\left(a\right)=0$ and $\hat{g}\left(a\right)=0$ and also $\hat{f}\left(c_{x}\right)=f\left(c_{x}\right)$ and $\hat{g}\left(c_{x}\right)=g\left(c_{x}\right)$ for all $c_{x}\in\left(a,x\right)$, so we get:
$$\frac{f'\left(c_{x}\right)}{g'\left(c_{x}\right)}=\frac{\hat{f}'\left(c_{x}\right)}{\hat{g}'\left(c_{x}\right)}=\frac{\hat{f}\left(x\right)}{\hat{g}\left(x\right)}=\frac{f\left(x\right)}{g\left(x\right)}.$$
Now we have to deal the the cases $\underset{x\to a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)}=L\in\mathbb{R}$ or $\underset{x\to a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)}=\infty$ or $\underset{x\to a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)}=-\infty$. Let's take the first one.
given $\underset{x\to a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)}=L\in\mathbb{R}$, so by definition of limit:
$$\varepsilon>0\,\,\,\,\,\exists\delta>0\,\,\,\,\forall x\in(a,b]\,\,\,\,\,a<x<a+\delta\,\,\,\,\,\,\Rightarrow\,\,\,\,\,\,\left|\frac{f'\left(x\right)}{g'\left(x\right)}-L\right|<\varepsilon.$$
Now, let $\varepsilon>0$, so we get $\delta>0$ such that for all $x\in\left(a,a+\delta\right)$ we get $\left|\frac{f'\left(x\right)}{g'\left(x\right)}-L\right|<\varepsilon$.
Now, $a<c_{x}<x$ and actually $c_{x}\in\left(a,a+\delta\right)$  so we get also $\left|\frac{f'\left(c_{x}\right)}{g'\left(c_{x}\right)}-L\right|<\varepsilon$, therefore $\left|\frac{f\left(x\right)}{g\left(x\right)}-L\right|<\varepsilon$, so we get the limit definition for $\underset{x\to a^{+}}{\lim}\frac{f\left(x\right)}{g\left(x\right)}=L.$
 A: I think we can prove this without at all worrying about $b.\,\,\,$  Start with:
$$\underset{x\to a^{+}}{\lim}\frac{f'\left(x\right)}{g'\left(x\right)} \,\,=\,\, L,\,\,\, \text{some real number.}$$
The meaning of this (rather strong) hypothesis is that for any
$$\varepsilon>0,\,\,\,\exists\,\delta>0,\,\,\,\,\,\,\,\,\,\,a<x<a+\delta\,\,\,\,\,\,\Rightarrow\,\,\,\,\,\,\left|\frac{f'\left(x\right)}{g'\left(x\right)}-L\right|<\varepsilon.$$
This statement implies that $f'(x)$ and $g'(x)$ are defined for $(a,a+\delta)$. It also implies that $f(x)$ and $g(x)$ are defined there, and that $g'(x)$ is never zero there, for $x$ inside $(a,a+\delta)$.
But nothing is said about $f(a)$, $g(a)$, so as you wrote we can feel free to declare these outputs to be zero. Since we further assume:  $\underset{x\to a^{+}}{\lim}f\left(x\right)=\underset{x\to 
 a^{+}}{\lim}g\left(x\right)=0$, we can now say that each of $f$ and $g$ is continuous on $[a,a+\frac{1}{2}\delta],$ and of course differentiable in the interior. If $x$ is strictly between $a$ and $a + (1/2)\delta$, we can say the same thing about $f$ and $g$ on $[a,x] \subset [a,a+(1/2)\delta]$. Now apply Cauchy's theorem to express $f(x)/g(x)$ as $f'(c_x)/g'(c_x),$ with $a < c_x <x$.
Note that for the definition of the one-sided limit of $f/g$, we are using the "delta" of $(1/2)\delta$ in response to the arbitrary epsilon.
A: The case where $L$ is finite is been answered here Why does L'Hospital's rule require the limit to exist? About the proof.
For $L=\pm\infty$ the proof is similar to what is found in the link above. I show a short proof here too:
Suppose $L=\infty$. We can extend $f$ and $g$ to $[a,b)$ be setting $f(a)=0=g(a)$. Given $\varepsilon>0$ there is $x_\varepsilon\in (a,b)$ such that
$$
\frac{f'(x)}{g'(x)}>\frac{1}{\varepsilon}, \qquad\text{for all}\quad a<x\leq x_\varepsilon
$$
By the mean value theorem (the generalized version), for each $a<x<x_\varepsilon$, there is $a<c_x<x$ such that
$$
\frac{f(x)}{g(x)}=\frac{f(x)-f(a)}{g(x)-g(a)}=\frac{f'(c_x)}{g'(c_x)}.
$$
Hence, for all $a<x<x_\varepsilon$
$$
\frac{f(x)}{g(x)}=\frac{f'(c_x)}{g'(c_x)}>\frac{1}{\varepsilon}
$$
A very similar proof works for $x\rightarrow b-$. With a few teaks you may get also the cases where $a=-\infty$ or $b=\infty$.
