Showing that a complex-valued function is constant Let $H$ be the upper half plane and let $f : H → \mathbb C$ be
holomorphic on $H$ and continuous on $\bar{H}$. Suppose that $f$ is constant on the real line, that is, there is $c ∈ \mathbb C$ such that $f(x) = c$ for all $x ∈ \mathbb R$. 
Show that $f$ is constant.
My attempt:
I tried proving this using Liouville's theorem.
Since $f$ is continuous on $\bar{H}$, then it is continuous at each $p \in \bar{H}$, so for all $\epsilon > 0$, there exists $\delta > 0$ s.t if $|z-p|< \delta$, then $|f(z) - f(p)|< \epsilon$.
Choose $\epsilon = 1$
Now we can rewrite $|f(z)|$ as: $|f(z) - f(p) + f(p)| ≤ |f(z) - f(p)| + |f(p)| ≤ 1 + |f(p)|$
Let $M := 1 + |f(p)|$
Hence $|f(z)| ≤ M$ and hence $f$ is bounded on $\bar{H}$
But since $p \in \bar{H}$, it can also lie on the real line, so $f(p) = c$ for some $c \in \mathbb C$ and thus $|f(p)| = |c|$ and hence $f$ is bounded on $H$.
Therefore, by Liouville's theorem, if a function is holomorphic and bounded, it must be constant. 
Hence $f$ is constant.
Is my attempt correct? Any other answers? 

You can't apply Liouville, since your function is not entire. Instead, you can use the Schwarz reflection principle.
WLOG, let $f=0$ on $\mathbb{R}.$ Let $\Omega ^+$ be the upper half plane, $\Omega ^-$ be the lower half plane, and $L=\mathbb{R}.$ Let $\Omega=\Omega ^+\cup L\cup \Omega ^-,$ which is open and connected.
By assumption, $f$ is holomorphic on $\Omega ^{+}$, continuous on $\Omega ^{+}\cup L,$ and real-valued on $L$. By the Schwarz reflection principle, the function $g:\Omega\rightarrow\mathbb{C}$ given by 
$$g(z)=\begin{cases} f(z)\textrm{ if } z\in\Omega ^{+}\cup L\\
\overline{f(\bar{z})}\textrm{ if }z\in\Omega ^-\end{cases}$$ is holomorphic. However, $g=f=0$ on $L$, and since $L$ contains a limit point, the uniqueness of analytic continuation guarantees that $g=0$ on $\Omega,$ and hence $f=0$ on $\Omega^+\cup L.$ That is, $f=0$ on $\mathcal{H}\cup \mathbb{R}=\overline{\mathcal{H}}.$ 
Since $f$ is continuous on $\overline{\cal{H}}$, we could have just assumed, for example, that $f=0$ on, say, $[0,1]$.
