# Differentiate the function with respect to x.

Question:

Differentiate the function with respect to x.

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

Solution:

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

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

$\therefore y=u+v$

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

$u=x^{\sin x}$

$\Rightarrow \log u=\log \left(x^{\sin x}\right)$

$\Rightarrow \log u=\sin x \log x$

Differentiating both sides with respect to x, we obtain

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

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

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

$v=(\sin x)^{\cos x}$

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

$\Rightarrow \log v=\cos 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}(\cos x) \times \log (\sin x)+\cos x \times \frac{d}{d x}[\log (\sin x)]$

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

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

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

$\Rightarrow \frac{d v}{d x}=(\sin x)^{\cos x}[\cot x \cos x-\sin x \log \sin x]$    .,.(3)

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

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