Error evaluating $ \lim_{x\to 0}\frac{x-\tan x}{x^3} $ 
Evaluate the limit:
  $$
\lim_{x\to 0}\frac{x-\tan x}{x^3}
$$

I solved it like this,
$$
\lim_{x\to 0} \left({1\over x^2} - \frac{\tan x}{x^3}\right)
=\lim_{x\to 0}\left({1\over x^2} - {\tan x\over x}\cdot {1\over x^2}\right)
$$
Now using the property 
$$
\lim_{x\to 0} \frac{\tan x}{x}=1
$$
we have:
$$
\lim_{x \to 0} \left(\frac{1}{x^2} - \frac{1}{x^2}\right)=0
$$
Please explain my error! How can I avoid such errors?
I have it's correct solution. All I want to know is what I did wrong here?
Note: English is my second language.
 A: The explanation you're looking for is this. You are implicitly using the properties $\lim\limits (f+g)=\lim\limits(f)+\lim\limits(g)$ and $\lim\limits (fg)=\lim\limits(f)\lim\limits(g)$, but this is only true when all the limits in these equalities exist, (disclaimer: there are important assumptions that I'm not writing but that should accompany these properties). More specifically, what you did (implicitly) was:
$$
\begin{align}
    \lim\limits_{x\to 0} \left({1\over x^2} - \frac{\tan x}{x^3}\right)
