TITLE: Prove that $\tan^{-1}\frac{\sqrt{1+x^2}+\sqrt{1-x^2}}{\sqrt{1+x^2}-\sqrt{1-x^2}}=\frac{\pi}{4}+\frac 12 \cos^{-1}x^2$
QUESTION [12 upvotes]: Let the above expression be equal to $\phi$
$$\frac{\tan \phi +1}{\tan \phi-1}=\sqrt{\frac{1+x^2}{1-x^2}}$$
$$\frac{1+\tan^2\phi +2\tan \phi}{1+\tan^2 \phi-2\tan \phi}=\frac{1+x^2}{1-x^2}$$
$$\frac{1+\tan^2\phi}{2\tan \phi }=\frac{1}{x^2}$$
$$\sin 2\phi=x^2$$
$$\phi=\frac{\pi}{4}-\frac 12 \cos^{-1}x^2$$
Where am I going wrong?

REPLY [3 votes]: A bit late answer but I thought worth mentioning it.
First note that we can substitute $y=x^2$ and consider $0<y\leq 1$. Furthermore, the argument of $\arctan$ can be simplified as follows:
$$\frac{\sqrt{1+y}+\sqrt{1-y}}{\sqrt{1+y}-\sqrt{1-y}}=\frac{1+\sqrt{1-y^2}}{y}$$
Now, setting $y = \cos t$ for $t \in \left[0,\frac{\pi}2\right)$, to show is only
$$\arctan \frac{1+\sin t}{\cos t} = \frac{\pi}{4}+\frac t2$$
At this point half-angle formulas come into mind:
$$\frac{1+\sin t}{\cos t} = \frac{(\cos \frac t2 + \sin \frac t2)^2}{\cos^2 \frac t2 - \sin^2 \frac t2} = \frac{\cos \frac t2 + \sin \frac t2}{\cos \frac t2 - \sin \frac t2}$$ $$ = \frac{1+\tan \frac t2}{1-\tan \frac t2} = \tan\left(\frac{\pi}{4}+\frac t2\right)$$.
Done.