Problem. The real part of an analytic function $f(z)$ is given by $3x^2y-y^3$. Find the imaginary part. Find the analytic function of $z$.
Attempt. I begin by applying the Cauchy-Riemann Equations. As $f(z)$ is given to be analytic, we may conclude that:
$$\frac{\partial u}{\partial x} = \frac{\partial v}{\partial y}\;\;\;\;\;\;\frac{\partial u}{\partial y} = -\frac{\partial v}{\partial x}$$
Where $u(x,y)$ and $v(x,y)$ are the real and imaginary parts of $f(z)$, respectively ($x,y\in\mathbb{R}$). Hence,
$$\frac{\partial v}{\partial y} = 6xy \;\;\;\;\;\;\; -\frac{\partial v}{\partial x} = 3x^2-3y^2$$
Integrating these, we obtain:
$$f(z) = \int 6xy\;dy = 3xy^2 + C(x)\;\;\;\;\;\; f(z) = \int -(3x^2-3y^2)\;dx = 3xy^2-x^3 + C(y)$$
Then, the imaginary part of $f(z)$ is given by the sum of the two integrals, $6xy^2 - x^3$, hence:
$$f(z) = 3x^2y-y^3 + i(6xy^2-x^3)$$.
Unfortunately, I seem to have erred somewhere. Where have I gone wrong? Is this a valid approach?
It is $v(x,y)=3xy^2+C(x)$. We know that $v_x(x,y)=3y^2-3x^2$ so $C'(x)==-3x^2$ Hence $C(x)=-x^3+A$ where A is a complex constant. Now$f(z)=u(x,y)+iv(x,y)$