Did you already learn the identity theorem in you complex analysis course? If not, I can explain the proof if you ask. If you did learn the theorem already, this question is a direct application of it.
EDIT: Sorry, I misread your question. The theorem you are given at the beginning: "A function that is analytic in a domain $D$ is uniquely determined over $D$ by its values in a domain, or along a line segment, contained in $D$" is just a re-wording of the identity theorem. I use the wording of the theorem given on Wikipedia below because I find it to be clearer /EDIT
Specifically, using the hint given we start with,
Assume by means of contradiction, that $f(z)=w_0$ is constant on some neighborhood in $D$.
Then, by the identity theorem, which states
Given two holomorphic functions $f$ and $g$ on a domain (open and connected set), if $f=g$ on some neighborhood in $D$ (non-empty open subset), then $f=g$ on all of $D$.
and using the functions $f$ and $g \equiv w_0$ (the constant function equal to $w_0$ which is trivially holomorphic), we must conclude that $f=g=w_0$ everywhere in $D$, and that $f$ is constant everywhere in $D$. This contradicts our assumption that $f$ was to be non-constant in $D$.
Therefore it cannot be true that $f$ is constant on any neighborhood in $D$.
The statement is that if $f(z)$ is a real-valued analytic function, then it is constant.
From the Cauchy-Riemann Equations, with $f(z)=u(x,y)+iv(x,y)$ and $v(x,y)\equiv0$ we have
$$\frac{\partial u(x,y)}{\partial x}=\frac{\partial v(x,y)}{\partial y}=0$$
and
$$\frac{\partial u(x,y)}{\partial y}=-\frac{\partial v(x,y)}{\partial x}=0$$
What can one deduce about $u(x,y)$ if its first partial derivatives vanish?
Best Answer
For 1, if you regard $f$ as a smooth function on $D\subset \mathbb{R}^2$, $f'(z)=0$ implies that the gradient of $f$ is zero, so $f$ must be a constant function.
For 2, since $f=u+iv$ where $u=Re(f)$ and $v=Im(f)$ satisfies Cauchy-Riemann condition, we have $$v_y=u_x=0\mbox{ and } v_x=-u_y=0$$ since $u$ is constant. This implies that $v$ is constant, and as a result $f=u+iv$ is a constant function.
For 3, since $|f|$ is constant, $$\tag{0}|f|^2=u^2+v^2\equiv c$$where $c$ is a constant. If $c=0$, then $f\equiv 0$. So we assume that $c\neq 0$. Differentiate it with respect to $x$ and $y$, we have $$\tag{1} 2(uu_x+vv_x)=0\mbox{ and }2(uu_y+vv_y)=0$$ Again using Cauchy-Riemann condition, $(1)$ can be written as $$\tag{3} uu_x-vu_y=0\mbox{ and }uu_y+vu_x=0.$$ Eliminate $u_y$ in $(3)$, we get $ 0=(u^2+v^2)u_x=cu_x$ by $(0)$, which implies that $u_x=0$ since $c\neq 0$. Similarly, eliminate $u_x$ in $(3)$, we get $ 0=(u^2+v^2)u_y=cu_y$ which implies that $u_y=0$. This implies that $u$ is constant. Using part 2, we can conclude that $f$ is a constant function.