\(y=\dfrac{xsinx}{tanx}+\dfrac{cosx}{tanx}=x.cosx+\dfrac{cos^2x}{sinx}=x.cosx+\dfrac{1}{sinx}-sinx\)
\(y'=cosx-x.sinx-\dfrac{cosx}{sin^2x}-cosx=-x.sinx-\dfrac{cosx}{sin^2x}\)
\(\Rightarrow y'+y.tan=-x.sinx-\dfrac{cosx}{sin^2x}+x.sinx+cosx\)
\(=cosx\left(1-\dfrac{1}{sin^2x}\right)=\dfrac{-cosx\left(1-sin^2x\right)}{sin^2x}=\dfrac{-cos^3x}{sin^2x}\)