Why is this limit $\lim_{x\to \infty}x^2-x^2\cdot \cos\left(\frac{1}{x}\right)$ not $0$? I have this limit:
$$
\lim_{x\to \infty}x^2-x^2\cdot \cos\left(\frac{1}{x}\right)
$$
For me my initial answer would be zero as:
$$
\lim_{x\to \infty}x^2-x^2\cdot \cos\left(\frac{1}{x}\right)=\lim_{x\to \infty}x^2-\lim_{x\to \infty}x^2\cdot\lim_{x\to \infty}\cos\left(\frac{1}{x}\right)
$$
Which is:
$$
\infty-\infty\cdot1=0
$$
But after looking at wolfram alpha and doing a series expansion of $\cos(x)$ i see that the answer is in fact $1/2.$
Why is my original thinking incorrect?
 A: Hint: $\cos(x) = 1-\dfrac{x^2}{2}+O(x^4)$ or $\cos(1/x) = 1 - \dfrac{1}{2x^2}+O\left(\dfrac{1}{x^4}\right)$
A: $$\lim_{x\to\infty} x^2(1-\cos(1/x))  = \lim_{x\to\infty}  \dfrac{1-\cos(1/x)}{1/x^2} \to {0\over 0}$$
Now you can apply L'Hopital's rule
$$\lim_{x\to\infty}  \dfrac{1-\cos(1/x)}{1/x^2} =\lim_{x\to\infty} = \dfrac{-\sin(1/x)/x^2}{-2/x^3} = \dfrac{1}{2} \lim_{x\to\infty} \cdot \dfrac{\sin(1/x)}{1/x}$$
One more application of L'H:
$$\frac{1}{2}\lim_{x\to\infty} \dfrac{\sin(1/x)}{1/x} = \frac{1}{2}\lim_{x\to\infty} \dfrac{\cos(1/x)/x^2}{1/x^2} =\frac{1}{2}\lim_{x\to\infty} \cos(1/x)  =\frac{1}{2}\cdot1=\frac{1}{2}$$
A: In general, if you are to calculate
$$
\lim_{x \to a} [f(x) + g(x)]
$$
where $a$ can be a real number or $\pm \infty$, you cannot blindly move the limit inside the parantheses like this:
$$
\Big[\lim_{x\to a} f(x) + \lim_{x \to a} g(x) \Big]
$$
The reason you can not do that is because when proving this limit rule it is assumed that both
$$\lim_{x\to a} f(x)$$
and
$$
\lim_{x \to a} g(x)
$$
are defined. To be defined in this context means that they actually are equal to a real number (they converge). If any one of them, say $\lim_{x \to \infty} f(x)$, does not converge to any real number, it could be because for example:

*

*$\lim_{x \to \infty} f(x)$ oscillates between several different values as $x$ goes to $\infty$, and thus does not settle for a limit value. An example of this is the function $\cos(x)$.


*$\lim_{x \to \infty} f(x) $ does not have an upper bound. That is, no matter what number $M$ you come up with, there is a point $x_0$ on the real line such that $f(x) > M$ whenever $x > x_0$.
In this latter case we might informally write this as $\lim_{x \to \infty} f(x) = \infty$, but note that this is just notation. $\infty$ is not a number that one can do arithmetic with as with real numbers. What the notation really means is once again that $f(x)$ grows without limit if we only increase $x$ enough. Therefore, an expression such as $\infty - \infty$ does not have any mathematical meaning, because $\infty$ is just a symbol and not a number.
The same caution applies to many other limit rules such as $\lim_{x \to a}(f(x)g(x)) = \lim_{x \to a}f(x) \lim_{x \to a}g(x)$, because you encounter the same problems of doing arithmetic with the symbol $\infty$ otherwise.

One can sometimes convert a limit where the variable goes to $\infty$ to a limit where the variable goes to $0$ by doing a change of variables. In this case, we can make the change of variables $u = \dfrac{1}{2x}$. It is then true that $u \to 0$ when $x \to \infty$. The limit calculation becomes
\begin{align}
&\lim_{x\to \infty} \Big[ x^2 - x^2 \cos(\frac{1}{x}) \Big] =\\
&\lim_{u \to 0} \Big[\dfrac{1}{4u^2} - \dfrac{1}{4u^2}\cos(u + u) \Big] = \\
&\lim_{u \to 0} \Big[\dfrac{1}{4u^2} (1 - \cos(u)^2 + \sin(u)^2) \Big] = \\
&\lim_{u \to 0} \dfrac{2 \sin(u)^2}{4u^2}  = \\
&\lim_{u \to 0}\dfrac{1}{2} \lim_{u \to 0}\dfrac{\sin(u)}{u} \lim_{u \to 0}\dfrac{\sin(u)}{u}  = \\
&\dfrac{1}{2} \cdot 1 \cdot 1  = \dfrac{1}{2} \\
\end{align}
Where we have used the facts that

*

*$\lim_{u \to 0}\dfrac{1}{2}$ and the standard limit $\lim_{u \to 0}\dfrac{\sin(u)}{u}$ are real numbers.

*$\cos(u + u) = \cos(u)^2 - \sin(u)^2$

*$1 = \cos(u)^2 + \sin(u)^2$
