Differentiate $\tan ^{-1}\left(\frac{\cos x}{1+\sin x}\right)$ with respect to $\sec ^{-1} x$.
Let $u=\tan ^{-1}\left(\frac{\cos x}{1+\sin x}\right)$ and $v=\sec ^{-1} x$
We need to differentiate $u$ with respect to $v$ that is find $\frac{d u}{d v}$.
We have $u=\tan ^{-1}\left(\frac{\cos x}{1+\sin x}\right)$
$\Rightarrow \mathrm{u}=\tan ^{-1}\left(\frac{\cos \left(2 \times \frac{\mathrm{x}}{2}\right)}{1+\sin \left(2 \times \frac{x}{2}\right)}\right)$
But, $\cos 2 \theta=\cos ^{2} \theta-\sin ^{2} \theta$ and $\sin 2 \theta=2 \sin \theta \cos \theta$.
$\Rightarrow u=\tan ^{-1}\left(\frac{\cos ^{2} \frac{x}{2}-\sin ^{2} \frac{x}{2}}{1+2 \sin \frac{x}{2} \cos \frac{x}{2}}\right)$
$\Rightarrow u=\tan ^{-1}\left(\frac{\cos ^{2} \frac{x}{2}-\sin ^{2} \frac{x}{2}}{\cos ^{2} \frac{x}{2}+\sin ^{2} \frac{x}{2}+2 \sin \frac{x}{2} \cos \frac{x}{2}}\right)\left[\because \sin ^{2} \theta+\cos ^{2} \theta=1\right]$
$\Rightarrow u=\tan ^{-1}\left(\frac{\left(\cos \frac{x}{2}\right)^{2}-\left(\sin \frac{x}{2}\right)^{2}}{\left(\cos \frac{x}{2}\right)^{2}+\left(\sin \frac{x}{2}\right)^{2}+2\left(\sin \frac{x}{2}\right)\left(\cos \frac{x}{2}\right)}\right)$
$\Rightarrow u=\tan ^{-1}\left(\frac{\left(\cos \frac{x}{2}+\sin \frac{x}{2}\right)\left(\cos \frac{x}{2}-\sin \frac{x}{2}\right)}{\left(\cos \frac{x}{2}+\sin \frac{x}{2}\right)^{2}}\right)$
$\Rightarrow u=\tan ^{-1}\left(\frac{\cos \frac{x}{2}-\sin \frac{x}{2}}{\cos \frac{x}{2}+\sin \frac{x}{2}}\right)$
Dividing the numerator and denominator with $\cos \frac{x}{2}$, we get
$\Rightarrow u=\tan ^{-1}\left(\frac{\frac{\cos \frac{x}{2}-\sin \frac{x}{2}}{\cos \frac{x}{2}}}{\frac{\cos \frac{x}{2}+\sin \frac{x}{2}}{\cos \frac{x}{2}}}\right)$
$\Rightarrow u=\tan ^{-1}\left(\frac{\frac{\cos \frac{x}{2}}{\cos \frac{x}{2}}-\frac{\sin \frac{x}{2}}{\cos \frac{x}{2}}}{\frac{\cos \frac{x}{2}}{\cos \frac{x}{2}}+\frac{\sin \frac{x}{2}}{\cos \frac{x}{2}}}\right)$
$\Rightarrow u=\tan ^{-1}\left(\frac{1-\tan \frac{X}{2}}{1+\tan \frac{X}{2}}\right)$
$\Rightarrow \mathrm{u}=\tan ^{-1}\left(\frac{\tan \frac{\pi}{4}-\tan \frac{\mathrm{x}}{2}}{1+\tan \frac{\pi}{4} \tan \frac{\mathrm{x}}{2}}\right)$
$\Rightarrow \mathrm{u}=\tan ^{-1}\left(\tan \left(\frac{\pi}{4}-\frac{\mathrm{x}}{2}\right)\right)\left[\because \tan (\mathrm{A}-\mathrm{B})=\frac{\tan \mathrm{A}-\tan \mathrm{B}}{1+\tan \mathrm{A} \tan \mathrm{B}}\right]$
$\Rightarrow \mathrm{u}=\frac{\pi}{4}-\frac{\mathrm{x}}{2}$
On differentiating $u$ with respect to $x$, we get
$\frac{\mathrm{du}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\pi}{4}-\frac{\mathrm{x}}{2}\right)$
$\Rightarrow \frac{\mathrm{du}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\pi}{4}\right)-\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{x}{2}\right)$
$\Rightarrow \frac{\mathrm{du}}{\mathrm{dx}}=\frac{\mathrm{d}}{\mathrm{dx}}\left(\frac{\pi}{4}\right)-\frac{1}{2} \frac{\mathrm{d}}{\mathrm{dx}}(\mathrm{x})$
We know $\frac{d}{d x}(x)=1$ and derivative of a constant is 0 .
$\Rightarrow \frac{\mathrm{du}}{\mathrm{dx}}=0-\frac{1}{2} \times 1$
$\therefore \frac{\mathrm{du}}{\mathrm{dx}}=-\frac{1}{2}$
Now, we have $v=\sec ^{-1} x$
On differentiating $v$ with respect to $x$, we get
$\frac{d v}{d x}=\frac{d}{d x}\left(\sec ^{-1} x\right)$
We know $\frac{d}{d x}\left(\sec ^{-1} x\right)=\frac{1}{x \sqrt{x^{2}-1}}$
$\therefore \frac{\mathrm{dv}}{\mathrm{dx}}=\frac{1}{\mathrm{x} \sqrt{\mathrm{x}^{2}-1}}$
We have $\frac{d u}{d v}=\frac{\frac{d u}{d x}}{\frac{d v}{d x}}$
$\Rightarrow \frac{\mathrm{du}}{\mathrm{dv}}=\frac{-\frac{1}{2}}{\frac{1}{\mathrm{x} \sqrt{\mathrm{x}^{2}-1}}}$
$\Rightarrow \frac{\mathrm{du}}{\mathrm{dv}}=-\frac{1}{2} \times \mathrm{x} \sqrt{\mathrm{x}^{2}-1}$
$\therefore \frac{\mathrm{du}}{\mathrm{dv}}=-\frac{\mathrm{x} \sqrt{\mathrm{x}^{2}-1}}{2}$
Thus, $\frac{\mathrm{du}}{\mathrm{dv}}=-\frac{\mathrm{x} \sqrt{\mathrm{x}^{2}-1}}{2}$