Going from $f = u(x,y) +iv(x,y)$ to $f(z) = f(x+iy)$

Firstly I always check if it satisfies Cauchy-Riemann equations or not. If it satisfies you can write $f(x,y) = u(x,y)+iv(x,y)$ into the form $f(z)$. If it does not satisfy Cauchy-Riemann equations, you cannot write the $f(x,y) = u(x,y)+iv(x,y)$ into the form $f(z)$.

I would like to show my strategy in some examples


Example 1: ( you cannot convert the $f(x,y)$ into $f(z)$ in this example because it does not satisfy Cauchy-Riemann equations. Thus you do not need to struggle for converting into $f(z)$ because you cannot in any way)

$$f(x,y)=x^2+y^2+i2xy$$ $$u(x,y)=x^2+y^2$$ $$v(x,y)=2xy$$

Cauchy-Riemann equations:

$$\frac{\partial{u}}{\partial{x}}=\frac{\partial{v}}{\partial{y}}$$

$$\frac{\partial{u}}{\partial{y}}=-\frac{\partial{v}}{\partial{x}}$$

$$2x=2x$$ $$2y \neq -2y$$ Thus you cannot do transform for example 1.


Example 2: (The example you can convert the $f(x,y)$ as $f(z)$)

$$f(x,y)=\frac{x}{x^2+y^2}-\frac{iy}{x^2+y^2}$$ $$u(x,y)=\frac{x}{x^2+y^2}$$ $$v(x,y)=-\frac{y}{x^2+y^2}$$

If you check, It satisfies Cauchy-Riemann equations thus you can convert into form of $f(z)$ Thus use the known relation for $z$ for convertion .

We know $z=x+iy$ so $x=z-iy$

Put it into the equation and you will see that $y$ will disappear after operations because it satisfies Cauchy-Riemann equations

$$f(z)=\frac{z-iy}{(z-iy)^2+y^2}-\frac{iy}{(z-iy)^2+y^2}$$ $$f(z)=\frac{z-iy}{z^2-2izy}-\frac{iy}{z^2-2izy}$$ $$f(z)=\frac{z-2iy}{z^2-2izy}=\frac{z-2iy}{z(z-2iy)}=\frac{1}{z}$$


Substitute $$ x=\frac{z+\bar z}{2},\quad y=\frac{z-\bar z}{2\,i}. $$ All $\bar z$ should desappear, leaving you with an expression deppending only on $z$.