I wanted to evaluate the limit $$\lim_{x\to\infty}x^2(1-\cos\frac{1}{x})$$
Since we know that $-1\leq \cos x\leq1$ and that $-1\leq \cos\frac{1}{x} \leq 1$, so by algebraic manipulation, $0\leq x^2(1-\cos\frac{1}{x})\leq2x^2 $.
Why does squeeze theorem fails to obtain a numerical limit here since the actual limit is $\frac{1}{2}$? I know the whole limit would be 0 when $x$ approaches 0.
Following up on my comment, one way to do it without Taylor expansions is so to note that $$ \cos 2y = 1-2\sin^2 y \quad \Leftrightarrow \quad 2\sin^2 \frac{u}{2} = {1-\cos u},$$ so \begin{align} \lim_{x\to \infty} x^2\left(1-\cos\frac{1}{x}\right) &=[u = 1/x] = \lim_{u \to 0^+} \frac{1-\cos u}{u^2}\\ &= \lim_{u\to 0 ^+} \frac{2\sin^2 \frac{u}{2}}{u^2} = \frac{1}{2}\lim_{u \to 0^+} \frac{\sin^2 (u/2)}{(u/2)^2}\\ &= \frac{1}{2} \left(\lim_{u \to 0^+} \frac{\sin(u/2)}{u/2}\right)^2 = \frac{1}{2}\cdot 1^2 = \frac{1}{2}. \end{align}