TITLE: is this correct? $\lim\limits_{x\to a}f(x)^{g(x)} = [\lim\limits_{x\to a}f(x)]^{\lim\limits_{x\to a}g(x)}$
QUESTION [6 upvotes]: I met a question, let me compute
$$ \lim\limits_{x\to 0}(\cos x)^{-x^2}$$
the answer is 1
this is not a primary function,  its structure is like $$\lim\limits_{x\to 0}f(x)^{g(x)}$$
is it a theorem, which I don't find it on my math book? probably write as 
$$\lim\limits_{x\to a}f(x)^{g(x)} = [\lim\limits_{x\to a}f(x)]^{\lim\limits_{x\to a}g(x)}$$

REPLY [10 votes]: When $ \lim_{x\to a}f(x) > 0$ and $\lim_{x\to a} g(x)$ exsits, from the continuity of $\exp(x)$ and $\ln(x)$, we have
$$ \lim_{x\to a} f(x)^{g(x)} = \lim_{x\to a} \exp({g(x)\cdot \ln f(x)}) = \exp \left(\lim_{x\to a} g(x) \cdot \ln \left(\lim_{x\to a}f(x)\right)\right) = \left[\lim_{x\to a}f(x)\right]^{\lim_{x\to a} g(x)} .$$

REPLY [2 votes]: $\begin{array}\\
(\cos(x))^{-x^2}
&=\exp(-x^2\ln(\cos(x)))\\
&=\exp(-x^2\ln(1-x^2/2+O(x^4)))\\
&=\exp(-x^2(-x^2/2+O(x^4)))\\
&=\exp(x^4/2+O(x^6))\\
&\to \exp(0)\\
&=1\\
\end{array}
$
If you meant
$(\cos(x))^{x^{-2}}
$
then we get
$\exp(x^{-2}(-x^2/2+O(x^4)))
=\exp(-1/2+O(x^2))
\to e^{-1/2}$.