Let $f$ be holomorphic on $\{z\in \mathbb{C}\mid |z|\leq 3\}$ and real on the boundary of the square $\{z\in\mathbb{C}\mid Re(z)\leq1 \text{ and } Im(z)\leq 1 \}$. Prove $f$ is constant.
How to prove? Thanks.
In general, is it true that:
$f$ holomorphic in $D(0,1)$, $f$ is real on a piece-wise smooth closed curve $\gamma$, then $f$ must be constant?
The assumption implies that $\operatorname{Im}(f)$ is zero on the bounding curve, and therefore vanishes on the interior by the maximum modulus principle. From this it follows that $f$ is constant.
At worst you have a technical hiccup with your particular curve being only piecewise smooth.