Express $w=f(z)=\frac{1}{(1-z)^2}$ in the form $w=u(x,y)+iv(x,y)$ I start by writing $f(z)$ as $$\frac{1}{(1-(x+iy))^2}$$
and then I expand the bottom to get $$\frac{1}{(1-2x+x^2-y^2) + i(2y-2xy)}$$
The answer says $$w=\frac{(1+x^2-2x-y^2)-(i(2xy-2y)}{(1+x^2-2x-y^2)^2+(2xy-2y)^2}$$
How do I get to this stage?
 A: You can simplify this process a bit:
$$\begin{align}
\frac1{(1-z)^2} & =\left(\frac1{1-z}\right)^2=\left(\frac{1-\overline z}{(1-z)(1-\overline z)}\right)^2\\
& = \left({1-\overline z\over 1-z-\overline z+|z|^2}\right)^2\\
& = \left({1-x+iy\over 1-2x+x^2+y^2}\right)^2,\quad\text{since }z+\overline z=2x\\
& = {1-2x+x^2-y^2+2iy(1-x)\over(1-2x+x^2+y^2)^2}\\
& ={1-2x+x^2-y^2\over(1-2x+x^2+y^2)^2}+{2y(1-x)\over(1-2x+x^2+y^2)^2}i.
\end{align}$$
A: $$
\begin{align*}
\frac{1}{(1 - (x + iy))^2}
&= \frac{1}{1-2(x+iy)+(x+iy)^2}
= \frac{1}{1+x^2-y^2-2x + i(2xy - 2y)} \\
&= \frac{1 +x^2-y^2-2x-i(2xy - 2y)}{\left[ (1+x^2-y^2-2x)+i(2xy-2y) \right]\left[ (1+x^2-y^2-2x)-i(2xy-2y) \right]} \\
&= \frac{(1+x^2-y^2-2x) - i(2xy - 2y)}{(1+x^2-y^2-2x)^2 + (2xy-2y)^2}
\end{align*}
$$
A: Here is another way: $u(z) = \operatorname{re} f(z) = {1 \over 2} (f(z)+ \overline{f(z)})$, $v(z) = \operatorname{im} f(z) = {1 \over 2i} (f(z)- \overline{f(z)})$.
In this case, we have (also using $w \bar{w} = |w|^2$.)
\begin{eqnarray}
u(z) &=& {1 \over 2} ({1 \over (1-z)^2}+{1 \over (1-\bar{z})^2}) \\
&=& {1 \over 2} {(1-\bar{z})^2 + (1-z)^2 \over |1-z|^4 }\\
&=& {1 \over 2} {2 - 2 (z + \bar{z}) + z^2 + \bar{z}^2 \over |1-z|^4 } \\
&=& {1 \over 2} {2 - 2 \cdot 2 \operatorname{re}(z) + 2 \operatorname{re}(z^2)  \over |1-z|^4 } \\
&=& { 1 - 2x +x^2-y^2\over ((1-x)^2+y^2)^2}
\end{eqnarray}
Similarly:
\begin{eqnarray}
v(z) &=& {1 \over 2i} ({1 \over (1-z)^2}-{1 \over (1-\bar{z})^2}) \\
&=& {1 \over 2i} {(1-\bar{z})^2 - (1-z)^2 \over |1-z|^4 }\\
&=& {1 \over 2i} {2 (z - \bar{z}) + \bar{z}^2 - z^2  \over |1-z|^4 } \\
&=& {1 \over 2i} {2 \cdot 2i \operatorname{im}(z) - 2 i \operatorname{im}(z^2)  \over |1-z|^4 } \\
&=& { 2y - 2xy\over ((1-x)^2+y^2)^2}
\end{eqnarray}
