Limit of a function (correctness of the argument) 
If I know $\lim_{x \to \infty} f(x)= \infty$, when the following statement is correct?
  $$\lim_{x \to \infty} g(f(x))= \lim_{u \to \infty} g(u)$$

This is how I think is correct, can you please let me know your idea? Where can I read to learn more about such cases?
 A: Nope. Let $g(x)=\begin{cases}n \text{ for } x=n\\0 \text{ else}\end{cases}$
Let $f(x)=\begin{cases}n \text { for } x\in [n,n+1)\end{cases}$
Then $\lim_{x\to\infty} f(x)=\infty$ but $\lim_{u\to\infty} g(u)$ doesn't exist and doesn't diverge to $\infty$. 
A: If they exists, then they are same. Suppose $\lim_{u\to \infty} g(u)=L$. 
Then for any $\epsilon >0$, we can choose $a$ s.t. $u>a\Rightarrow |g(u)-L|<\epsilon$. Since $\lim_{x\to \infty}f(x)=\infty$, we can choose $b$ s.t. $x>b\Rightarrow f(x)>a$. So $x>b\Rightarrow |g(f(x))-L|<\epsilon$ and we get $\lim_{x\to \infty} g(f(x))=L$. 
A: Usually the rules of algebra of limits (and in particular the substitution rule) are expressed in the form of identities of type $A = B$, however it is very important to understand that these identities are conditional and may fail to hold if the mentioned conditions are not met.
The current question deals with the rule of substitution of limits which says that:
If $\lim\limits_{u \to a}f(u) = L$ and $\lim_{x \to b}g(x) = a$ and $g(x) \neq a$ in a certain deleted neighborhood of $b$ then $\lim\limits_{x \to b}f(g(x)) = L$.
The last conclusion of the rule is often written as $$\lim_{x \to b}f(g(x)) = \lim_{u \to a}f(u)\tag{1}$$ and it is this equation only which most students remember. Most of the times the fact that the identity above holds only when certain conditions are met is not registered.
Note that the above rule holds even if $a, b, L$ are replaced by $\pm\infty$ but then the third condition $g(x) \neq a$ holds automatically and therefore it need not be checked in order to apply this rule. But note that the limits $\lim_{u \to a}f(u) = L, \lim_{x \to b}g(x) = a$ must exist (including the case when one or more of $a, b, L$ are infinite).
If these conditions do not hold then the identity $(1)$ may fail to hold. Let's try to understand deeply the link between the limits $$\lim_{u \to a}f(u) = L\tag{2}$$ and $$\lim_{x \to b}f(g(x)) = L\tag{3}$$ in the light of the information that $\lim_{x \to b}g(x) = a$.
Thus in order that $(2)$ holds we should be able to find a $\delta > 0$ for each $\epsilon > 0$ such that $|f(u) - L| < \epsilon$ for all $u$ with $0 < |u - a| < \delta$. Let's put $u = g(x)$ and then see what happens to these inequalities. We see that $|f(g(x)) - L| < \epsilon$ for all $x$ such that $0 < |g(x) - a| < \delta$. Note that the last inequality can be fulfilled because of the limit $\lim_{x \to b}g(x) = a$. We can choose $\delta_{1} > 0$ such that $|g(x) - a| < \delta$ for all $x$ with $0 < |x - b| < \delta_{1}$. But notice carefully the inequalities $$0 < |u - a| < \delta\Rightarrow |f(u) - L| < \epsilon\tag{4}$$ and $$0 < |x - b| < \delta_{1}\Rightarrow |g(x) - a| < \delta\Rightarrow |f(g(x)) - L| < \epsilon\tag{5}$$ and the relation $u = g(x)$. We observe that since $0 < |u - a|$ we must ensure that $0 < |g(x) - a|$ and this is captured by the condition $g(x) \neq a$ in some deleted neighborhood of $b$. There is a further slight difference between $(4)$ and $(5)$ which one may fail to notice. Equation $(4)$ says that for all values of $u$ with $0 < |u - a| < \delta$ we have $|f(u) - L| < \epsilon$. Here $u$ takes every value in interval $(a - \delta, a + \delta)$ except $a$. But in $(5)$ we have $|g(x) - a| < \delta$ and is it not necessary that $g(x)$ takes all values in $(a - \delta, a + \delta)$ except $a$. What is guaranteed by $(5)$ is that whatever value $g(x)$ has it lies in $(a - \delta, a + \delta)$ but not that $g(x)$ takes all values except $a$ in this interval. Hence equation $(4)$ and $(5)$ are not equivalent and $(4)$ is the stronger statement. Thus $(4)$ implies $(5)$ but not vice-versa.
It is therefore important to understand that identity $(1)$ holds only when RHS of $(1)$ exists (finitely or infinitely). Thus it is possible that LHS of the identity $(1)$ exists but RHS does not exist.
How do we make this identity $(1)$ bidirectional so that either both the sides of the identity exist and are equal or both of them don't exist?
The idea is simple! We should be able to get back $x$ from $g(x)$. More technically $g(x)$ should be invertible in a certain deleted neighborhood of $b$ with inverse $h$ such that $\lim_{x \to a}h(x) = b$. If $\lim_{x \to b}f(g(x)) = L$ exists and $\lim_{x \to a}h(x) = b$ then we can apply substitution again to get $\lim_{x \to a}f(g(h(x))) = L$ or $\lim_{x \to a}f(x) = L$.
So we have the modified rule of substitution which has more powerful conclusion (but also more conditions):
If $\lim_{x \to b}g(x) = a$ and $g(x)$ in invertible in some deleted neighborhood of $b$ with inverse $h$ and $\lim_{x \to a}h(x) = b$ then we have $$\lim_{x \to a}f(x) = \lim_{x \to b}f(g(x))\tag{6}$$ where $f$ is any function. If any side of the above equation exists (finitely or infinitely) then the other side also exists (finitely or infinitely) and both are equal.
BTW notice that the condition $g(x) \neq a$ (or $h(x) \neq b$) is now redundant due to the existence of inverse of $g$. Moreover the above rule of substitution is the one used in practice while evaluating limits in step by step manner so that each step is equivalent to previous step. Most common substitutions of type $u = g(x)$ are thus typically invertible and one should be aware of this fact while using substitutions.