&=\lim\limits_{x\to 0}\left({1\over x^2} - {\tan x\over x}\cdot {1\over x^2}\right)\\
&=\lim\limits_{x\to 0}\left({1\over x^2}\right) + \lim\limits_{x\to 0}\left(- {\tan x\over x}\cdot {1\over x^2}\right) \tag{Incorrect}\\
&=\lim\limits_{x\to 0}\left({1\over x^2}\right) - \lim\limits_{x\to 0}\left( {\tan x\over x}\right)\lim\limits_{x\to 0}\left({1\over x^2}\right) \tag{Incorrect}\\
&=\lim\limits_{x\to 0}\left({1\over x^2}\right) - \lim\limits_{x\to 0}\left({1\over x^2}\right) \tag{*}\\
&=\lim\limits_{x\to 0}\left({1\over x^2} - {1\over x^2}\right) \tag{Incorrect}\\
&=0 \tag{**}
\end{align}
$$
$(\text*)\text{ As correct as something meaningless can be}$
$(\text{**})\text{ Actually correct, but it's too late}$
You can't just replace the value of the limit inside without using the above reasoning or something else which will end up not working.
A: Although, in fact, $\lim_{x\to0}\frac{\tan x}x=1$, you cannot deduce from that that$$\lim_{x\to0}\frac1{x^2}-\frac{\tan x}x\times\frac1{x^2}=\lim_{x\to0}\frac1{x_2}-\frac1{x^2}.$$
In this case, L'Hopital's Rule is the way to go:\begin{align}\lim_{x\to0}\frac{x-\tan x}{x^3}&=\lim_{x\to0}\frac{-\tan^2x}{3x^2}\\&=-\frac13\left(\lim_{x\to0}\frac{\tan x}x\right)^2\\&=-\frac13.\end{align}
A: Right, $$\lim_{x\to0}\frac{\tan x}x=1.$$
But that doesn't mean that you can replace $\dfrac{\tan x}x$ by $1$ inside the limit !
Actually,
$$\frac{\tan x}x=1+f(x)\ne1$$ and the function $f$ can strike back.

The "striking back" works like this:


*

*subtracting $1$ from $\dfrac{\tan x}x$ isolates $f(x)$.

*then dividing by $x^2$ "amplifies" it, giving the term $\dfrac{f(x)}{x^2}$. It turns out that $f(x)$ has a double root at $x=0$, so that the fraction bring a finite contribution, but it could very well have been unbounded.
A: Everyone here is correctly pointing out that you cannot use $\displaystyle \lim_{x\to 0} \dfrac{\tan x}{x}=1$, but they haven't stated why is that.
Now let me try to explain it to you.
Before proceeding I would like to clear a fact.
Let $f(x)$ and $g(x)$ be two functions such that $\displaystyle \lim_{x\to a}f(x)=l$ and $\displaystyle \lim_{x\to a} g(x)=m$ then, 
$$\displaystyle \lim_{x\to a}\left(f(x)\pm g(x)\right) =l\pm m $$
But the converse i.e.
$$l\pm m = \displaystyle \lim_{x\to a}\left(f(x)\pm g(x)\right)\ \ \   ....(1)$$
may not be true.
I have marked this as $(1)$ because I'll be referring to it later.
You did this 
$$
\lim_{x\to 0} \left({1\over x^2} - \frac{\tan x}{x^3}\right)
=\lim_{x\to 0}\left({1\over x^2} - {\tan x\over x}\cdot {1\over x^2}\right)
$$
Everything looks fine uptill here. Now you want to use this property $\displaystyle \lim_{x\to 0} \dfrac{\tan x}{x}=1$
So you will have to split this expression like this.
$$
\lim_{x\to 0}\left({1\over x^2} - {\tan x\over x}\cdot {1\over x^2}\right) 
$$
$$\implies \lim_{x\to 0}{1\over x^2} - \lim_{x\to 0}\left({\tan x\over x}\cdot {1\over x^2}\right) $$
$$\implies \lim_{x\to 0}{1\over x^2} - \lim_{x\to 0}{\tan x\over x}\cdot\lim_{x\to 0} {1\over x^2} $$
Now you can use $\displaystyle \lim_{x\to 0} \dfrac{\tan x}{x}=1$ to get this
$$
\lim_{x \to 0}\frac{1}{x^2} - \lim_{x \to 0}\frac{1}{x^2}$$
Upon reaching this stage, you did this step 
$$
\lim_{x \to 0} \left(\frac{1}{x^2} - \frac{1}{x^2}\right)
$$
But this is wrong as I already stated in point (1) above.
Now you'd why is that. It is because
$$\lim_{x\to 0}{\tan x\over x}\cdot\lim_{x\to 0} {1\over x^2} \neq \lim_{x \to 0} \frac{1}{x^2} $$ 
but 
$$\lim_{x\to 0}{\tan x\over x}\cdot\lim_{x\to 0} {1\over x^2} = 1.00000000000..........0001 \cdot \lim_{x \to 0} \frac{1}{x^2} $$ 
This number is so close to $1$ that we just approximate it to $1$.
Therefore
$$\lim_{x\to 0}{1\over x^2} - \lim_{x\to 0}{\tan x\over x}\cdot\lim_{x\to 0} {1\over x^2} = \lim_{x\to 0} {1\over x^2} - 1.00000000000..........0001 \lim_{x \to 0} \dfrac{1}{x^2} $$ 
That's why I said in point $(1)$ the converse may not be true.
If you properly evaluate the limit as @Jose Carlos Santos and @roman did. You will find the answer to be $-\dfrac{1}{3}$.
You can clearly note that this answer is negative, because $$1.00000000000..........0001 \lim_{x \to 0} \frac{1}{x^2} > \lim_{x\to 0} {1\over x^2} $$ 
A: It has been shown in other answers what exactly went wrong with your approach.
As an alternative consider the Taylor expansion of your function under the limit around $0$. It's known that:
$$
\tan x \sim x + {x^3 \over 3} + O(x^5)
$$
Note that:
$$
\frac{\tan x}{x} \sim {1\over x}\left(x + {x^3 \over 3} + O(x^5)\right) = 1 + {x^2\over 3} + O(x^4)
$$
Thus as noted by Yves Daoust: ${\tan x \over x} = 1 + f(x)$.
Using this your limit becomes:
$$
\lim_{x\to0} \frac{x - \tan x}{x^3} \sim \lim_{x\to0}\frac{x - x - {x^3\over 3}}{x^3} = -{1\over 3}
$$
A: Another way of solving the problem is by using series expansion at $x=0$, then you have 
$\lim_{x \rightarrow 0} \frac{x- \tan{x}}{x^3} =
\lim_{x \rightarrow 0} \frac{x-(x + \frac{x^3}{3} + O(x^5))}{x^3} =
\lim_{x \rightarrow 0} \frac{-\frac{x^3}{3}+O(x^5)}{x^3} = -\frac{1}{3}$
A: Note that you can only split limits involving two functions if limits of both functions exists individually (and must be a finite, well defined numbers).
Therefore you first step itself is not allowed while evaluating limits. Moreover you can't replace (tanx)/x by 1 inside limit, you will have to first split the limit, but as I have mentioned it's an incorrect operation and would yield absurd results if ignored.

