I have calculate this limit $$\lim_{x\to 0}\ (\cos x)^{1/x^2}$$ with these steps. I have considered that:
$$(\cos x)^{1/x^2}=(\cos x -1+1)^{1/x^2}=\left(\frac{1}{\frac{1}{\cos x -1}}+1\right)^{\frac{1}{x^2}}$$
I remember that $1/(\cos x -1)$ when $x\to 0$ the limit is $\infty$. Hence $$\left(\frac{1}{\frac{1}{\cos x -1}}+1\right)^{\frac{1}{x^2}}=\left[\left(\frac{1}{\frac{1}{\cos x -1}}+1\right)^{\frac{1}{x^2}}\right]^{\frac{\frac{1}{\cos x -1}}{\frac{1}{\cos x -1}}}=\left[\left(\frac{1}{\frac{1}{\cos x -1}}+1\right)^{\frac{1}{\cos x-1}}\right]^{\frac{\frac{1}{x^2}}{\frac{1}{\cos x -1}}} \tag{1}$$ But if I take
$$p=\frac{1}{\cos x -1}\xrightarrow{x\to 0}p\to \infty$$ therefore I consider the $$\lim_{p\to \infty}\left(1+\frac 1p\right)^p=e$$
Consequently for the $(1)$,
$$\left(\frac{1}{\frac{1}{\cos x -1}}+1\right)^{\frac{1}{\cos x-1}}\xrightarrow{p\to \infty} e$$
and the exponent
$$\lim_{x\to 0}\frac{\frac{1}{x^2}}{\frac{1}{-(-\cos x +1)}}=-\frac 12\tag{2}$$
At the end $\displaystyle \lim_{x\to 0}\ (\cos x)^{1/x^2}=e^{-\frac 12}$.
I have followed this strategy in my classroom with my students. Is there a shorter solution to the exercise than the one I have given?
So you are assuming the fact $(1+u)^{1/u}\rightarrow e$ as $u\rightarrow 0$. With such, we also have $\dfrac{1}{u}\cdot\log(1+u)\rightarrow 1$, then \begin{align*} \dfrac{1}{x^{2}}\cdot\log(\cos x)&=\dfrac{1}{\cos x-1}\cdot\log(1+(\cos x-1))\cdot\dfrac{\cos x-1}{x^{2}}\\ &=\dfrac{1}{\cos x-1}\cdot\log(1+(\cos x-1))\cdot-2\cdot\dfrac{\sin^{2}\left(\dfrac{x}{2}\right)}{\left(\dfrac{x}{2}\right)^{2}}\cdot\dfrac{1}{4}\\ &\rightarrow-\dfrac{1}{2}, \end{align*} so the limit goes to $e^{-1/2}$.