Decomposition of an analytic function Let $O$ be a simply connected region of $\mathbb{C}$ that is symmetric with respect to $\mathbb{R}.$ (a) Show that if $f(z)$ is analytic in $O$ then there exist functions $g(z), h(z)$ also analytic in $O$ and such that: (i) $f(z)=g(z)+i h(z);$ (ii) both $g(z), h(z)$ are real on $O \cap \mathbb{R}.$ (b) Is this decomposition of $f(z)$ is unique ? Justify your answers.
The 'symmetric' wording suggests this might be an application of Schwarz Symmetriy principle. Even if it is, I don't know how to apply it to solve this. Any suggestions or hints are much appreciated. 
 A: For the first part, define (as suggested in the comments)
the function $g(z) = \frac12(f(z)+\overline{f(\bar z)})$. Then verify that


*

*$g$ is analytic in $O$,

*$g$ is real-valued on $O \cap \mathbb{R}$,

*$h$ defined on $O$ by $h(z) = \frac 1i (f(z) - g(z))$
is also real-valued on $O \cap \mathbb{R}$.


For the second part, assume that
$$
 f(z)=g_1(z)+i h_1(z) = g_2(z)+i h_2(z)
$$
where $g_1, g_2, h_1, h_2$ are analytic in $O$ and real-valued on $O \cap \mathbb{R}$. Then
$$
 g_1(z) - g_2(z) = i (h_2(z) - h_1(z)) \, .
$$
For $z \in O \cap \mathbb{R}$, the left-hand side is purely real,
and the right-hand side is purely imaginary. That is only possible
if both left-hand side and right-hand side are zero.
Finally use the identity principle to conclude that $g_1 = g_2$
and $h_1 = h_2$ in $O$.
Note that the hypothesis "$O$ is a connected domain and symmetric
with respect to the real axis" implies that $O \cap \mathbb{R}$
is not empty and in fact contains an interval, so that the identity
principle can be applied. The simple connectivity is not needed
for the proof.
