Differentiation

Differentiate $\left(x\right)^{\cos x} + \left(\cos x\right)^x$ w.r.t x


Let $y = p\left(x\right) + q\left(x\right)$ where $p\left(x\right) = \left(x\right)^{\cos x}$ and $q\left(x\right)=\left(\cos x\right)^x$

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

$p = \left(x\right)^{\cos x}$

$\therefore$ $\log p = \log \left(x\right)^{\cos x} = \cos x \log \left(x\right)$

$\therefore$ $\dfrac{1}{p} \dfrac{dp}{dx} = \dfrac{\cos x}{x} - \sin x \log \left(x\right)$

$\therefore$ $\dfrac{dp}{dx} = p \left[\dfrac{\cos x}{x} - \sin x \log \left(x\right)\right]$

i.e. $\dfrac{dp}{dx} = \left(x\right)^{\cos x} \left[\dfrac{\cos x}{x} - \sin x \log \left(x\right)\right]$

$q = \left(\cos x\right)^x$

$\therefore$ $\log q = \log \left(\cos x\right)^x = x \log \left(\cos x\right)$

$\therefore$ $\dfrac{1}{q} \dfrac{dq}{dx} = \dfrac{x}{\cos x} \times \left(- \sin x\right) + \log \left(\cos x\right)$

$\therefore$ $\dfrac{dq}{dx} = q \left[- x \tan x + \log \left(\cos x\right)\right]$

i.e. $\dfrac{dq}{dx} = \left(\cos x\right)^x \left[-x\tan x + \log \left(\cos x\right)\right]$

$\therefore$ $\dfrac{dy}{dx} = \left(x\right)^{\cos x} \left[\dfrac{\cos x}{x} - \sin x \log \left(x\right)\right] + \left(\cos x\right)^x \left[-x\tan x + \log \left(\cos x\right)\right]$