This is taken from Differential Calculus by Amit M Agarwal:
Evaluate $$\lim_{x\to 0} \frac{1-\cos(1-\cos x)}{\sin ^4 x}$$
The question is quite easy using trigonometric identity viz. $1-\cos x = 2\sin^2\frac{x}{2}$ and then using $\lim_{x\to 0} \frac{\sin x}{x}= 1\,.$ The answer is $\frac{1}{8}\,.$
However, after evaluating the limit, the author cautioned as
Don't do it!
\begin{align}\lim_{x\to 0} \lim_{x\to 0} \frac{1-\cos(1-\cos x)}{\sin ^4 x} & =\lim_{x\to 0} \frac{1-\cos\left(\frac{1-\cos x}{x^2}\cdot x^2\right)}{x^4}\\ &= \lim_{x\to 0}\frac{1-\cos\left(\frac{x^2}{2}\right)}{x^4}\qquad \left(\textrm{As}\, \lim_{x\to 0}\frac{1-\cos x}{x^2}= \frac{1}{2} \right)\\&= \lim_{x\to 0}\frac{2\sin^2 \frac{x^2}{4}}{\frac{x^4}{16}\times 16}\\&= \frac{1}{8}\qquad \textrm{is wrong although the answer may be correct}\,.\end{align}
Where is the 'wrong' in the evaluation?
Edit:
[...] the limit as $x\to 0$ is taken for a subexpression. That's generally invalid.
We can't evaluate a limit inside a limit like that.
While evaluating limit of a complicated expression one should not replace a sub-expression by its limit and continue with further calculations.
Now, consider these limits:
$$\bullet \lim_{x \to 4} \log(2x^{3/2}- 3x^{1/2}-1)$$
my book solves this as:
$$\log\; [\lim_{x\to 4} 2 x^{3/2}- \lim_{x\to 4} 3x^{1/2} - \lim_{x\to 4} 1]= 2\log 3$$
Another one:
$$\bullet \lim_{x\to 1} \sin(2x^2- x- 1)$$
This is solved as;
$$\sin\;[\lim_{x\to 1} 2x^2 \lim_{x\to 1} x- \lim_{x\to 1} 1]= \sin 0= 0$$
The following limits are evaluated by first evaluating the limits of sub-expressions. Do these contradict the statement _ you can't take limit of a sub-expression while evaluating the limit of the whole function_?