The question

For the following harmonic function $\displaystyle u : R^2 \to R$, find a harmonic conjugate $\displaystyle v: R^2 \to R$ for u and express the analytic function f = u + iv : $\displaystyle C \to C$ as a function of z alone.

$\displaystyle u (x, y) = y^3 - 3yx^2 + 2xy$

My attempt:

I used Cauchy Riemann equations to find v, and ended up with:

$\displaystyle v = x^3 -3xy^2 - x^2 + C$ (where C is a constant)

So the function is $\displaystyle f(x, y) = y^3 - 3yx^2 + 2xy + i(x^3 -3xy^2 - x^2 + C)$ unless I'm mistaken.

How do I write this in terms of a function of 'z'? I recall my lecturer saying that we set y = 0, solve, then change 'x' to 'z' and this works. Is this OK? I get nervous when I apply something that 'just works' and I have no idea why. Is this a common procedure? Thanks.