Simplify $\tan^{-1} ( \frac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}} )$ with trigonometric substitution I will explain my approach, help me with the last step please!
$$ \tan^{-1} {\left(\frac {x - \sqrt {1-x^2}}{x + \sqrt {1-x^2}}\right)}$$
substituting x = $\sin \theta$ (as learnt from book) and solving 1-$\sin^2 \theta$ = $\cos^2 \theta$
$$ \tan^{-1} {\left(\frac {\sin \theta - |\cos \theta|}{\sin \theta + |\cos \theta| }\right)}$$
For solving modulus, it was important to determine range of $\theta$ , therefore  I defined it (as it is my variable,i can define it my way) for [-$\pi$/2 , $\pi$/2] so that sine covers all values from $-1$ to $1$ (as ,  $ -1 \le x \le 1 \,$ , from domain  ) and $\cos \theta$ is positive , and hence $|\cos \theta| = \cos \theta$.
$$ \tan^{-1} {\left(\frac {\sin \theta - \cos \theta}{\sin \theta + \cos \theta }\right)}$$
= dividing by $\cos \theta$ $$ \tan^{-1} {\left(\frac {\tan \theta - 1}{\tan\theta + 1 }\right)}$$
= by formula of $\tan (\theta - \pi/4)$ $$ \tan^{-1}( \tan{\left(\theta - \pi/4\right)})$$
That's where I am stuck ,as according to the identity,$\quad$ $tan^{-1} ( \tan \alpha) = \alpha$ $\quad$ only when $\, -\pi/2 <\alpha < \pi/2$ . But here $$ -3\pi/4 \le \,(\theta-\pi/4) \, \le \pi/4 $$
Therefore, I am not going to get ($ \,\theta - \pi/4 $) out of the expression. What  i get will be based on that graph of $\bf {\tan^{-1} (\tan x)}$ .
$$ (\theta - \pi/4) +\pi \,$$  for  $\,-3\pi/4 \le \, (\theta -\pi/4) \, < -\pi/2 \,\,$ and
$$\theta -\pi/4$$
for $\,-\pi/2 < \, (\theta -\pi/4) \, \le \pi/4 \,\,$
My teacher just cancelled arctan and tan and wrote $\theta - \pi/4$ and he didn't even include that modulus function over $\cos \theta$.
So what will be the exact answer because if everyone decide $\theta$ as per they like then there will not be a finite answer. Everyone will have their own answers and in each answer they have multiple cases as I just discussed above.
So please help me, very hopefully I signed up in stackexchange!
Found Solution :-
I was confused because  I was thinking that there can be many solutions differing person to person, but even if you choose any value of $\theta$ , you are going to get two solutions which are in the asked question above. The problem resolves when we write $\theta$ in terms of $sin^{-1} x$  as then we would not simply write like $$ \theta = \sin^{-1} x $$
we would write an equation,$$ \sin^{-1} x = \sin^{-1} (\sin \theta)$$,
now if $\theta$ is not in range of $-\pi/2$ and $\,\pi/2$ , then there would be some constant in $\pi$ (like , $\pi/4 , 2\pi$ etc. we would have to add or subtract according to the graph of 'sin inverse sin' and when we would put that value of $\theta$ , we would end with the solutions as answered by people.
(I write the answer in this edit  to help anyone who will reach here after searching  web , thanks to everyone for answers)
 A: The domain of the function is $x\in [-1,-\frac1{\sqrt2})\cup (-\frac1{\sqrt2},1]$. Then, with the substitution $\sin \theta =x$, we have $\theta \in[-\frac\pi2,-\frac\pi4)\cup (-\frac\pi4,\frac\pi2]$ and correspondingly
$$\tan^{-1} {\left(\frac {x - \sqrt {1-x^2}}{x + \sqrt {1-x^2}}\right)}
=\tan^{-1}\left[\tan{\left(\theta - \frac\pi4\right)}\right]$$
$$=
\begin{cases}
 \theta+\frac{3\pi}4 = \sin^{-1}x +\frac{3\pi}4  & x\in [-1,-\frac1{\sqrt2})\\ 
\theta -\frac\pi4 = \sin^{-1}x -\frac\pi4 & x\in (-\frac1{\sqrt2},1] \end{cases}
$$
A: In the case of $$-\pi/2 \lt \theta-\pi/4 \le \pi/4 $$ There is no problem, and we get $\theta -\pi/4$.
For the case $$-3\pi/4 \le \theta-\pi/4 \lt -\pi/2 $$ You need to adjust by adding $\pi$, so that $$\pi/4 \le \theta +3\pi/4 \lt \pi/2 $$ The answer should really be $$\begin{cases} \theta-\pi/4 , & -\pi/4 \lt \theta \le \pi/2 \\ \theta+3\pi/4, & -\pi/2\le \theta \lt \pi/4 \end{cases}$$  Your teacher is wrong.
A: I have another answer :
let $x \in (-1,1)\setminus\left\{-\frac{1}{\sqrt{2}}\right\}$. Then the derivative of the formula with respect to $x$ is :
\begin{align}
\frac{d}{dx}\left(\arctan\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right)\right) &= \frac{d}{dx}\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right)\times \dfrac{1}{1+\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right)^2} 
\end{align}
We compute the first term :
\begin{align}
\frac{d}{dx}\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right)&= \dfrac{\left(1 +\dfrac{x}{\sqrt{1-x^2}}\right)\left(x + \sqrt{1-x^2}\right) - \left(x - \sqrt{1-x^2}\right)\left(1-\dfrac{x}{\sqrt{1-x^2}}\right) }{\left(x+\sqrt{1-x^2}\right)^2} \\
&= \dfrac{\dfrac{\sqrt{1-x^2}+x}{\sqrt{1-x^2}}\left(x+\sqrt{1-x^2}\right)+\left(x-\sqrt{1-x^2}\right)\dfrac{x-\sqrt{1-x^2}}{\sqrt{1-x^2}}}{\left(x+\sqrt{1-x^2}\right)^2} \\
&= \dfrac{\left(x+\sqrt{1-x^2}\right)^2 + \left(x-\sqrt{1-x^2}\right)^2}{\sqrt{1-x^2}\left(x+\sqrt{1-x^2}\right)^2} \\
&= \dfrac{x^2 + 2x\sqrt{1-x^2} + 1-x^2 + x^2 -2x\sqrt{1-x^2} + 1-x^2}{\sqrt{1-x^2}\left(x+\sqrt{1-x^2}\right)^2} \\
&= \dfrac{2}{\sqrt{1-x^2}\left(x+\sqrt{1-x^2}\right)^2}
\end{align}
From there, we have :
\begin{align}
\frac{d}{dx}\left(\arctan\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right)\right) &= \dfrac{2}{\sqrt{1-x^2}\left(x+\sqrt{1-x^2}\right)^2} \times \dfrac{1}{1+\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right)^2} \\
&= \dfrac{2}{\sqrt{1-x^2}}\times \dfrac{1}{\left(x+\sqrt{1-x^2}\right)^2 + \left(x-\sqrt{1-x^2}\right)^2} \\
&= \dfrac{1}{\sqrt{1-x^2}}
\end{align}
Therefore, the solution is an antiderivative of $x\in (-1,1)\setminus\left\{-\frac{1}{\sqrt{2}}\right\}\mapsto \frac{1}{\sqrt{1-x^2}}$. It follows that there exists two constant $C$ and $C'$ such that:
\begin{align}
\forall x \in \left(-1,-\dfrac{1}{\sqrt{2}}\right) ,~ \arctan\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right) &= \arcsin x + C \\
\forall x \in \left(-\dfrac{1}{\sqrt{2}},1\right) ,~ \arctan\left(\dfrac{x-\sqrt{1-x^2}}{x+\sqrt{1-x^2}}\right) &= \arcsin x + C'
\end{align}
To get the value of $C$ and $C'$, evaluate the limits at $-1$ and $1$ :
\begin{align}
C &=\arctan 1- \arcsin( -1)\\
&= \frac{\pi}{4}+\frac{\pi}{2} \\
&= \frac{3\pi}{4} \\
C' &=\arctan 1- \arcsin 1\\
&= \frac{\pi}{4}-\frac{\pi}{2} \\
&= -\frac{\pi}{4} 
\end{align}
It seems like your teacher forgot to check what happens around $-\frac{1}{\sqrt2}$.
