$\lim_{x \to 0^+} (\cos x)^\frac{1}{x^2} $ $$\lim_{x \to \infty} (\cos x)^\frac{1}{x^2} $$
When I attempt to do this I get stuck in an endless loop of L'Hoptial's rule.
Is there any way to solve this without using  de Moivre's theorem ( We haven't learned that)
edit: now I know that the limit DNE, I'd like to know how to solve another case for this function:
$$\lim_{x \to 0^+} (\cos x)^\frac{1}{x^2} $$
 A: Just use logarithm-exponent identity you can get the answer.
\begin{equation}
\lim_{x\rightarrow0^+}=\cos(x)^{\frac{1}{x^2}}=e^{\frac{\ln(\cos(x))}{x^2}}
\end{equation}
Then we just need to calculate the limitation of the exponent item.
\begin{equation}
\lim_{x\rightarrow0^+}\frac{\ln(\cos(x))}{x^2}=\lim_{x\rightarrow0^+}\frac{-\tan(x)}{2x}=\lim_{x\rightarrow0^+}\frac{-x}{2x}=-\frac{1}{2}
\end{equation}
At the second step from bottom, I use the equivalent infinitesimal that $\tan(x)\sim x$ .
Thus, the limitation is $e^{-\frac{1}{2}}$.
A: If $L$ is the desired limit then $$\begin{aligned}\log L &= \log\left(\lim_{x \to 0}(\cos x)^{1/x^{2}}\right)\\
&= \lim_{x \to 0}\log\left((\cos x)^{1/x^{2}}\right)\text{ (by continuity of }\log)\\
&= \lim_{x \to 0}\frac{\log \cos x}{x^{2}}\\
&= \lim_{x \to 0}\frac{\log (1 + \cos x - 1)}{x^{2}}\\
&= \lim_{x \to 0}\frac{\log (1 + \cos x - 1)}{\cos x - 1}\cdot\frac{\cos x - 1}{x^{2}}\\
&= \lim_{x \to 0}1\cdot\frac{\cos x - 1}{x^{2}}\\
&= -2\lim_{x \to 0}\frac{\sin^{2}(x/2)}{(x/2)^{2}}\cdot\frac{(x/2)^{2}}{x^{2}}\\
&= -2\cdot\frac{1}{4} = -\frac{1}{2}\end{aligned}$$ It now follows that $L = e^{-1/2} = 1/\sqrt{e}$.
