TITLE: Composition of an analytic function with a continuous function that is analytic
QUESTION [5 upvotes]: If $f$ is a continuous function such that $g(z)=\sin{f(z)}$ is analytic, then is $f$ analytic?
I know we can take $f(z)=\bar{z}$ then $f$ is continuous but $g$ is not analytic. Same holds if we take $f(x+iy)=x$. 
I tried letting $f(z)=u+iv$ then expanding $g(z)=\sin u\cosh v+i\cos u\sinh v$   taking the partial derivatives and using the Cauchy Riemann equations. That seems like a messy way to go.

REPLY [3 votes]: For points where $f(z) \neq \left(k+\frac{1}{2}\right)\pi$, the sine is locally biholomorphic, and
$$f(z) = \arcsin \left(\sin f(z)\right)$$
is holomorphic in a neighbourhood of $z$ as a composition of two holomorphic functions.
It remains to deal with the points where $f(z) = \left(k+\frac{1}{2}\right)\pi$ for some $k \in \mathbb{Z}$.
Use the identity theorem (on $\sin\circ f$, since we don't know yet that $f$ is holomorphic everywhere) to deduce that (on each component of its domain) either $f$ is constant (follows from the continuity of $f$ if $\sin \circ f$ is constant), or these points are isolated. In the latter case, the Riemann removable singularity theorem tells you that $f$ is holomorphic also in these points.