Computing: $\lim\limits_{x\to 0} \frac{(\cos x-1)(\cos x-e^x)}{x^n}$ $$\lim_{x\to 0} \frac{(\cos x-1)(\cos x-e^x)}{x^n}$$
If the limit is a finite non zero number, find n.
I tried using L'Hôpital's rule but failed. I differentiated it but not understanding what exactly should be done. Please help.
 A: Given that 
$$ \cos'x|_{x=0} =\lim_{x\to 0}\frac{\cos x-1}{x} =\sin 0=0~~~and ~~~\lim_{x\to 0}\frac{e^x-1}{x} =(e^x)'|_{x=0}= 1$$
or by taylor series we have,  $$\frac{\cos x-1}{x} \sim \frac{x}{2}~~~and ~~~\lim_{x\to 0}\frac{e^x-1}{x} \sim 1$$
and
$$ \frac{(\cos x-1)(\cos x-e^x)}{x^n} = \frac{(\cos x-1)(\color{red}{\cos x-1+1-e^x)}}{x^n} \\= \frac{1}{x^{n-2}}\left[\left(\frac{\cos x-1}{x}\right)^2 -\left(\frac{\cos x-1}{x}\right) \left(\frac{e^x-1}{x}\right) \right]\\\sim \frac{1}{x^{n-2}}\left[\frac{x^2}{4}-\frac{x}{2}\right] = \left[\frac{x^4}{4x^{n}}-\frac{x^3}{2x^n}\right] $$
we have 
$$\lim_{x\to 0} \frac{(\cos x-1)(\cos x-e^x)}{x^n}=\begin{cases}0
\ &n= 0,1,2\\-\frac{1}{2}
\ &n=3\\diverges& n=4,5....\end{cases}$$
A: $$=-\lim_{x\to0}\dfrac{x^2(\cos x-e^x)}{1+\cos x}\dfrac{\sin^2x}{x^2}$$
A: \begin{align}\lim_{x\to0}\frac{(\cos(x)-1)(\cos(x)-e^x)}{x^3}&=\lim_{x\to0}\frac{\cos(x)-1}{x^2}\times\lim_{x\to0}\frac{(\cos(x)-1)-(e^x-1)}x\\&=\left(-\frac12\right)\times\bigl(\cos'(0)-\exp'(0)\bigr)\\&=\frac12.\end{align}
Therefore,$$\lim_{x\to0}\frac{(\cos(x)-1)(\cos(x)-e^x)}{x^n}=\begin{cases}0&\text{ if }n<3\\-\frac12&\text{ if }n=3\\\text{does not exist (in $\mathbb R$)}&\text{ otherwise.}\end{cases}$$
A: By the Taylor development and ignoring the irrelevant terms, the numerator behaves like $\left(-\dfrac{x^2}2\right)\left(-x\right)$.
Hence, for $n<3$, the limit is $0$, for $n=3$, $\dfrac12$ and for $n>3$, does not exist.
