$$\lim_{x \to 0}\left(\dfrac 1 {\sin x}-\dfrac1 x\right) $$
I solved this problem using the fact that near $x=0$ , $\sin x \cong x$),$(\sin x=x+O(x^2)$ therefore subtracting them results to $0$ which I did verify using other techniques, However, the same reasoning leads to $0$ in solving
$$\lim_{x \to 0}\left(\dfrac 1 {\log (x+1)}-\dfrac1 x\right) $$
while the correct result is $1/2$ although $\log(x+1) \cong x$ when $x$ is near zero$(\log (x+1)=x+O(x^2)$.What is getting wrong here?
The first try fails because the limit of both terms is $\infty$. You need the stronger result $$ \sin x = x + o(x^2) $$
and then you get $$ \frac 1{\sin x} - \frac 1x = \frac{x - \sin x}{x\sin x} = \frac{o(x^2)}{x\sin x} = o(1)\to 0 $$
More generally if $$ f(x) = x + a x^2 + o(x^2) $$(important case: $f$ is twice differentiable around 0 with $a = f''(0)/2$) then the limit is $-a$.