Differentiate the following functions with respect to $x$ :
$x^{x \cos x}+\frac{x^{2}+1}{x^{2}-1}$
Let $y=x^{x \cos x}+\frac{x^{2}+1}{x^{2}-1}$
$\Rightarrow y=a+b$
where $\mathrm{a}=\mathrm{x}^{\mathrm{x} \cos \mathrm{x}} ; \mathrm{b}=\frac{\mathrm{x}^{2}+1}{\mathrm{x}^{2}-1}$
$\frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{da}}{\mathrm{dx}}+\frac{\mathrm{db}}{\mathrm{dx}}$
$\left\{\right.$ Using chain rule, $\frac{d(u+a)}{d x}=\frac{d u}{d x}+\frac{d a}{d x}$ where $a$ and $u$ are any variables $\}$
$a=x^{x \cos x}$
Taking log both the sides:
$\Rightarrow \log a=\log x^{x \cos x}$
$\Rightarrow \log a=x \cos x \log x$
$\left\{\log x^{a}=a \log x\right\}$
Differentiating with respect to $x$ :
$\Rightarrow \frac{\mathrm{d}(\log \mathrm{a})}{\mathrm{dx}}=\frac{\mathrm{d}(\mathrm{x} \cos \mathrm{x} \log \mathrm{x})}{\mathrm{dx}}$
$\Rightarrow \frac{d(\log a)}{d x}=x \cos x \times \frac{d(\log x)}{d x}+\log x \times \frac{d(x \cos x)}{d x}$
$\left\{\begin{array}{c}\text { Using product rule, } \frac{\mathrm{d}(\mathrm{uvw})}{\mathrm{dx}}=\mathrm{uv} \frac{\mathrm{dw}}{\mathrm{dx}}+\mathrm{w} \frac{\mathrm{duv}}{\mathrm{dx}} \\ =\mathrm{uv} \frac{\mathrm{dw}}{\mathrm{dx}}+\mathrm{w}\left\{\mathrm{u} \frac{\mathrm{dv}}{\mathrm{dx}}+\mathrm{v} \frac{\mathrm{du}}{\mathrm{dx}}\right\}\end{array}\right\}$
$\Rightarrow \frac{\mathrm{d}(\log \mathrm{a})}{\mathrm{dx}}=\mathrm{x} \cos \mathrm{x} \times \frac{\mathrm{d}(\log \mathrm{x})}{\mathrm{dx}}+\log \mathrm{x}\left\{\mathrm{x} \frac{\mathrm{d}(\cos \mathrm{x})}{\mathrm{dx}}+\cos \mathrm{x}\right\}$
$\Rightarrow \frac{1}{a} \frac{d a}{d x}=x \cos x \times \frac{1}{x} \frac{d x}{d x}+\log x\{x(-\sin x)+\cos x\}$
$\left\{\frac{\mathrm{d}(\log \mathrm{u})}{\mathrm{dx}}=\frac{1}{\mathrm{u}} \frac{\mathrm{du}}{\mathrm{dx}}\right\}$
$\Rightarrow \frac{1}{a} \frac{d a}{d x}=\frac{x \cos x}{x}+\log x(\cos x-x \sin x)$
$\left\{\frac{d(\cos x)}{d x}=-\sin x ; \frac{d(\sin x)}{d x}=\cos x\right\}$
$\Rightarrow \frac{d a}{d x}=a\{\cos x+\log x(\cos x-x \sin x)\}$
Put the value of $a=x^{x \cos x}$ :
$\Rightarrow \frac{d a}{d x}=x^{x \cos x}\{\cos x+\log x(\cos x-x \sin x)\}$
$\Rightarrow \frac{d a}{d x}=x^{x \cos x}\{\cos x+\log x \cos x-x \sin x \log x\}$
$\Rightarrow \frac{d a}{d x}=x^{x \cos x}\{\cos x(1+\log x)-x \sin x \log x\}$
$\mathrm{b}=\frac{\mathrm{x}^{2}+1}{\mathrm{x}^{2}-1}$
$\Rightarrow \frac{\mathrm{db}}{\mathrm{dx}}=\frac{\left(\mathrm{x}^{2}-1\right) \frac{\mathrm{d}\left(\mathrm{x}^{2}+1\right)}{\mathrm{dx}}-\left(\mathrm{x}^{2}+1\right) \frac{\mathrm{d}\left(\mathrm{x}^{2}-1\right)}{\mathrm{dx}}}{\left(\mathrm{x}^{2}-1\right)^{2}}$
$\left\{\frac{\mathrm{d}\left(\frac{\mathrm{u}}{\mathrm{V}}\right)}{\mathrm{dx}}=\frac{\mathrm{v} \frac{\mathrm{du}}{\mathrm{dx}}-\mathrm{u} \frac{\mathrm{dv}}{\mathrm{dx}}}{\mathrm{v}^{2}} ; \frac{\mathrm{d}\left(\mathrm{u}^{\mathrm{n}}\right)}{\mathrm{dx}}=\mathrm{nu}^{\mathrm{n}-1} \frac{\mathrm{du}}{\mathrm{dx}}\right\}$
$\Rightarrow \frac{\mathrm{db}}{\mathrm{dx}}=\frac{\left(\mathrm{x}^{2}-1\right)(2 \mathrm{x})-\left(\mathrm{x}^{2}+1\right)(2 \mathrm{x})}{\left(\mathrm{x}^{2}+1\right)^{2}}$
$\left\{\right.$ Using chain rule, $\frac{\mathrm{d}(\mathrm{u}+\mathrm{a})}{\mathrm{dx}}=\frac{\mathrm{du}}{\mathrm{dx}}$ where $\mathrm{a}$ is any constant and $\mathrm{u}$ is any variable $\}$
$\Rightarrow \frac{\mathrm{db}}{\mathrm{dx}}=\frac{\left(2 \mathrm{x}^{3}-2 \mathrm{x}\right)-\left(2 \mathrm{x}^{3}+2 \mathrm{x}\right)}{\left(\mathrm{x}^{2}+1\right)^{2}}$
$\Rightarrow \frac{\mathrm{db}}{\mathrm{dx}}=\frac{\left(2 \mathrm{x}^{3}-2 \mathrm{x}-2 \mathrm{x}^{3}-2 \mathrm{x}\right)}{\left(\mathrm{x}^{2}+1\right)^{2}}$
$\Rightarrow \frac{\mathrm{db}}{\mathrm{dx}}=\frac{-4 \mathrm{x}}{\left(\mathrm{x}^{2}+1\right)^{2}}$
$\frac{d y}{d x}=\frac{d a}{d x}+\frac{d b}{d x}$
$\Rightarrow \frac{d y}{d x}=x^{x \cos x}\{\cos x(1+\log x)-x \sin x \log x\}-\frac{4 x}{\left(x^{2}+1\right)^{2}}$