Harmonic function as real part of any analytic function I denote with $\phi(x,y)$ a hamornic function. I would like to show that $\phi$ is the real part of any analytic function $f(z)$ of the form $$f(z)=2\phi\left(\frac{z+1}{2},\frac{z-1}{2i}\right)-\phi(1,0)+ic$$ where c is a real constant and provided that the RHS exists.
My idea was to consider $$g(z,\bar{z})=\phi\left(\frac{1}{2}(z+\bar{z}),\frac{1}{2i}(z-\bar{z})\right)+i\psi\left(\frac{1}{2}(z+\bar{z}),\frac{1}{2i}(z-\bar{z})\right)$$
and set this equal to $f(z)=g(z,\bar{z})$ with $\bar{z}=1$, but is this helpful?
Remark: In the end I would like to find an analytic function whose real part is $\tan^{-1}y/x$, my lecture notes states that the obvious function is $-i\log z$ but I do not see why this is so obvious.
 A: Unless I'm missing something, your question makes little sense to me:


*

*$\phi\left(\frac{z+1}{2},\frac{z-1}{2i}\right)$ is not defined since $\phi(x,y)$ only exists for $x$ and $y$ real

*Your candidate function $f$ has constant imaginary part, which is impossible for a non constant holomorphic function.


It's a classical fact or exercise that a harmonic function is (at least locally) the real part of a holomorphic function, and that this holomorphic function is unique up to a (purely imaginary) additive  contant (and this function looks nothing like what you wrote). You should try to do this exercise (use the Cauchy-Riemann equations), it would be instructive.
As for your example, I can explain it to you: recall the principal value logarithm is $\log z = \ln |z| + i \operatorname{Arg}(z)$ (for $z \notin \mathbb{R}_-$), where $\operatorname{Arg}(z)$ is the principal value argument of $z$, i.e. in $(-\pi, \pi]$. In your problem, I'm assuming you are working in the half-plane $H = \{z\in \mathbb{C}, ~\operatorname{Re}(z)>0\}$. For $z \in H$, it's not hard to check that $\operatorname{Arg}(z) = \tan^{-1}(y/x)$, where $z = x+iy$. It follows that $\operatorname{Re}(-i\log(z)) = \operatorname{Arg}(z) = \tan^{-1}(y/x)$.
A: Your first phrase should read "... is the real part of some analytic function...".
As Seub said, your first formula does not makes sense. Your second formula makes sense, but the RHS depends only of $z$ ($\bar{z}$ is the conjugate of $z$!), so $\bar{z}=1$ is absurd.
The usual solution is take $g=\phi_x-i\phi_y$ (the presumptive derivative of $f=\phi+i\psi$), check analiticity with Cauchy-Riemann and integrate (calculate a primitive). Warning: the topology of the domain is important, as your example proves.
A: Hello I am very late but I 'd like to say something :)
Let $D\subset$ be a domain in the complex plan and $h$ be harmonic in $D$ then there is $f\in O(D)$ ( holomorphic functions) so that $h=\log|f|.$
\begin{proof}:
For $m>0$ let $(D_m)_m$ be a sequence of open disc so that $D_m\cap D_{m+1}\not=\varnothing$, $\bar D_m\subset D$ and $\cup_m D_m=D.$\
For each $m>0$ we construct (by induction) a holomorphic function $f_m$ defined on $ D_1\cup\cdots\cup D_m$ so that $\Re(f_m)=h.$\
For $m=1$, as $h$ is harmonic, there is $f_1\in O(D_1)$ so that $h=\Re(f_1)$ in  $D_1.$
For $m=2$ there is $g\in O(D_2)$ so that $h=\Re(g)$ in $D_2.$ Since $f_1$ and $g$ are holomorphic and $\Re(g)=\Re(f)$ on $D_1\cap D_2$ we infer that there is $c_1\in R$ so that $f_1=g+ic_1$ on $D_1\cap D_2.$ Set $f_2=f_1$ in $ D_1$ and $f_2=g+ic_1$ in $ D_2$ it follows that $f_2\in O( D_1\cup D_2).$ By the same way we construct $f_m,$ $m=3,4,\cdots$\
For $m>0$ set $F_m=e^{f_m}$. The squence $(F_m)_m$ has a subsequence that converges locally uniformly in $D.$ Indeed let $K\subset D$ be a compact ball. Observe that $|F_m|=e^h$ in $D_m$ for all $m>0$ we infer that $F_m$ is uniformly bounded on $K.$ By Montel's theorem $(F_m)_m$ has a subsequence $(F_{m_k})_k$ that converges on $K$. In fact $(F_{m_k})_k$ converges locally uniformly in $D.$ \ \
To prove that $(F_{m_k})_k$ is convergent, it is enough to show that :\
1) it does not contain divergent subsequences\
2) all its convergent subsequences converge to the same limit.  \ \
First assume that there are a compact set $K'$ and a subsequence $(F_{m_{k'}})$ of $(F_{m_{k}})$ which does not converge on $K'$. Let $U$ be a relatively compact domain  in $D$ containing $K'$ and $K$. By Montel theorem's theorem $(F_{m_{k}})$  has a subsequence which converges uniformly in $U$  to a holomorphic function $g$.  So there is $\epsilon>0$ so that :
(1) $\sup_{K'}|F_{m_{k'}}-g|>\epsilon$  for all $k'$ big enough.\
This is impossible since the sequence $(F_{m_{k'}})$ is uniformly bounded on $U$ and by Montel's theorem its has a subsequence which converges uniformly in $U$ to a function $g'$. As $g'=g$ on $K$ then they coincide in $U.$ Equality (1) can not hold in other words such a subsequence $(F_{m_{k'}})$ does not exist.
Second let $(F_{m_{k'}})$ be a subsequence of $(F_{m_{k}})$ which converges locally uniformly in $D$ to $g'$ and $(F_{m_{k''}})$ be a subsequence of $(F_{m_{k}})$ which converges locally uniformly in $D$ to $g''.$ As $g'$ and $g''$ are holomorphic in $D$ and coincide in $K$ then $g'\equiv g''$ in $D.$
For $z\in D$ set $f(z)=\lim_{k\rightarrow\infty} F_{m_k}(z)$ as the convergence is locally uniform we infer that $f$ is holomorphe and $|F_{m_k}|$ converges to $|f|$ as $k$ tends to infinite. Since $|F_{m_k}(z)|=e^{h(z)}$ for all $k$ we get $|f(z)|=e^{h(z)}$.
\end{proof}
