<s>[INST] 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.
 [/INST] 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}$$
</s>