<s>[INST] Derivative of $\tan^{-1} \sqrt{\frac{1-\cos x}{1-\sin x}}$ Is there any way to differentiate $\tan^{-1} \sqrt{\frac{1-\cos x}{1-\sin x}}$ without any messy calculations? Here are my thoughts:
We write $\cos x$ and $\sin x$ in terms of $\tan{\frac{x}{2}}$. Then our function becomes $\tan^{-1} \frac{\sqrt{2}\tan \frac{x}{2}}{1-\tan \frac{x}{2}}$. But I am afraid this doesn't seem to work since we can't extrapolate any triginometric formula of $\tan$ from here.
 [/INST] $\newcommand{\d}{\mathrm{d}}$Using some algebra and trigonometric identities, we can save ourselves a lot of work: $$\frac{1-\cos x}{1-\sin x}=\frac{(1-\cos x)(1+\sin x)}{\cos^2 x}=(\sec x-1)(\tan x+\sec x)$$
Using the chain rule: $$\frac{\d}{\d x}\arctan\left(\sqrt{\frac{1-\cos x}{1+\sin x}}\right)=\frac{1}{2}\cdot\frac{1}{\sqrt{(\sec x-1)(\tan x+\sec x)}}\cdot\frac{1}{1+(\sec x-1)(\tan x+\sec x)}\\\times\frac{\d}{\d x}[(\sec x-1)(\tan x+\sec x)]$$
This last derivative comes as, using the product rule: $$\tan x\sec x(\tan x+\sec x)+(\sec x-1)(\sec^2x+\tan x\sec x)=\\\sec^3 x+2\sec^2x\tan x+\sec x\tan x-\sec^2x-\tan x\sec x$$
Given $a^3+2a^2b+b^2a-a^2-ab$, and that we are interested in the quantities $(b-1)$ and $(a+b)$, with $a=\sec x$ and $b=\tan x$, we can factorise strategically: $$\begin{align}a^3+2a^2b+b^2a-a^2-ab&=a\cdot(a^2+2ab+b^2-a-b)\\&=a\cdot((a+b)^2-(a+b))\\&=a(a+b)\cdot(a+b-1)\end{align}$$
We can then bring it all together, rather simply, cancelling through $\frac{a+b}{\sqrt{a+b}}$: $$\begin{align}\frac{\d}{\d x}\arctan\left(\sqrt{\frac{1-\cos x}{1+\sin x}}\right)&=\frac{1}{2}\sqrt{\frac{\tan x+\sec x}{\sec x-1}}\cdot\frac{\sec x(\sec x+\tan x-1)}{1+(\sec x-1)(\tan x+\sec x)}\\&=\frac{\sec x(\tan x+\sec x-1)}{2(1+(\sec x-1)(\tan x+\sec x))}\cdot\sqrt{1+\cot^2x(\sec x+1)(\tan x+1)}\end{align}$$
If another user sees a way to simplify the last two expressions, please let me know! I think the problem was intended to have this neat factorisation. Be advised that the derivative of this function is highly discontinuous, more so than my expressions reveal. They should be understood as equal only when everything is well-defined and every stage of the working is too. Occasionally there are absolute value and sign errors too. This expression is valid on $(-\frac{\pi}{2},\frac{\pi}{2})\setminus\{0\}$ and on other regions too, periodically.
</s>