How does the chain rule for limits work? I have to evaluate the limit of this function, 
$$\lim_{x\to0^+} \arctan(\ln x)$$
I already know the answer, it's $-\dfrac{π}{2}$, but the only part I don't get it, how does it come to that? I did the following steps:
$$\lim_{x\to0^+} \arctan(\ln x)
= \arctan\left(\lim_{x\to0^+} \ln x\right)$$
The limit of $\ln(x)$ when $x$ approaces $0^+$ is negative infinity, wouldn't that mean the answer we're looking for is arctan of negative infinity, which is something we can't find?
Still, it goes to:
$$\lim_{x\to -\infty} \arctan (x) = -\dfrac{\pi}{2}$$, which is how the answer seem to work? How does this happen? And, how does the chain rule come in all this? 
Thank you in advance for your answer.
 A: Look at the expression
$$\lim_{x \to 0^+} \arctan(\ln x)$$
Let $u = \ln x$. Then $u \to -\infty$ as $x \to 0^+$. So we can substitute $u$ for $\ln x$ and $u \to -\infty$ for $x \to 0^+$ to obtain
$$\lim_{x \to 0^+} \arctan(\ln x) = \lim_{u \to -\infty} \arctan(u)$$
This evaluates to $-\dfrac{\pi}{2}$.
All we did was substitute a new variable; nothing too in-depth!
A: As $x$ approaches $0$ from the right, $\ln x$ becomes very large negative. As $w$ becomes very large negative, $\arctan w$ approaches $-\frac{\pi}{2}$. 
A: As $x$ approaches $-\dfrac{π}{2}$ from the right it will approach negative infinity, so $$\lim_{x\to-\infty}\arctan (x)=-\dfrac{π}{2}$$
A: The theorem says that if $\lim_{x \to c} g(x) = w$ and $f$ is continous at $w$, then $\lim_{x \to c} f(g(x)) = f( \lim_{x \to c} g(x))$. Clearly, the statement "$f$ is continous at $w$ assumes that $w$ is a real number. This is the premise your limit fails. Your $w$ is "$\infty"$.
A: I see that some years ago, I commented on the accepted answer (by @Clive Newstead) and said why it was incomplete.  And there is an answer by @Ovi explaining why a common chain-rule theorem for limits doesn't apply.  But no answer yet states a precise, true theorem about limits that does apply here to explain the answer.  So let me fix that.
As Ovi noted, one theorem is that $ \lim \limits _ { x \to c } f ( g ( x ) ) = f ( w ) $ if $ w = \lim \limits _ { x \to c } g ( x ) $ exists and $ f $ is continuous there.  This is completely inapplicable, since $ w $ is infinite in this case, and so there's no way that $ f $ could be continuous there; we can't even say that $ f $ is defined at $ w $.
But another theorem is that $ \lim \limits _ { x \to c } f ( g ( x ) ) = \lim \limits _ { u \to w } f ( u ) $ if $ w = \lim \limits _ { x \to c } g ( x ) $ exists (possibly as a form of infinity) and $ w $ is not in the range of $ g $ (including when $ w $ is a form of infinity), as long as $ \lim \limits _ { u \to w } f ( u ) $ also exists.  And that's what we have here!  (Actually, it's even possible for $ w $ to be in the range of $ g $ as long as there is a deleted neighbourhood of $ c $ on which it is not; that is, whenever there is a $ \delta > 0 $ such that $ g ( x ) $ is never $ w $ when $ 0 < \lvert x - c \rvert < \delta $.)
I should link to some reference where this theorem is stated, but I haven't found one, and writing out the general proof involves tedious cases.  So instead, let me run through this example, showing how, given $ \epsilon > 0 $, to find $ \delta > 0 $ such that whenever $ 0 < x - 0 < \delta $, $ \lvert \arctan \ln x - ( - \pi / 2 ) \rvert < \epsilon $, without using any knowledge about arctangents and logarithms other than the two relevant limits and the fine print about the range.
So given $ \epsilon _ 1 > 0 $, since $ \lim \limits _ { u \to - \infty } \arctan u = - \pi / 2 $, there exists $ \delta _ 1 > 0 $ such that whenever $ 0 < - 1 / u < \delta _ 1 $, $ \lvert \arctan u + \pi / 2 \rvert < \epsilon _ 1 $.  Now let $ \epsilon _ 2 $ be $ \delta _ 1 $; since $ \lim \limits _ { x \to 0 ^ + } \ln x = - \infty $ and $ \epsilon _ 2 > 0 $, there exists $ \delta _ 2 > 0 $ such that whenever $ 0 < x < \delta _ 2 $, $ 0 \leq - 1 / \ln x < \epsilon _ 2 $.  So if we start with $ \epsilon = \epsilon _ 1 $, in the end we want $ \delta = \delta _ 2 $.
Let's check that ths works!  So given $ x $ such that $ 0 < x < \delta = \delta _ 2 $, we know that $ 0 \leq - 1 / \ln x < \epsilon _ 2 $.  Since $ - 1 / \ln x $ cannot equal $ 0 $ (in other words, $ - \infty $ is not in the range of the natural logarithm, which is less trivial when you apply this reasoning to finite limits), in fact $ 0 < - 1 / \ln x < \epsilon _ 2 = \delta _ 1 $.  Let $ u $ be $ \ln x $; since $ 0 < - 1 / u < \delta _ 1 $, $ \lvert \arctan u + \pi / 2 \rvert < \epsilon _ 1 $.  In other words, $ \lvert \arctan \ln x + \pi / 2 \rvert < \epsilon $, which is what we need.
tl;dr:  $ \lim \limits _ { x \to c } f ( g ( x ) ) = \lim \limits _ { u \to w } f ( u ) $ if $ w = \lim \limits _ { x \to c } g ( x ) $ exists (possibly as a form of infinity) and $ w $ is not in the range of $ g $ (including when $ w $ is a form of infinity), as long as $ \lim \limits _ { u \to w } f ( u ) $ also exists.  (And it's also OK if $ w $ is in the range of $ g $ because $ g ( c ) = w $ and/or because $ w = g ( x ) $ for values of $ x $ far from $ c $.  And finally, if $ f $ is continuous at $ w $, as already noted, then no conditions apply to the range of $ g $.)
