TITLE: Holomorphicity of the square of a function
QUESTION [7 upvotes]: I am trying to figure out whether the following statement is true.

If $f$ is such that $f^2$ is holomorphic on an open set $\Omega \subset \mathbb{C}$ then $f$ itself is holomorphic on $\Omega$. 

My feeling would be that since the function mapping $z$ to $\sqrt{z}$ is multivalued that this should not be the case, but I am struggling to come up with a counterexample.

REPLY [19 votes]: Pick any discontinuous $f : \Bbb C \to \{-1;1\}$.
$f^2$ is constant, hence holomorphic, but $f$ clearly isn't.