Differentiate $(\cos x)^{\sin x}$ with respect to $(\sin x)^{\cos x}$.
Let $u=(\cos x)^{\sin x}$ and $v=(\sin x)^{\cos x}$.
We need to differentiate $u$ with respect to $v$ that is find $\frac{\mathrm{du}}{\mathrm{dv}}$.
We have $u=(\cos x)^{\sin x}$
Taking log on both sides, we get
$\log u=\log (\cos x)^{\sin x}$
$\Rightarrow \log u=(\sin x) \times \log (\cos x)\left[\because \log a^{m}=m \times \log a\right]$
On differentiating both the sides with respect to $x$, we get
$\frac{\mathrm{d}}{\mathrm{du}}(\log \mathrm{u}) \times \frac{\mathrm{du}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}[\sin \mathrm{x} \times \log (\cos \mathrm{x})]$
Recall that (uv)' $=v u^{\prime}+u v^{\prime}$ (product rule)
$\Rightarrow \frac{\mathrm{d}}{\mathrm{du}}(\log \mathrm{u}) \times \frac{\mathrm{du}}{\mathrm{dx}}=\log (\cos \mathrm{x}) \frac{\mathrm{d}}{\mathrm{dx}}(\sin \mathrm{x})+\sin \mathrm{x} \frac{\mathrm{d}}{\mathrm{dx}}[\log (\cos \mathrm{x})]$
We know $\frac{d}{d x}(\log x)=\frac{1}{x}$ and $\frac{d}{d x}(\sin x)=\cos x$
$\Rightarrow \frac{1}{\mathrm{u}} \times \frac{\mathrm{du}}{\mathrm{dx}}=\log (\cos \mathrm{x}) \times \cos \mathrm{x}+\sin \mathrm{x}\left[\frac{1}{\cos \mathrm{x}} \frac{\mathrm{d}}{\mathrm{dx}}(\cos \mathrm{x})\right]$
$\Rightarrow \frac{1}{\mathrm{u}} \frac{\mathrm{du}}{\mathrm{dx}}=\cos \mathrm{x} \log (\cos \mathrm{x})+\frac{\sin \mathrm{x}}{\cos \mathrm{x}} \frac{\mathrm{d}}{\mathrm{dx}}(\cos \mathrm{x})$
$\Rightarrow \frac{1}{\mathrm{u}} \frac{\mathrm{du}}{\mathrm{dx}}=\cos \mathrm{x} \log (\cos \mathrm{x})+\tan \mathrm{x} \frac{\mathrm{d}}{\mathrm{dx}}(\cos \mathrm{x})$
We know $\frac{d}{d x}(\cos x)=-\sin x$
$\Rightarrow \frac{1}{u} \frac{d u}{d x}=\cos x \log (\cos x)+\tan x(-\sin x)$
$\Rightarrow \frac{1}{u} \frac{d u}{d x}=\cos x \log (\cos x)-\tan x \sin x$
But, $u=(\cos x)^{\sin x}$
$\Rightarrow \frac{1}{(\cos x)^{\sin x}} \frac{d u}{d x}=\cos x \log (\cos x)-\tan x \sin x$
$\therefore \frac{d u}{d x}=(\cos x)^{\sin x}[\cos x \log (\cos x)-\tan x \sin x]$
Now, we have $v=(\sin x)^{\cos x}$
Taking log on both sides, we get
$\log v=\log (\sin x)^{\cos x}$
$\Rightarrow \log v=(\cos x) \times \log (\sin x)\left[\because \log a^{m}=m \times \log a\right]$
On differentiating both the sides with respect to $x$, we get
$\frac{\mathrm{d}}{\mathrm{dv}}(\log \mathrm{v}) \times \frac{\mathrm{dv}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}[\cos \mathrm{x} \times \log (\sin \mathrm{x})]$
Recall that (uv)' $=v u^{\prime}+u v^{\prime}$ (product rule)
$\Rightarrow \frac{\mathrm{d}}{\mathrm{du}}(\log \mathrm{u}) \times \frac{\mathrm{dv}}{\mathrm{dx}}=\log (\sin \mathrm{x}) \frac{\mathrm{d}}{\mathrm{dx}}(\cos \mathrm{x})+\cos \mathrm{x} \frac{\mathrm{d}}{\mathrm{dx}}[\log (\sin \mathrm{x})]$
We know $\frac{d}{d x}(\log x)=\frac{1}{x}$ and $\frac{d}{d x}(\cos x)=-\sin x$
$\Rightarrow \frac{1}{v} \times \frac{d v}{d x}=\log (\sin x) \times(-\sin x)+\cos x\left[\frac{1}{\sin x} \frac{d}{d x}(\sin x)\right]$
$\Rightarrow \frac{1}{v} \frac{d v}{d x}=-\sin x \log (\sin x)+\frac{\cos x}{\sin x} \frac{d}{d x}(\sin x)$
$\Rightarrow \frac{1}{v} \frac{d v}{d x}=-\sin x \log (\sin x)+\cot x \frac{d}{d x}(\sin x)$
We know $\frac{d}{d x}(\sin x)=\cos x$
$\Rightarrow \frac{1}{v} \frac{d v}{d x}=-\sin x \log (\sin x)+\cot x \times(\cos x)$
$\Rightarrow \frac{1}{v} \frac{d v}{d x}=-\sin x \log (\sin x)+\cot x \cos x$
But, $v=(\sin x)^{\cos x}$
$\Rightarrow \frac{1}{(\sin x)^{\cos x}} \frac{d v}{d x}=-\sin x \log (\sin x)+\cot x \cos x$
$\therefore \frac{d v}{d x}=(\sin x)^{\cos x}[-\sin x \log (\sin x)+\cot x \cos x]$
We have $\frac{\mathrm{du}}{\mathrm{dv}}=\frac{\frac{\mathrm{du}}{\mathrm{dv}}}{\frac{\mathrm{dv}}{\mathrm{dx}}}$
$\Rightarrow \frac{d u}{d v}=\frac{(\cos x)^{\sin x}[\cos x \log (\cos x)-\tan x \sin x]}{(\sin x)^{\cos x}[-\sin x \log (\sin x)+\cot x \cos x]}$
$\therefore \frac{d u}{d v}=\frac{(\cos x)^{\sin x}[\cos x \log (\cos x)-\tan x \sin x]}{(\sin x)^{\cos x}[\cot x \cos x-\sin x \log (\sin x)]}$
Thus, $\frac{d u}{d v}=\frac{(\cos x)^{\sin x}[\cos x \log (\cos x)-\tan x \sin x]}{(\sin x)^{\cos x}[\cot x \cos x-\sin x \log (\sin x)]}$