Let $f$ be an analytic function such that if $|z|=\frac{1}{2}$ then $f(z)\in \mathbb{R}$. Prove that $f$ is constant. Let $f: \mathbb{D} \rightarrow \mathbb{C}$ be an analytic function such that if $|z|=\frac{1}{2}$ then $f(z)\in \mathbb{R}$. Prove that $f$ is constant. ($\mathbb{D}$ is the unit disk)
Any hints are appreciated

Hint
$f(z)=u(z)+iv(z)$  (say) 
Define $g(z)=e^{i f(z)},h(z)=e^{-i f(z)}$ and apply Maximum Modulas Principle to them.
Then what can you say about $v(z)$ on the disk $\{z:|z|\le {1\over 2}\}$?
