# Differentiate the function with respect to x.

Question:

Differentiate the function with respect to x.

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

Solution:

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

Also, let $u=(x \cos x)^{x}$ and $v=(x \sin x)^{\frac{1}{x}}$

$\therefore y=u+v$

$\Rightarrow \frac{d y}{d x}=\frac{d u}{d x}+\frac{d v}{d x}$   ...(1)

$u=(x \cos x)^{x}$

$\Rightarrow \log u=\log (x \cos x)^{x}$

$\Rightarrow \log u=x \log (x \cos x)$

$\Rightarrow \log u=x[\log x+\log \cos x]$

$\Rightarrow \log u=x \log x+x \log \cos x$

Differentiating both sides with respect to x, we obtain

$\frac{1}{u} \frac{d u}{d x}=\frac{d}{d x}(x \log x)+\frac{d}{d x}(x \log \cos x)$

$\Rightarrow \frac{d u}{d x}=u\left[\left\{\log x \cdot \frac{d}{d x}(x)+x \cdot \frac{d}{d x}(\log x)\right\}+\left\{\log \cos x \cdot \frac{d}{d x}(x)+x \cdot \frac{d}{d x}(\log \cos x)\right\}\right]$

$\Rightarrow \frac{d u}{d x}=(x \cos x)^{x}\left[\left(\log x \cdot 1+x \cdot \frac{1}{x}\right)+\left\{\log \cos x \cdot 1+x \cdot \frac{1}{\cos x} \cdot \frac{d}{d x}(\cos x)\right\}\right]$

$\Rightarrow \frac{d u}{d x}=(x \cos x)^{x}\left[(\log x+1)+\left\{\log \cos x+\frac{x}{\cos x} \cdot(-\sin x)\right\}\right]$

$\Rightarrow \frac{d u}{d x}=(x \cos x)^{x}[(1+\log x)+(\log \cos x-x \tan x)]$

$\Rightarrow \frac{d u}{d x}=(x \cos x)^{x}[1-x \tan x+(\log x+\log \cos x)]$

$\Rightarrow \frac{d u}{d x}=(x \cos x)^{x}[1-x \tan x+\log (x \cos x)]$    ...(2)

$v=(x \sin x)^{\frac{1}{x}}$

$\Rightarrow \log v=\log (x \sin x)^{\frac{1}{x}}$

$\Rightarrow \log v=\frac{1}{x} \log (x \sin x)$

$\Rightarrow \log v=\frac{1}{x}(\log x+\log \sin x)$

$\Rightarrow \log v=\frac{1}{x} \log x+\frac{1}{x} \log \sin x$

Differentiating both sides with respect to x, we obtain

$\frac{1}{v} \frac{d v}{d x}=\frac{d}{d x}\left(\frac{1}{x} \log x\right)+\frac{d}{d x}\left[\frac{1}{x} \log (\sin x)\right]$

$\Rightarrow \frac{1}{v} \frac{d v}{d x}=\left[\log x \cdot \frac{d}{d x}\left(\frac{1}{x}\right)+\frac{1}{x} \cdot \frac{d}{d x}(\log x)\right]+\left[\log (\sin x) \cdot \frac{d}{d x}\left(\frac{1}{x}\right)+\frac{1}{x} \cdot \frac{d}{d x}\{\log (\sin x)\}\right]$

$\Rightarrow \frac{1}{v} \frac{d v}{d x}=\left[\log x \cdot\left(-\frac{1}{x^{2}}\right)+\frac{1}{x} \cdot \frac{1}{x}\right]+\left[\log (\sin x) \cdot\left(-\frac{1}{x^{2}}\right)+\frac{1}{x} \cdot \frac{1}{\sin x} \cdot \frac{d}{d x}(\sin x)\right]$

$\Rightarrow \frac{1}{v} \frac{d v}{d x}=\frac{1}{x^{2}}(1-\log x)+\left[-\frac{\log (\sin x)}{x^{2}}+\frac{1}{x \sin x} \cdot \cos x\right]$

$\Rightarrow \frac{d v}{d x}=(x \sin x)^{\frac{1}{x}}\left[\frac{1-\log x}{x^{2}}+\frac{-\log (\sin x)+x \cot x}{x^{2}}\right]$

$\Rightarrow \frac{d v}{d x}=(x \sin x)^{\frac{1}{x}}\left[\frac{1-\log x-\log (\sin x)+x \cot x}{x^{2}}\right]$

$\Rightarrow \frac{d v}{d x}=(x \sin x)^{\frac{1}{x}}\left[\frac{1-\log (x \sin x)+x \cot x}{x^{2}}\right]$    ...(3)

From (1), (2), and (3), we obtain

$\frac{d y}{d x}=(x \cos x)^{x}[1-x \tan x+\log (x \cos x)]+(x \sin x)^{\frac{1}{x}}\left[\frac{x \cot x+1-\log (x \sin x)}{x^{2}}\right]$