<s>[INST] Derivative of $f(x) = \csc(x)\cot(x)$ using first principles. How to find derivative of $f(x) = \csc(x)\cot(x)$ using First principle of derivative?

I tried the following method.
$f(x) = \csc(x)\cot(x) = \dfrac{\cos(x)}{\sin^2(x)}$
Now using the limit,
$f'(x) = \lim\limits_{h\to0}\dfrac{\dfrac{\cos(x+h)}{\sin^2(x+h)} - \dfrac{\cos(x)}{\sin^2(x)}}{h}$
$f'(x) = \lim\limits_{h\to0}\dfrac{\cos(x+h)\sin^2(x) - \cos(x) \sin^2(x+h)}{h\sin^2(x+h)\sin^2(x)}$

Now, what should I do with this limit?  I tried to apply the following identities,

*

*$\cos(A+B)= \cos(A)\cos(B) - \sin(A)\sin(B)$

*$\sin(A+B) = \sin(A) \cos(B) + \cos(A) \sin(B)$
I also tried to change $\sin^2(x) $ into $\dfrac{1 - \cos(2x)}{2}$,
But all of these formulas seem not to work here. Can anyone guide me for the same?
 [/INST] Your $\sin x$ in the last denominator you found should be $\sin^2x$.
Act on the numerator:
$$
\cos(x+h)\sin^2x=\cos x\sin^2x\cos h-\sin^3x\sin h
$$
and
\begin{align}
\cos x\sin^2(x+h)
&=\cos x(\sin x\cos h+\cos x\sin h)^2 \\
&=\cos x\sin^2x\cos^2h+2\sin x\cos^2x\sin h\cos h+\cos^3x\sin^2h
\end{align}
Now subtract and collect the terms with $\sin h$ and those with $\cos h$:
\begin{align}
&(-\sin^3x-2\sin x\cos^2x\cos h+\cos^3x\sin h)\sin h \\
&+\cos x\sin^2x\cos h(1-\cos h)
\end{align}
Now you want
\begin{multline}
\lim_{h\to0}\frac{1}{\sin^2(x+h)\sin^2x}\Bigl((-\sin^3x-2\sin x\cos^2x\cos h+\cos^3x\sin h)\frac{\sin h}{h}\\+\cos x\sin^2x\cos h\frac{1-\cos h}{h}\Bigr)
\end{multline}
Since
$$
\lim_{h\to 0}\frac{\sin h}{h}=1,\qquad \lim_{x\to0}\frac{1-\cos h}{h}=0
$$
your limit evaluates to
$$
\frac{-\sin^3x-2\sin x\cos^2x}{\sin^4x}=-\frac{\sin^2x+2\cos^2x}{\sin^3x}
$$
</s>