Prove that the function $f :\Bbb R \to \Bbb R$ defined by $f(x) = e^{-\cos(x)^2}$, for all $x \in\Bbb R$, has a unique fixed point on $\Bbb R$. Hint: some arguments might be simpler if you recall the trigonometric formula $2\sin(x)\cos(x) = \sin(2x)$. Remember also that $\cos$ and $\sin$ are $2\pi$-periodic functions. 
I am a bit lost with this question. I wanted to apply the contraction mapping theorem but it involves a closed set which $\Bbb R$ isn't. So I started off with let $a \in \Bbb R$ and $a > 0$, then the set $[-a,a] = I$ is a subset of $\Bbb R$ which $f(x)$ is defined on. 
Then assume for some $x_1 \in I$, $f(x_1) = x_1$ and $x_2$. I was then going to apply the mean value theorem where $f'(c) = \dfrac{f(x_1) -f(x_2)} {x_1 - x_2}$ which would mean $f'(c) = 0$, however $f '(x)$ is $2e^{-\cos(x)^2}\cos(x)\sin(x)$ which will not equal to $0$? 
I am not sure if I am heading in the right direction because so far it doesn't look right 
 A: You don't need Contraction Mapping Theorem for this. Let $g(x)=e^{-\cos^{2}x} -x$. Observe the following:
$ e^{-\cos^{2}x}$ is bounded so $g(x) \to -\infty$ as $x \to \infty$ and $g(x) \to \infty$ as $x \to -\infty$. It follows by IVP that $g$ must vanish at some point, so there is at least one fixed point for $f$.
Now $g'(x)=-2\cos x \sin xe^{-\cos^{2}x}-1$. Since $|-2\cos x \sin x e^{-\cos^{2}x}|= |\sin (2x)e^{-\cos^{2}x}| \leq 1$ we see that $g$ is a decreasing function so it can vanish at at most one point. [I have used the fact that $g$ is not constant on any interval]. 
If there exist points $x_1,x_2$ such that $x_1<x_2$ and $g(x_1)=g(x_2)=0$ then (by monotonicity)  $g(x)=0$ for all $x \in (x_1,x_2)$. But then $\sin (2x)e^{-\cos^{2}x} =1$ for all $x \in (x_1,x-2)$. But this is possible only when $\sin (2x)=1$ for all  $x \in (x_1,x-2)$ which is clearly not true. 
A: Note that $\Bbb R$ is a complete metric space, which is all we need to appeal to the contraction mapping theorem.  
Assume $x_1, x_2 \in \Bbb R$ with $x_1 < x_2$. Then, by MVT, we have that 
$$f'(c) = \dfrac{f(x_2) - f(x_1)}{x_2 - x_1} \qquad (*)$$
for some $c \in (x_1, x_2)$.
Thus, to show that $f$ is a contraction, it would suffice to find a nice bound on $f'(c)$. We turn our attention to this.

Note that $f'(x) = e^{-\cos^2x}\sin2x.$
We now show that there exists $k \in (0, 1)$ such that $|f'(x)| < k$ for all $x\in \Bbb R$. Note that $f'$ is periodic with period $\pi$ and thus, it suffices to consider $f'$ on $[0, \pi]$.
However, note that $I = [0, \pi]$ is compact and so, by the extreme value theorem (EVT), $|f'|$ attains its maximum (supremum) on it.  
Let $k = \displaystyle\sup_{x\in I}|f'(x)|.$ By EVT, $k = |f'(x_0)|$ for some $x_0 \in I$.  
We now wish to show that $k < 1$. (Emphasis on the strict inequality. It is clear that $k \le 1$.)  
Note that $e^{-\cos^2x} \le 1$ and $|\sin 2x| \le 1$ for all $x \in I$. Thus, if $k = 1$, then we must have both
$$e^{-\cos^2x_0} = 1 \text{ and } |\sin 2x_0| = 1.$$
However, it can be seen that the former is possible iff $x_0 = \pi/2$ corresponding to which we get that $\sin 2x_0 = 0$, a contradiction. Thus, we see that $k = 1$ is not possible.

With the above result, we can rearrange $(*)$ to get
\begin{align}
\left|\dfrac{f(x_2) - f(x_1)}{x_2 - x_1}\right| &= |f'(c)|\\
&< k\\
\implies |f(x_2) - f(x_1)| &< k|x_2 - x_1|,
\end{align}
for some $k \in (0, 1)$ and all $x_1, x_2 \in \Bbb R$.
You can now appeal to the contraction mapping theorem and conclude the result.
