Evaluating limits using Taylor's expansion. Evaluate the following limit : $\lim_{x \to 0}(\frac{1}{\log(\cos(x))}+\frac{2}{\sin^2(x)})$
Generally speaking I have no idea at what order should I stop the Taylor's expansion.
I've tried this using two different orders and i've gotten both the results 1 and 0.
If anyone could point out how I should pick the order of the expansion i would be grateful!
 A: Hint:
$$ \ln(\cos x) = \ln\left(1 - \frac{x^2}{2} + O(x^4)\right) = -\left( \frac{x^2}{2} + O(x^4) \right) $$
$$ \frac{\sin^2 x}{2} = \frac{1}{2}\left(x + O(x^3) \right)^2 = \frac{x^2}{2} + O(x^4) $$
When you add the inverses, the first terms will cancel out. You will need to expand up to the $x^4$ coefficient to find the limit.
EDIT: You can write the inverses in the form
$$ \frac{1}{\frac{x^2}{2}+O(x^4)} = \frac{2}{x^2}\frac{1}{1+O(x^2)} $$
and expand the geometric series, which will show that all terms past $x^4$ go to zero.
A: Your first attempt should be to simplify the expression rather than start working out the Taylor series. You can observe that the expression can be written as $$2\left(\frac{1}{\log(1-\sin^{2}x)}+\frac{1}{\sin^{2}x}\right)$$ and putting $t=\sin^{2}x$ it can be written more compactly as $$2\cdot\frac{t+\log(1-t)}{t\log(1-t)}$$ or $$2\cdot\frac{t+\log(1-t)}{t^{2}}\cdot\frac{t}{\log(1-t)}$$ The last factor tends to $-1$ as $t\to 0^{+}$ and hence we need to evaluate the limit of $$-2\cdot\frac{t+\log(1-t)}{t^{2}}$$ And now the answer to your question is obvious. Just get the Taylor series for $\log(1-t)$ from your memory as $$-t-\frac{t^{2}}{2}+o(t^{2})$$ (thus expansion upto order $2$ is needed) and the answer is immediately seen to be $1$.
A: $$\lim \limits_{x \to 0}\left(\frac{1}{\log(\cos(x))}+\frac{2}{\sin^2(x)}\right)=\lim \limits_{x \to 0}\frac{\sin^2x+2\ln\cos x}{\sin^2x\ln\cos x}$$
We can stop Taylor's expansion at the denominator to the first (different from zero) term, because it's a product and nothing is going to cancel. So if $x$ tends to $0$ we have
$$\sin^2x\ln\sin x=\left(x^2+o(x^2)\right)\ln\left(1-\frac{x^2}{2}+o(x^2)\right)=\left(x^2+o(x^2)\right)\left(-\frac{x^2}{2}+o(x^2)\right)=$$
$$=-\frac{x^4}{2}+o(x^4)$$
So we need $x^4$ "precision" on the numerator too, to avoid approximation errors. Hence
$$\sin^2x+2\ln\cos x=\left(x-\frac{x^3}{6}+o(x^3)\right)^2+2\ln\left(1-\frac{x^2}{2}+\frac{x^4}{24}+o(x^4)\right)=$$
$$=x^2-\frac{x^3}{6}-\frac{x^4}{3}+o(x^4)+2\left(-\frac{x^2}{2}+\frac{x^4}{24}-\frac{1}{2}\left(-\frac{x^2}{2}\right)^2+o(x^4)\right)$$
So finally we have
$$\lim \limits_{x \to 0}\left(\frac{1}{\log(\cos(x))}+\frac{2}{\sin^2(x)}\right)=\lim \limits_{x \to 0}\frac{-\frac{x^4}{2}+o(x^4)}{-\frac{x^4}{2}+o(x^4)}=1$$
