Proving that if $f: \mathbb{C} \to \mathbb{C} $ is a continuous function with $f^2, f^3$ analytic, then $f$ is also analytic
Solution 1:
First rule out the case $f^2(z)\equiv 0$ or $f^3(z)\equiv 0$ as both imply $f(z)\equiv 0$ and we are done.
Write $f^2(z)=(z-z_0)^ng(z)$, $f^3(z)=(z-z_0)^mh(z)$ with $n.m\in\mathbb N_0$, $g,h$ analytic and nonzero at $z_0$. Then $$(z-z_0)^{3n}g^3(z)=f^ 6(z)=(z-z_0) ^ {2m} h^2 (z)$$ implies $3n=2m$ (and $g^3=h^2$), hence if we let $k=m-n\in\mathbb Z$ we have $n=3n-2n=2m-2n=2k$ and $m=3m-2m=3m-3n=3k$. Especially, we see that $k\ge 0$ and hence $$ f(z)=\frac{f^3(z)}{f^2(z)}=(z-z_0)^k\frac{g(z)}{h(z)}$$ is analytic at $z_0$.
Remark: We did not need that $f$ itself is continuous.
Solution 2:
If $f(z) = 0$ for all $z$, then it's analytic, and there's nothing more to show. Otherwise assume $f$ is not identically zero. At a point $z_0$ where $f(z_0) \ne 0$, $f(z) = \frac{f^3(z)}{f^2(z)}$ is analytic because the quotient of two analytic functions is analytic when the denominator is non-zero. At a point $z_0$ with $f(z_0) = 0$, the Uniqueness Theorem for analytic functions says that there is a neighborhood of $z_0$ where $f(z) = 0$ only at $z = z_0$ (otherwise you get a sequence of points converging to $z_0$ with $f$ zero on points of the sequence, etc...). In this neighborhood you get $\frac{f^3(z)}{f^2(z)} \rightarrow 0$ as $z \rightarrow z_0$, since $\left| {\frac{f^3(z)}{f^2(z)} } \right| = \frac{\left| f^3(z) \right|}{\left| f^2(z) \right|} = \frac{\left| f^2(z) \right|^{\frac{3}{2}}}{\left| f^2(z) \right|} = \left| f^2(z) \right|^{\frac{1}{2}}$, which goes to $0$ as $z \rightarrow z_0$ (because $f^2$ is analytic and hence continuous with $f^2(z_0) = 0$). So $f(z) \rightarrow 0$ as $z \rightarrow z_0$. Now we have that $f(z)$ is analytic in a punctured neighborhood of $z_0$ and continuous at $z_0$, and so is in fact analytic at $z_0$ itself as a corollary of Morera's Theorem.