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