$\lim\limits_{x\to0}\frac{2(\tan x-\sin x)-x^3}{x^5}=$? Original question: $$\lim_{x\to0}\frac{2(\tan x-\sin x)-x^3}{x^5}$$
What is wrong in my solution as answer is $\frac14$ not $\frac12$:
$$\lim_{x\to0}\frac{2({\frac{\sin x}{\cos x}-\sin x)}-x^3}{x^5}$$
$$\lim_{x\to0}\frac{2(\sin x-\sin x\cos x)-x^3\cos x}{x^5\cos x}$$
$$\lim_{x\to0}\frac{2\sin x(1-\cos x)-x^3\cos x}{x^5\cos x}$$
$$\lim_{x\to0}\frac{(2\sin x)(2\sin^2 (\frac{x}{2}))-x^3\cos x}{x^5\cos x}$$
Dividing by $x^3$ and distributing $x$ and $x^2$ between $\sin x$ and $\sin^2 (\frac{x}{2})$ respectively,
$$\lim_{x\to0}\frac{4(\frac{\sin x}{x})(\frac{\sin^2 (\frac{x}{2})}{x^2})-\cos x}{x^2\cos x}$$
$$\lim_{x\to0}\frac{(\frac{\sin x}{x})(\frac{\sin^2 (\frac{x}{2})}{\frac{x^2}{4}})-\cos x}{x^2\cos x}$$
Now I assumed $\frac{\sin x}{x}$ and $(\frac{\sin (\frac{x}{2})}{\frac{x}{2}})^2$ to be 1 as $x\to 0$
$$\lim_{x\to0}\frac{1-\cos x}{x^2\cos x}$$
$$\lim_{x\to0}\frac{2\sin^2 \frac{x}{2}}{x^2\cos x}$$
$$\lim_{x\to0}\frac{2\sin^2 \frac{x}{2}}{4(\frac{x^2}{4})\cos x}$$
Again $(\frac{\sin (\frac{x}{2})}{\frac{x}{2}})^2$ to be 1 as $x\to 0$
$$\lim_{x\to0}\frac{1}{2\cos x}$$
And now as $x\to0$ $\cos x$ will be $1$. So that's how I got $\frac12$. I am learning limits. So, correcting me will improve my misconceptions.
 A: As Stephen pointed out in the comment, the problem is taking the limit in the third line of your computation. Using $S(x)=\sin(x)/x$, by adding $-1+1$ in the nominator, the correct expression is
$$\lim_{x\rightarrow 0}\frac{S(x)S(x/2)-\cos(x)}{x^2\cos(x)}
=\lim_{x\rightarrow 0}\frac{S(x)S(x/2)+\frac{1}{2}S(x/2)x^2-1}{x^2\cos(x)}\\
=\lim_{x\rightarrow 0}\frac{S(x)S(x/2)-1}{x^2\cos(x)}+\frac{1}{2},$$
and the first contribution to the limit is exactly the missing $-1/4$.
If it is an option, I would recommend to apply L'Hôpital's rule, which is usually also used to obtain $S(0)=1$. Then, with $\tan'(x)=1+\tan(x)^2$, $\sin'(x)=\cos(x)$, $\cos'(x)=\sin(x)$, $(x^r)'=rx^{r-1}$ for $r\in\mathbb R\setminus\{0\}$ and the chain rule we get
$$\frac{2(\tan(x)-\sin(x))-x^3}{x^5}\rightarrow
\frac{2+2\tan(x)^2-2\cos(x)-3x^2}{5x^4}\rightarrow
\frac{4\tan(x)+4\tan(x)^3+2\sin(x)-6x}{20x^3}\rightarrow
\frac{4+16\tan(x)^2+12\tan(x)^4+2\cos(x)-6}{60x^2}\rightarrow
\frac{32\tan(x)+80\tan(x)^3+48\tan(x)^5-2\sin(x)}{120x}\rightarrow
\frac{32+272\tan(x)^2+480\tan(x)^4+240\tan(x)^6-2\cos(x)}{120}\rightarrow
\frac{1}{4}.$$
As a more general bugfixing strategy, I recommend to plot the function in each step of your computations, for example here, from say $x=-0.05$ to $x=0.05$ (if this option is available). This helps to identify the faulty step. If you further keep track of the error terms (as illustrated above by adding $+1-1$), you can not only determine the limit, but also the asymptotical behavior as the limit is approached.
