<s>[INST] How to prove that a diffrensiation of a formula equals to another formula. QUESTION 1) if $y =\dfrac{ \sin x-x\cos x}{x\sin x+\cos x}$  show that $\dfrac{dy}{dx}= \dfrac{x^2}{(x\sin x+\cos x)^2}$
QUESTION 2) if $y = \dfrac{\tan x+1}{\tan x-1}$ show that $\dfrac{dy}{dx}= \dfrac{-2}{1-\sin 2x}$
 [/INST] For the first, we get
\begin{align}
    \frac{d}{dx}\left(\frac{ \sin x-x\cos x}{x\sin x+\cos x}\right)
    &= \frac{(x\sin x + \cos x)(\cos x + x\sin x-\cos x)-(\sin x - x\cos x)(\sin x + x\cos x - \sin x)}{(x\sin x + \cos x)^2} \\
    &= \frac{x^2\sin^2 x + x\sin x\cos x - (x\sin x\cos x - x^2\cos^2 x)}{(x\sin x + \cos x)^2} \\
    &= \frac{x^2(\sin^2 x + \cos^2 x)}{(x\sin x + \cos x)^2} \\
    &= \frac{x^2}{(x\sin x + \cos x)^2} .
\end{align}
</s>