# Differentiate the following functions with respect to x :

Question:

Differentiate the following functions with respect to $x$ :

$x^{(\sin x-\cos x)}+\frac{x^{2}-1}{x^{2}+1}$

Solution:

Let $y=x^{(\sin x-\cos x)}+\frac{x^{2}-1}{x^{2}+1}$

$\Rightarrow y=a+b$

where $a=x^{(\sin x-\cos x)} ; b=\frac{x^{2}-1}{x^{2}+1}$

$\frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{da}}{\mathrm{dx}}+\frac{\mathrm{db}}{\mathrm{dx}}$

$\left\{\right.$ Using chain rule, $\frac{\mathrm{d}(\mathrm{u}+\mathrm{a})}{\mathrm{dx}}=\frac{\mathrm{du}}{\mathrm{dx}}+\frac{\mathrm{da}}{\mathrm{dx}}$ where a and $\mathrm{u}$ are any variables $\}$

$a=x^{(\sin x-\cos x)}$

Taking log both the sides:

$\Rightarrow \log a=\log x^{(\sin x-\cos x)}$

$\Rightarrow \log a=(\sin x-\cos x) \log x$

$\left\{\log x^{a}=\operatorname{alog} x\right\}$

Differentiating with respect to $\mathrm{x}$ :

$\Rightarrow \frac{\mathrm{d}(\log \mathrm{a})}{\mathrm{dx}}=\frac{\mathrm{d}((\sin \mathrm{x}-\cos \mathrm{x}) \log \mathrm{x})}{\mathrm{dx}}$

$\Rightarrow \frac{d(\log a)}{d x}=(\sin x-\cos x) \times \frac{d(\log x)}{d x}+\log x \times \frac{d(\sin x-\cos x)}{d x}$

$\left\{\right.$ Using product rule, $\left.\frac{\mathrm{d}(\mathrm{uv})}{\mathrm{dx}}=\mathrm{u} \frac{\mathrm{d} \mathrm{v}}{\mathrm{dx}}+\mathrm{v} \frac{\mathrm{du}}{\mathrm{dx}}\right\}$

$\Rightarrow \frac{1}{a} \frac{d a}{d x}=(\sin x-\cos x) \times \frac{1}{x} \frac{d x}{d x}+\log x\left(\frac{d(\sin x)}{d x}-\frac{d(\cos x)}{d x}\right)$

$\Rightarrow \frac{1}{a} \frac{d a}{d x}=\frac{(\sin x-\cos x)}{x}+\log x(\cos x-(-\sin x))$

$\left\{\frac{\mathrm{d}(\cos \mathrm{x})}{\mathrm{dx}}=-\sin \mathrm{x} ; \frac{\mathrm{d}(\sin \mathrm{x})}{\mathrm{dx}}=\cos \mathrm{x}\right\}$

$\Rightarrow \frac{1}{a} \frac{d a}{d x}=\frac{(\sin x-\cos x)}{x}+\log x(\cos x+\sin x)$

$\Rightarrow \frac{d a}{d x}=a\left\{\frac{\sin x-\cos x}{x}+\log x(\cos x+\sin x)\right\}$]

Put the value of $a=x^{(\sin x-\cos x)}$ :

$\Rightarrow \frac{\mathrm{da}}{\mathrm{dx}}=\mathrm{x}^{(\sin \mathrm{x}-\cos \mathrm{x})}\left\{\frac{\sin \mathrm{x}-\cos \mathrm{x}}{\mathrm{x}}+\log \mathrm{x}(\cos \mathrm{x}+\sin \mathrm{x})\right\}$

$\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{d\left(\frac{u}{v}\right)}{d x}=\frac{v \frac{d u}{d x}-u \frac{d v}{d x}}{v^{2}} ; \frac{d\left(u^{n}\right)}{d x}=n u^{n-1} \frac{d u}{d x}\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{d(u+a)}{d x}=\frac{d u}{d x}$ where $a$ is any constant and $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{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{da}}{\mathrm{dx}}+\frac{\mathrm{db}}{\mathrm{dx}}$

$\Rightarrow \frac{d y}{d x}=x^{(\sin x-\cos x)}\left\{\frac{\sin x-\cos x}{x}+\log x(\cos x+\sin x)\right\}+\frac{4 x}{\left(x^{2}+1\right)^{2}}$