I need to find the value of $tan^{-1}\left[\frac{\sqrt{1\space+\space x^2}\space+\space\sqrt{1\space-\space x^2}}{\sqrt{1\space+\space x^2}\space-\space\sqrt{1\space-\space x^2}}\right]$, where $|x| \space \lt \frac 12$.
I had tried it and reached the following solution:-
$ Since \space x^2 \in [0, \frac 14), sin^{-1}x^2 can\space be \space defined. $
Let $sin^{-1}x^2\space=\space\theta\implies x^2 = sin\theta$
Replacing $x^2$ with $sin\theta,$ the expression becomes:-
$$tan^{-1}\left[\frac{\sqrt{1\space+\space sin\theta} \space+\space\sqrt{1\space-\space sin\theta}}{\sqrt{1\space+\space sin\theta} \space-\space \sqrt{1\space-\space sin\theta}}\right]$$
Using the formulas:-
$i)\space|\space2sin\frac \theta2\space| = |\space\sqrt{1\space+\space sin\theta} \space+\space\sqrt{1\space-\space sin\theta}\space| $
$ii)\space|\space2cos\frac \theta2\space| = |\space\sqrt{1\space+\space sin\theta} \space-\space\sqrt{1\space-\space sin\theta}\space| $
The expression therefore simplifies to
$$tan^{-1}[tan\frac \theta2]$$.
Since $\frac \theta2 \in [0, \frac{sin^{-1}\frac14}{2})$, therefore expression becomes
$\frac\theta2 = \frac {sin^{-1}x^2}2 = \frac π4 - \frac 12 cos^{-1}x^2$.
However, the answer is $\frac π4 + \frac 12 cos^{-1}x^2$.
I don't know where I am wrong. Please help.