# understanding holomorphic Functions

I'm a bit unsure about how to know when a function is holomorphic or not for example: $$f(z)= 2Re(z)-iz^2$$ for what values of z is f holomorphic

write $z=x+iy$, $f(z)=2x-i((x^2-y^2)+2ixy)=2x+2xy-i(x^2-y^2)$
Write $g(x,y)=2x+2xy, h(x,y)=-x^2+y^2$.
$\partial_xg=2+2y$, $\partial_yh=2y$. So Cauchy Riemann are not verified, it is not holomorphic.
The function $z \mapsto i z^2$ is holomorphic, so it is sufficient to check if $z \mapsto 2\operatorname{re} z$ is holomorphic. However, if it was holomorphic it would be an open map, which is impossible since the range is constrained to the real line, hence it is not holomorphic anywhere.