# Multiple answers for the same limit expression?

So I was trying to find the limit of the following expression. $$\lim_{x\to 0} \frac{\tan x - \sin x}{\sin^3 x}$$ When using the L'Hospital's rule I got the answer $$\frac {1}{2}$$.

My steps: $$\lim_{x\to 0} \frac{\tan x - \sin x}{\sin^3 x}$$ $$=\lim_{x\to 0} \frac{\sec^2 x - \cos x}{3\sin^2 x \cos x}$$ $$=\lim_{x\to 0} \frac{2 \sec^2 x \tan x + \sin x}{6\sin x \cos^2 x}$$ $$=\lim_{x\to 0} \left(\frac{2 \sec^2 x \tan x}{6\sin x \cos^2 x}+\frac{\sin x}{6\sin x \cos^2 x}\right)$$ $$=\lim_{x\to 0} \left(\frac{1}{3\cos^5 x}+\frac{1}{6\cos^2 x}\right)$$ $$=\frac{1}{3}+\frac{1}{6}$$ $$=\frac{1}{2}$$

Edit: My steps are incorrect from the 3rd line onward as pointed out by @Fishbane in the comments

Just to check my answer I substituted $$x = 0.000000001$$ and so on, on my calculator just to be sure, but I got the result to be $$0$$. Believing it to be some kind of error I used WolframAlpha's calculator as well and got the same result, $$0$$.

What is the reason for this difference?

• Can you show your steps in arriving at the answer $1/2$? Feb 10, 2023 at 16:58
• sure, i'll edit my answer to include that. Feb 10, 2023 at 16:59
• As @RossMillikan points out in his answer, the culprit is numerical error (which would happen whether you used radians or degrees). To get around this, you can work with the expression a bit: $$\frac{\tan x - \sin x}{\sin^3 x} = \frac{1 - \cos x}{\sin^2 x \cos x}$$ From here, the trick is to multiply the top and bottom by $1+\cos x$, ultimately giving $\frac{1}{\cos x (1+\cos x)}.$ This addresses the numerical error, and also (presto!) you no longer need the sledgehammer that is L'Hôpital's rule. Feb 10, 2023 at 17:16
• It doesn't actually affect the answer but as far as I can tell your third line is incorrect (assuming you used L'Hospital). The denominator should be $6 \sin(x) \cos^2(x)-3\sin^3(x)$. Feb 10, 2023 at 17:23
• @Théophile You do not need to apply the trick: just use $\sin^2x=1-\cos^2x$ in the denominator. Feb 10, 2023 at 22:09

You are running into numerical error from the difference of two close numbers. For small $$x, \tan x - \sin x$$ is about $$\frac {x^3}2$$ by the Taylor series while $$\tan x$$ and $$\sin x$$ are about $$x$$. For $$x=10^{-9}$$ this is about $$0.5 \cdot 10^{-27}$$, which is $$18$$ orders of magnitude smaller than the terms you are subtracting. Due to the limited precision of computer numbers, the difference comes out $$0$$. Try with $$x=10^{-3}$$ instead and you get $$\frac 12$$ as you should from Alpha
• @Aditya For fun: let $f(x) = \frac{1}{1+\cos x}$ and $g(x) = \frac{1-\cos x}{\sin^2 x}$, for example. Mathematically, they are the same function, but numerically, one of them is much more stable. See what happens in your calculator with $f(0.000001)$ vs. $g(0.000001)$. You can manually calculate the numerator and denominator in each case to get an idea of what's happening. Feb 10, 2023 at 17:26