5
$\begingroup$

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?

$\endgroup$
15
  • 1
    $\begingroup$ Can you show your steps in arriving at the answer $1/2$? $\endgroup$
    – Brian Tung
    Feb 10, 2023 at 16:58
  • 1
    $\begingroup$ sure, i'll edit my answer to include that. $\endgroup$ Feb 10, 2023 at 16:59
  • 1
    $\begingroup$ 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. $\endgroup$
    – Théophile
    Feb 10, 2023 at 17:16
  • 1
    $\begingroup$ 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)$. $\endgroup$
    – Fishbane
    Feb 10, 2023 at 17:23
  • 1
    $\begingroup$ @Théophile You do not need to apply the trick: just use $\sin^2x=1-\cos^2x$ in the denominator. $\endgroup$ Feb 10, 2023 at 22:09

1 Answer 1

6
$\begingroup$

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

$\endgroup$
5
  • $\begingroup$ So, if I understood correctly, is the error just due to the computer's inability to calculate those values precisely enough? $\endgroup$ Feb 10, 2023 at 17:15
  • 1
    $\begingroup$ Yes, although inability is too strong. The computer is capable of doing it, but normally uses the standard floating point numbers which are not precise enough. With a more sophisticated program it can do so. Wikipedia has a discussion. It is a huge topic in numerical analysis $\endgroup$ Feb 10, 2023 at 17:22
  • 2
    $\begingroup$ @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. $\endgroup$
    – Théophile
    Feb 10, 2023 at 17:26
  • $\begingroup$ Understood @RossMillikan, thank you for your answer! $\endgroup$ Feb 10, 2023 at 17:32
  • $\begingroup$ @Théophile, yeah I get f(x)=0.5 but g(x)=0 $\endgroup$ Feb 10, 2023 at 17:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .