Differentiation

Find $\dfrac{dy}{dx}$ when $y=x^{\cot x} + \dfrac{2x^2 - 3}{x^2 + x +2}$


Let $y = p \left(x\right) + q \left(x\right)$ where $p \left(x\right) = x^{\cot x}$ and $q\left(x\right) = \dfrac{2x^2 -3}{x^2 + x + 2}$

Then $\dfrac{dy}{dx} = \dfrac{dp}{dx} + \dfrac{dq}{dx}$

$ \begin{aligned} p & = x^{\cot x} \\ \therefore \log p & = \log \left(x^{\cot x}\right) \\ \text{i.e. } \log p & = \cot x \log x \\ \therefore \dfrac{1}{p} \dfrac{dp}{dx} & = \dfrac{\cot x}{x} - \text{cosec}^2 x \log x \\ \text{i.e. } \dfrac{dp}{dx} & = p \left(\dfrac{\cot x}{x} - \text{cosec}^2 x \log x\right) \\ \text{i.e. } \dfrac{dp}{dx} & = x^{\cot x} \left(\dfrac{\cot x}{x} - \text{cosec}^2 x \log x\right) \end{aligned} $

$ \begin{aligned} q & = \dfrac{2x^2 - 3}{x^2 + x + 2} \\ \therefore \dfrac{dq}{dx} & = \dfrac{\left(x^2+x+2\right)\times \dfrac{d}{dx} \left(2x^2 -3\right) - \left(2x^2 -3\right) \times \dfrac{d}{dx} \left(x^2+x+2\right)}{\left(x^2+x+2\right)^2} \\ & = \dfrac{\left(x^2+x+2\right)\left(4x\right) - \left(2x^2 - 3\right)\left(2x+1\right)}{\left(x^2+x+2\right)^2} \\ & = \dfrac{4x^3 + 4x^2 + 8x - 4x^3 + 6x -2x^2 + 3}{\left(x^2 + x + 2\right)^2} \\ & = \dfrac{2x^2 + 14x + 3}{\left(x^2 + x + 2\right)^2} \end{aligned} $

$\therefore$ $\dfrac{dy}{dx} = \dfrac{dp}{dx} + \dfrac{dq}{dx} = x^{\cot x} \left(\dfrac{\cot x}{x} - \text{cosec}^2 x \log x\right) + \dfrac{2x^2 + 14x + 3}{\left(x^2 + x + 2\right)^2}$