Inside a limit, when can you substitute terms? To illustrate what I'm trying to say in the title, consider the following limit.
$$\lim_{x\to 0} \frac{\frac{\sin x}{x}-1}{x}$$
This, you might notice, is a derivative, but that is not relevant, it's simply an example I have at hand right now. My initial thought to solve such a limit, as $\lim_{x\to 0}\frac{\sin x}{x}= 1$, is to write $\lim_{x\to 0}\frac{1-1}{x}=\lim_{x\to 0}\frac{0}{x} = 0$, which IS correct, that is the value of the limit but I'm 90% sure it is only an accident this approach works. Instead, what I'm sure is correct is $$\lim_{x\to 0}\frac{\frac{\sin x}{x}-1}{x} = \lim_{x\to 0} \frac{\sin x - x}{x^2}=\left(\frac00\right)\underset{\overbrace{\text{ so I can apply L'Hopital}}}{=}\\=\lim_{x\to 0} \frac{\cos x - 1}{2x} =\lim_{x\to 0} \frac{-\sin x}{2} = 0$$
My question is quite basic: when am I allowed to substitute terms with well-known limits, like I tried to in the first "solution"? Was that first attempt correct or is it a coincidence the result is also $0$, like I suspect? My teacher tried to explain this, but he was rather vague. I think he mentioned that finite factors that are not equal to $0$ can be given the value of their limit and even brought in front of the limit as a normal number. What about when there is a fraction and the denominator's limit is $0$? What are some other cases I need to be aware of?
I'm trying to fundamentally understand what I'm allowed to do and what is illegal, so to speak, so any help is much appreciated!
 A: There are few cases descending on theorems on operations on limits.
If the whole function is a sum of two functions and one of them has a limit different from $\pm\infty$, then you can substitute it, i.e
$$
\lim_{x\to x_0}f(x)=l\not\in\{-\infty,+\infty\} \implies \lim_{x\to x_0}[f(x)+g(x)]=l+\lim_{x\to x_0}g(x)
$$
If the whole function is a product of two functions and one of them has a limit different from $\pm\infty$ and from $0$, then you can substitute it, i.e
$$
\lim_{x\to x_0}f(x)=l\not\in\{-\infty,0,+\infty\} \implies \lim_{x\to x_0}[f(x)\cdot g(x)]=l\cdot\lim_{x\to x_0}g(x)
$$
The ratio can be managed as a product.
A: $$\lim_{x\to 0} \frac{\frac{\sin x}{x}-1}{x}$$
You ought to be cautious. Suppose I replace $\sin x $   by $x + 5 x^2.$  This new function, divided by $x,$ also has the limit $1$  as $x$ goes to zero.
What is this limit?
$$\lim_{x\to 0} \frac{\frac{x + 5 x^2}{x}-1}{x}$$
Here's one that is even worse, convenient to use an absolute value for a fractional exponent:
$$\lim_{x\to 0} \frac{\frac{x + |x|^{3/2}}{x}-1}{x}$$
I suspect you are looking for quick methods for contest problems. For the $\sin x$   problem, the quickest thing is to write $\sin x = x - \frac{x^3}{6}  +  smaller$
