Evaluate $\lim_{x\rightarrow0}{\frac{(x-\arctan(x))\ln(1+2\sin(x))}{(1+\cos{x})(e^x-1-x)^2}}$ using Taylor I want to evaluate the following limit:
$$\lim_{x\rightarrow0}{\frac{(x-\arctan(x))\ln(1+2\sin(x))}{(1+\cos{x})(e^x-1-x)^2}}$$
For example, we have $x-\arctan{x}$. They are both $0$. This seems to be the so called "cancellation of terms". Therefore I apply the Taylor series:
$$\arctan{x}=x-\frac{x^3}{3}+o(x^3)$$
Therefore
$$x-\arctan{x}\sim x-x +\frac{x^3}{3}+o(x^3)=\frac{x^3}{3}+o(x^3)$$
Somebody solved this problem textbook and developed this to the fifth term (not third). Now a few questions arise:


*

*Why do I need to develop this Taylor series to the fifth term (assuming I have to).

*Do I need to develop every function to the same term in my limit?


Any hints?

For the direct questions: One must, needs to, determine powers of the expansion beyond constant factors to determine the behavior of the expansions; Not every function has the same powers in an expansion. The result then becomes "at least get a few powers of $x$ of each function". 
This becomes more familiar by the example in question. Consider each of the four functions first:
\begin{align}
x - \tan^{-1}(x) &= \frac{x^3}{3} - \frac{x^5}{5} + \frac{x^7}{7} + \mathcal{O}(x^9) \\
\ln(1 + 2 \, \sin(x)) &= 2 x - 2 x^2 + \frac{7 x^3}{3} - \frac{10 x^4}{3} + \mathcal{O}(x^5) \\
1 + \cos(x) &= 2 \cos^{2}\left(\frac{x}{2}\right) = 2 - \frac{x^2}{2} + \frac{x^4}{24} + \mathcal{O}(x^6) \\
(e^{x} - 1 - x)^{2} &= \frac{x^4}{4} + \frac{x^5}{6} + \frac{5 x^6}{72} + \mathcal{O}(x^7).
\end{align} 
With these expansions it is seen that the growth of powers of $x$ are not the same, but at least each expansion has powers of $x^4$ or greater. 
Now, for the limit.
\begin{align}
F(x) &= \frac{(x - \tan^{-1}(x) ) \, \ln(1 + 2 \, \sin(x))}{2 \,  \cos^{2}\left(\frac{x}{2}\right) \, (e^{x} - 1 - x)^{2}} \\
&= \frac{\left(\frac{x^3}{3} - \frac{x^5}{5} + \frac{x^7}{7} + \cdots\right) \left( 2 x - 2 x^2 + \frac{7 x^3}{3} - \frac{10 x^4}{3} + \cdots\right)}{\left(2 - \frac{x^2}{2} + \frac{x^4}{24} + \cdots \right) \left(\frac{x^4}{4} + \frac{x^5}{6} + \frac{5 x^6}{72} + \cdots \right)} \\
&= \frac{\frac{2 x^4}{3} - \frac{2 x^5}{3} + \frac{17 x^6}{45} + \cdots}{\frac{x^4}{2} + \frac{x^5}{6} + \frac{x^6}{72} + \cdots} \\
&= \frac{\frac{2}{3} - \frac{2 x}{3} + \frac{17 x^2}{45} + \cdots}{\frac{1}{2} + \frac{x}{6} + \frac{x^2}{72} + \cdots} \\
&= \frac{4}{3} \, \left( 1 - \frac{4 x}{3} + \frac{49 x^2}{36} + \cdots \right)
\end{align}
and 
\begin{align}
\lim_{x \to 0} F(x) &= \lim_{x \to 0} \frac{4}{3} \, \left( 1 - \frac{4 x}{3} + \frac{49 x^2}{36} + \mathcal{O}(x^3) \right) \\
&= \frac{4}{3}
\end{align}
