Find a condition on real numbers $a$ and $b$ such that $\left(\frac{1+iz}{1-iz}\right)^n = a+ib$ has only real solutions I´m new on this. I need to find a condition that relates  two real numbers $a$ and $b$ such that 
 $$\left(\frac{1+iz}{1-iz}\right)^n = a+ib$$
has only real solutions
This is what I got till now.
$$\left(\frac{1+i(a+ib)}{1-i(a+ib)}\right)^n = a+ib$$
$$\left(\frac{(1-b)+ia}{(1+b)-ia}\right)^n = a+ib$$
$$\frac{(1-b)+ia}{(1+b)-ia}.\frac{(1+b)+ia}{(1+b)+ia} = \frac{1-b^2+2ia-a^2}{1+2b+b^2+a^2}$$
then 
$$\left(\frac{1-b^2-a^2}{1+2b+b^2+a^2}+\frac{2ia}{1+2b+b^2+a^2}\right)^n = a+ib$$
where
$$a=0  \text{; & } 1+2b+b^2\neq0$$
 A: Note that
$$
|1-iz|^2 - |1+iz|^2  = -2i(z -\bar z) = 4 \operatorname{Im}(z)
$$
so that
$$
 z \in \Bbb R \iff \left | \frac{1+iz}{1-iz}\right|= 1 \, .
$$
It follows that
$$
\left(\frac{1+iz}{1-iz}\right)^n = a+ib
$$
has only real solutions $z$ if and only if $|a+ib|=1$, i.e. if $a^2+b^2=1$.
A: that is an awesome answer given by Martin R. 
alternatively, let
$$
a+ib = \sqrt{a^2+b^2} e^{i \theta}
$$
$c$ be the real solution for satisfied $a,b$.  One would obtain 
$$
\label{eq}
\sqrt[n]{a^2+b^2} e^{ \frac{i (\theta + 2k\pi )}{n} } = \frac{1-c^2 +i 2c}{1+c^2}   \tag1
$$
note that
$$
 ( \frac{1-c^2 }{1+c^2} ) ^2 + ( \frac{2c}{1+c^2} ) ^2 = 1
$$
which means $\sqrt[n]{a^2+b^2} =1$ equivalently
$$a^2+b^2 =1 $$
And for each $e^{ \frac{i (\theta + 2k\pi )}{n} } $ there exists only one $c \in \mathbb{R}$ satisfy $\eqref{eq}$
A: Set
$$
w=\frac{1+iz}{1-iz}
$$
so you can solve for $z$, getting
$$
z=i\frac{1-w}{1+w}
$$
This is real if and only if
$$
i\frac{1-w}{1+w}=-i\frac{1-\bar{w}}{1+\bar{w}}
$$
that becomes
$$
1+\bar{w}-w-w\bar{w}=-1+\bar{w}-w+w\bar{w}
$$
that is, $w\bar{w}=1$.
Therefore $|a+bi|=1$ is a necessary condition. Now if we write $a+bi$, the equation becomes
$$
\frac{1+iz}{1-iz}=u
$$
where $u$ is any $n$-th root of $a+bi$ and $|u|=1$. By the same argument as before, the solution is real.
