<s>[INST] Separate f(z) into real and imaginary parts I'm doing some practice problems about complex numbers.  I want to break $f(z)=(1-z)/(1+z)$ into real and imaginary parts $u(x,y)$ and $v(x,y)$ such that $f(z)=u+iv$.  I did a different problem like this correctly, so I think it's more the algebra than the complex number aspect that's hard for me here.  I know the answer is 
$$u=\frac{1-x^2-y^2}{(1+x)+y^2}, v=\frac{-2y}{(1+x)^2+y^2}$$
$z=x+iy$, so $$f(z)=\frac{1-(x+iy)}{1+(x+iy)}=\frac{1-x-iy}{1+x+iy}$$
I get that it needs to be split into two fractions so that the $i$ can be pulled out.  I just have no idea how to make that work.  Or the rest of the algebra for that matter.
 [/INST] You just need to realise the denominator: 
$$f(z) = \frac{(1-x) - iy}{(1+x) + iy} \times \frac{(1+x) - iy}{(1+x)-iy}$$ $$= \frac{(1-x)(1+x) -y^2}{(1+x)^2+y^2} + \frac{i(-y(1-x) - y(1+x))}{(1+x)^2 + y^2}$$ $$= \frac{1-x^2 - y^2}{(1+x)^2 + y^2} + i \frac{-y + yx - y - yx}{(1+x)^2 + y^2}  $$ and so it is clear that $u = \frac{1-x^2-y^2}{(1+x)^2 + y^2}$ and $v = \frac{-2y}{(1+x)^2 + y^2}$ as required. 
</s>