Rearranging Cauchy Riemann equations

I've used the Cauchy-Riemann equations to find the analytic function:

$$y^2−x^2−2y+2+i(2x(1−y))$$

But I'm having a slight rearranging problem and need to write it in terms of $z$, where $z=x+iy$.

Any suggestions would be much appreciated

-

If you know in advance that the function is analytic (which you do if you've checked that it satisfies the Cauchy–Riemann equations), you can obtain its expression in terms of $z$ simply by setting $x=z$ and $y=0$. This works because of the uniqueness theorem: two analytic functions which agree on the real axis must agree everywhere.

-

Given a function in terms of $x$ and $y$ you can introduce formally new variables $z:=x+iy$ and $\bar z:=x-iy$, i.e., $x=(z+\bar z)/2$, $y=(z-\bar z)/(2i)$. If the resulting expression in $z$ and $\bar z$ does not contain the variable $\bar z$ your function is actually an analytic function of $z$.

-

Hint:It helps noticing that $z^2=x^2-y^2+2ixy$.

-

In addition to the formula for $z^2$, note that $iz = ix - y$.

-