Help understanding proof of l'Hospital's rule from Rudin 

This is the entire proof for the 0/0 case and I am very lost. I understand choosing $r>A$, but I don't understand why we're choosing $q$. I can see why 18 is true, but I do not understand how the strict inequality becomes a weak inequality going from (18) to (19). Finally, and perhaps most importantly, I don't understand how (19) shows that $f(x)/g(x)\rightarrow A$ as $x\rightarrow a$. 
Can someone help me follow this through?
 A: That's not the entire proof. It's half of it; the other half is on the next page (although that's definitely not clear from the way it's written). 
What Rudin is doing is choosing two points $p,q$ with $p<A<q$, and proving that  $p<f(x)/g(x)<q$ for $x$ close enough to $a$. 
The use of $r$ (and other similar choices in the proof) is usually due to the fact that the theorems he is quoting require open intervals. 
The inequality thing from (18) to (19) is the well-known fact that if you have $x_n<k$ and $x_n\to x$, then $x\leq k$ (there might not be strict inequality: for instance take $x_n=1-1/n$, $k=1$).
A: I actually quite like this proof after puzzling through it for a while. I'll only address the first half of the proof, and I can answer each of your questions about


*

*Why we are choosing $r$ and $q$ and

*In going from (18) to (19), how we go from strict to non-strict inequality.


First to lay some groundwork. (I'm going to quote Rudin's Definition 4.33 first.) Let $f$ be a real function defined on $E\subset\mathbf R$. We say that
$$
f(t)\to A\:\text{as}\:t\to x,
$$
where $A$ and $x$ are in the extended real number system, if for every neighborhood $U$ of $A$ there is a neighborhood $V$ of $x$ such that $V\cap E$ is not empty, and such that $f(t)\in U$, for all $t\in V\cap E$, $t\ne x$.
In the first case, we are considering the case where $A$ could be $-\infty$ or some real number. The idea is we are trying to show that for every neighborhood $U$ of $A$ there is some neighborhood $(a,c)$ such that we can squeeze the quotient $f(y)/g(y)$ past the right endpoint of $U$ into $U$ when $y\in (a,c)$. Think of the neighborhood $U$ as having right endpoint $q$. 
Thus, we choose $A<r<q$, and for concreteness we choose $r$ so we have something concrete to try to squeeze under. If, in the limit, we end up just scraping by with non-strict inequality on $r$, we will have $q$ to give us wiggle room. This should make it clear that we could write the whole proof without mentioning $q$ until the very end, but never mind that for now. If it's still confusing, read on and come back to this point. $(\ast)$
To address 2., suppose we have a framework as in Rudin's Definition 4.33 and furthermore that $f(x)<M$ for all $x\in E$ and that $p$ is a limit point of $E$. Then, we claim that
$$
\lim_{x\to p}f(x)\le M.
$$
This is an easy proof by contradiction. If $\lim f(x)>M$, then the idea is we should be able to find some neighborhood around $\lim f(x)$ such that in that neighborhood all the values $f(x)$ are greater than $M$, a clear contradiction of our hypothesis that $f(x)< M$ on $E$. From Rudin's (18), define
$$
h(x) = \frac{f(x)-f(y)}{g(x)-g(y)}.
$$
If you agree that $h(x)<r$ on $(a,y)$, then since $a$ is a limit point of $(a,y)$, and by our previous discussion
$$
\lim_{x\to a}h(x) = \lim_{x\to a}\frac{f(x)-f(y)}{g(x)-g(y)} =\frac{f(y)}{g(y)}\le r.
$$
That is how we get the non-strict inequality. We're not quite done because we promised we could squeeze the quotient $f(y)/g(y)$ into arbitrary neighborhoods of $A$, but our non-strict inequality is preventing that. This is where $q$ comes in. If we note that for arbitrary $q>r$, we could get $f(y)/g(y)<q$, then we're done. Rudin does it to start to avoid mentioning this at the end, succinct as always. At this point if you were struggling with $(\ast)$, revisit that paragraph, and I think that the big picture should be clearer.
