Differentiate the following functions with respect to $x$ :
$\log \left\{\cot \left(\frac{\pi}{4}+\frac{x}{2}\right)\right\}$
Let $y=\log \left\{\cot \left(\frac{\pi}{4}+\frac{x}{2}\right)\right\}$
On differentiating $y$ with respect to $x$, we get
$\frac{\mathrm{dy}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left[\log \left\{\cot \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\right\}\right]$
We know $\frac{\mathrm{d}}{\mathrm{dx}}(\log \mathrm{x})=\frac{1}{\mathrm{x}}$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\frac{1}{\cot \left(\frac{\pi}{4}+\frac{x}{2}\right)} \frac{\mathrm{d}}{\mathrm{dx}}\left[\cot \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\right]$ [using chain rule]
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\tan \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \frac{\mathrm{d}}{\mathrm{dx}}\left[\cot \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\right]$
We have $\frac{\mathrm{d}}{\mathrm{dx}}(\cot \mathrm{x})=-\operatorname{cosec}^{2} \mathrm{x}$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=\tan \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\left[-\operatorname{cosec}^{2}\left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\right]$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\tan \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \operatorname{cosec}^{2}\left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\left[\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\pi}{4}\right)+\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\mathrm{x}}{2}\right)\right]$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\tan \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \operatorname{cosec}^{2}\left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\left[\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\pi}{4}\right)+\frac{1}{2} \frac{\mathrm{d}}{\mathrm{dx}}(\mathrm{x})\right]$
However, $\frac{\mathrm{d}}{\mathrm{dx}}(\mathrm{x})=1$ and derivative of a constant is 0 .
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\tan \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \operatorname{cosec}^{2}\left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)\left[0+\frac{1}{2} \times 1\right]$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\frac{1}{2} \tan \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \operatorname{cosec}^{2}\left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\frac{1}{2} \times \frac{\sin \left(\frac{\pi}{4}+\frac{x}{2}\right)}{\cos \left(\frac{\pi}{4}+\frac{x}{2}\right)} \times \frac{1}{\sin ^{2}\left(\frac{\pi}{4}+\frac{x}{2}\right)}$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\frac{1}{2 \sin \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right) \cos \left(\frac{\pi}{4}+\frac{\mathrm{x}}{2}\right)}$
$\Rightarrow \frac{d y}{d x}=-\frac{1}{\sin \left[2\left(\frac{\pi}{4}+\frac{x}{2}\right)\right]}[\because \sin 2 \theta=2 \sin \theta \cos \theta]$
$\Rightarrow \frac{d y}{d x}=-\frac{1}{\sin \left(\frac{\pi}{2}+x\right)}$
$\Rightarrow \frac{\mathrm{dy}}{\mathrm{dx}}=-\frac{1}{\cos \mathrm{x}}\left[\because \sin \left(90^{\circ}+\theta\right)=\cos \theta\right]$
$\therefore \frac{\mathrm{dy}}{\mathrm{dx}}=-\sec \mathrm{x}$
Thus, $\frac{d}{d x}\left[\log \left\{\cot \left(\frac{\pi}{4}+\frac{x}{2}\right)\right\}\right]=-\sec x$