What is $ \lim_{x \rightarrow 0}\left(\frac{1}{\ln\cos (x)}+\frac{2}{\sin ^{2}(x)}\right) $? The answer of the following limit:
$$
\lim_{x \rightarrow 0}\left(\frac{1}{\ln \cos (x)}+\frac{2}{\sin ^{2}(x)}\right)
$$
is 1 by Wolfram Alpha.
But I tried to find it and I got $2/3$ :
My approach :
$1)$
$
\ln(\cos x)=\ln\left(1-\frac{x^{2}}{2}+o\left(x^{3}\right)\right)=-\frac{x^{2}}{2}+o\left(x^{3}\right)
$
$2)$
$
\sin ^{2}(x)=\left(x-\frac{x^{3}}{3!}+o\left(x^{3}\right)\right)^{2}=x^{2}-\frac{x^{4}}{3}+o\left(x^{4}\right)
$
$3)$
$\begin{aligned} \frac{1}{-\frac{x^{2}}{2}+o\left(x^{3}\right)}+\frac{2}{x^{2}-\frac{x^{4}}{3}+o\left(x^{4}\right)}=\frac{-x^{2}+x^{2}-\frac{x^{4}}{3}+o\left(x^{3}\right)}{-\frac{x^{4}}{2}+o\left(x^{5}\right)}=\frac{-\frac{1}{3}+o\left(x^{3}\right)}{-\frac{1}{2}+o\left(x^{5}\right)} \end{aligned}$
$4)$
$\lim _{x \rightarrow 0} \frac{-\frac{1}{3}+o\left(x^{3}\right)}{-\frac{1}{2}+o\left(x^{5}\right)}=\frac{-\frac{1}{3}}{-\frac{1}{2}}=\frac{2}{3}$
So where is the mistake in my approach?
Note: $o$ denotes the little-o notation
Edit : I've understood where's my mistake is, but another question popped up reading the answers which is : does $o(1/x)$ tends to zero as x tends to zero?
 A: When you got$$\require{cancel}\frac{\cancel{-x^{2}}+\cancel{x^{2}}-\frac{x^{4}}{3}+o\left(x^{3}\right)}{-\frac{x^{4}}{2}+o\left(x^{5}\right)},$$you divided both the numerator and the denominator by $x^4$, getting$$\frac{-\frac13+o(x^3)}{-\frac12+o(x^5)}.$$This is not correct, because $\frac{o(x^3)}{x^4}$ is not $o(x^3)$.
Note that$$\log(\cos x)=-\frac{x^2}2-\frac{x^4}{12}+O(x^6)$$and that therefore$$\frac1{\log(\cos x)}=-\frac{2}{x^2}+\frac{1}{3}+\frac{x^2}{30}+O(x^4).\tag1$$Also, since$$\sin^2(x)=x^2-\frac{x^4}3+O(x^6),$$you have$$\frac2{\sin^2(x)}=\frac{2}{x^2}+\frac{2}{3}+\frac{2x^2}{15}+O(x^4).\tag2$$And it follows from $(1)$ and $(2)$ that$$\lim_{x\to0}\left(\frac1{\log(\cos x)}+\frac2{\sin^2(x)}\right)=1.$$
A: It is because when you expand $\cos(x)$ and $\ln(\cos(x))$, you need to consider more fourth-order term. Specifically,
$$\cos(x)=1-\frac{x^2}{2}+\frac{x^4}{24}+o(x^5).$$
Then
$$\ln\left(\cos(x)\right)=-\frac{x^2}{2}+\frac{x^4}{24}-\frac{\left(-\frac{x^2}{2}+\frac{x^4}{24}\right)^2}{2}+o(x^5)=-\frac{x^2}{2}-\frac{x^4}{12}+o(x^5).$$
With the same expression for $\sin(x)$ as you have written, we obtain
\begin{align*}
\frac{1}{\ln\left(\cos(x)\right)}+\frac{2}{\sin^2(x)}&=\frac{1}{-\frac{x^2}{2}-\frac{x^4}{12}+o(x^5)}+\frac{2}{x^2-\frac{x^4}{3}+o(x^4)}\\
&=\frac{x^2-\frac{x^4}{3}-x^2-\frac{x^4}{6}}{-\frac{x^4}{2}+o(x^4)}\\
&=\frac{x^4}{x^4+o(x^4)}.
\end{align*}
A: We need more terms to obtain
$$\ln(\cos x)=\ln\left(1-\frac{x^{2}}{2}+\frac{x^{4}}{24}+o\left(x^{4}\right)\right)=-\frac{x^{2}}{2}-\frac{x^{4}}{12}+o\left(x^{4}\right)$$
and then by binomial expansion
$$\frac{1}{-\frac{x^{2}}{2}-\frac{x^{4}}{12}+o\left(x^{4}\right)}+\frac{2}{x^{2}-\frac{x^{4}}{3}+o\left(x^{4}\right)}=\frac2{x^2}\left(-\frac{1}{1+\frac{x^2}6+o\left(x^{2}\right)}+\frac{1}{1-\frac{x^{2}}{3}+o\left(x^{2}\right)}\right)=\frac2{x^2}\left(-1+\frac{x^2}6+1+\frac{x^{2}}{3}+o\left(x^{2}\right)\right)= \frac2{x^2}\left(\frac{x^2}2+o(x^2)\right)=1+o(1) \to 1$$
A: As an alternative by $\cos x= e^t$ with $t\to 0$ and then $\sin^2 x=1-e^{2t}$ we have
$$\frac{1}{\ln\cos (x)}+\frac{2}{\sin ^{2}(x)}=\\=\frac1t+\frac2{1-e^{2t}}=\frac{1-e^{2t}+2t}{t(1-e^{2t})}=\frac{1-1-2t-2t^2+2t+o(t^2)}{t(1-1-2t+o(t))}=\frac{-2t^2+o(t^2)}{-2t^2+o(t^2)}=\frac{1+o(1)}{1+o(1)}\to 1$$
A: Here $$ \frac{-x^{2}+x^{2}-\frac{x^{4}}{3}+o\left(x^{3}\right)}{-\frac{x^{4}}{2}+o\left(x^{5}\right)}=\frac{-\frac{1}{3}+o\left(x^{3}\right)}{-\frac{1}{2}+o\left(x^{5}\right)} $$
you canceled $x^4$ in the numerator and denominator, so it should be $$\frac{-\frac{1}{3}+o\left(x^{-1}\right)}{-\frac{1}{2}+o\left(x\right)} $$
You'll need to consider more terms in the series to get more precision.
A: Hint:
$$\dfrac1{\ln\cos x}=\dfrac2{\ln(1-\sin^2x)}$$
Now writing $\sin^2x=y,$
$$\lim_{y\to0^+}2\cdot\dfrac{y+\ln(1-y)}{y\ln(1-y)}=2\lim_y\dfrac{y+\left(-y-y^2/2-y^3/3-\cdots\right)}{-y^2\cdot\dfrac{\ln(1-y)}{-y}}=?$$
A: If we put $$y=\sin^2(x)$$
the limit becomes
$$\lim_{y\to 0}2\frac{y+\ln(1-y)}{y\ln(1-y)}$$
$$=\lim_{y\to 0}-2\frac{y+\ln(1-y)}{y^2}$$
$$=\lim_{y\to 0}-2\frac{y-y-\frac{y^2}{2}(1+o(1))}{y^2}$$
$$=1$$
