[proofplan]
The strategy is to construct the degree-$2$ map directly from the canonical linear system. A canonical divisor $K_C$ on a genus-$2$ curve has degree $2g - 2 = 2$ and Riemann–Roch space of dimension $\ell(K_C) = g = 2$, hence yields a basis $\{f_0, f_1\}$ of $\mathcal{L}(K_C)$. The associated linear-system map $\phi_{K_C}: C \to \mathbb{P}^1_k$ is a nonconstant morphism whose degree is bounded above by $\deg K_C = 2$. Verifying nonconstancy (so the degree is at least $1$) and ruling out degree $1$ (so the degree is exactly $2$, since otherwise $C$ would be rational, contradicting $g(C) = 2$) completes the construction.
[/proofplan]
[step:Compute $\deg K_C$ and $\ell(K_C)$ from Riemann–Roch]
Let $K_C$ denote a canonical divisor on $C$ — that is, the divisor of any nonzero rational differential form on $C$. By [Degree of the Canonical Divisor](/theorems/2186) applied to the smooth projective curve $C$ of genus $g = 2$:
\begin{align*}
\deg K_C = 2g - 2 = 2.
\end{align*}
For the dimension $\ell(K_C) := \dim_k \mathcal{L}(K_C)$ we apply [Riemann–Roch for Large Degree Divisors](/theorems/2188) — the divisor $K_C$ has degree $2g - 2 = 2$, which is *not* strictly $\geq 2g - 1 = 3$, so we cannot use the large-degree form directly. Instead we apply Riemann–Roch in its full form: $\ell(K_C) - \ell(K_C - K_C) = \deg K_C - g + 1 = 2 - 2 + 1 = 1$, with the second term equal to $\ell(0) = 1$ since $\mathcal{L}(0) = k$ consists of the constants. Therefore
\begin{align*}
\ell(K_C) = 1 + \ell(0) = 1 + 1 = 2.
\end{align*}
[/step]
[step:Choose a basis for $\mathcal{L}(K_C)$ and form the linear-system map]
Since $\ell(K_C) = 2$, fix a $k$-basis $\{f_0, f_1\}$ for the Riemann–Roch space $\mathcal{L}(K_C) \subset K(C)$. Both $f_0$ and $f_1$ are nonzero rational functions on $C$ satisfying $\operatorname{div}(f_i) + K_C \geq 0$, i.e. $\operatorname{div}(f_i) \geq -K_C$.
Define the rational map
\begin{align*}
\phi_{K_C}: C &\dashrightarrow \mathbb{P}^1_k \\
p &\longmapsto [f_0(p) : f_1(p)].
\end{align*}
This rational map is well-defined as a map of projective space wherever $(f_0(p), f_1(p)) \neq (0, 0)$. By [Rational Maps from Smooth Curves Are Morphisms](/theorems/2172), since $C$ is a smooth curve, every rational map from $C$ to a projective space extends uniquely to a morphism on all of $C$. Hence $\phi_{K_C}: C \to \mathbb{P}^1_k$ is in fact a morphism.
[/step]
[step:Verify that $\phi_{K_C}$ is nonconstant]
Suppose for contradiction that $\phi_{K_C}$ is constant. Then the ratio $f_1/f_0 \in K(C)$ takes a single value $c \in k \cup \{\infty\}$ at every point. If $c \in k$, then $f_1 - c f_0 \in \mathcal{L}(K_C)$ vanishes identically on $C$, hence $f_1 = c f_0$ in $K(C)$, contradicting linear independence of $\{f_0, f_1\}$ over $k$. If $c = \infty$, then $f_0 / f_1$ vanishes identically, so $f_0 = 0$ — contradicting that $f_0 \neq 0$. Therefore $\phi_{K_C}$ is nonconstant.
[/step]
[step:Bound $\deg \phi_{K_C} \leq \deg K_C = 2$]
For any nonconstant morphism $\phi: C \to \mathbb{P}^1_k$ defined by a basis of a Riemann–Roch space $\mathcal{L}(D)$ of an effective divisor — or, more generally, of any divisor — the degree of $\phi$ as a morphism of curves is at most $\deg D$ when $D$ is effective. In our setting we apply this to $D = K_C$.
Concretely, the fibre $\phi_{K_C}^{-1}([1 : 0]) \subset C$ consists of the closed points $p \in C$ where $f_1(p)/f_0(p) = 0$ (counting multiplicities), i.e. the support of the divisor of zeros of $f_1/f_0$. Since $f_1, f_0 \in \mathcal{L}(K_C)$, we have $\operatorname{div}(f_1) \geq -K_C$ and $\operatorname{div}(f_0) \geq -K_C$. The function $g := f_1/f_0 \in K(C)^\times$ has divisor of zeros $(g)_0$ satisfying
\begin{align*}
(g)_0 \leq \operatorname{div}(f_1) + K_C,
\end{align*}
which is effective and of degree at most $\deg K_C + \deg \operatorname{div}(f_1)$. Now $\deg \operatorname{div}(f_1) = 0$ by [Principal Divisors Have Degree Zero](/theorems/2177), so $\deg (g)_0 \leq \deg K_C = 2$. The cardinality of the fibre (counted with multiplicities) over $[1 : 0]$ equals $\deg (g)_0$, and equals $\deg \phi_{K_C}$ by the standard fibre-degree relation for nonconstant morphisms of smooth projective curves to $\mathbb{P}^1_k$. Hence
\begin{align*}
\deg \phi_{K_C} \leq 2.
\end{align*}
[/step]
[step:Rule out $\deg \phi_{K_C} = 1$ to conclude $\deg \phi_{K_C} = 2$]
Since $\phi_{K_C}$ is nonconstant (Step 3), $\deg \phi_{K_C} \geq 1$. Combined with the bound from Step 4, $\deg \phi_{K_C} \in \{1, 2\}$.
If $\deg \phi_{K_C} = 1$, then $\phi_{K_C}: C \to \mathbb{P}^1_k$ is a degree-$1$ morphism between smooth projective curves over an algebraically closed field, hence an isomorphism (every degree-$1$ morphism of smooth projective curves induces a degree-$1$ extension of function fields, $K(C)/K(\mathbb{P}^1_k) = K(\mathbb{P}^1_k)/K(\mathbb{P}^1_k)$, which forces equality of function fields and hence — by the equivalence of categories between smooth projective curves and finitely generated function fields of transcendence degree $1$ — an isomorphism of curves). This would imply $C \cong \mathbb{P}^1_k$, hence $g(C) = g(\mathbb{P}^1_k) = 0$, contradicting the hypothesis $g(C) = 2$.
Therefore $\deg \phi_{K_C} = 2$. The morphism $\phi_{K_C}: C \to \mathbb{P}^1_k$ has degree exactly $2$, witnessing that $C$ is hyperelliptic.
[guided]
The proof has a clear arc: Riemann–Roch supplies a $2$-dimensional space of rational functions on $C$ with poles bounded by the canonical divisor $K_C$ of degree $2$; this space gives a morphism $\phi_{K_C}: C \to \mathbb{P}^1_k$; a degree count completes the argument.
**Why $\ell(K_C) = 2$.** Riemann–Roch for $D = K_C$ reads $\ell(K_C) - \ell(K_C - K_C) = \deg K_C - g + 1$. The substitution $K_C - K_C = 0$ gives $\ell(0) = 1$ (since $\mathcal{L}(0) = $ constants $= k$). With $\deg K_C = 2g - 2 = 2$ and $g = 2$, we obtain $\ell(K_C) - 1 = 2 - 2 + 1 = 1$, hence $\ell(K_C) = 2$. Note: $\ell(K_C) = g$ for any smooth projective curve of genus $g$ — this is a standard consequence of Serre duality, which is what the present Riemann–Roch computation reproduces in dimension $1$.
**Why $\phi_{K_C}$ is a morphism, not just a rational map.** A priori, $[f_0 : f_1]$ is undefined at points where both $f_0$ and $f_1$ vanish — base points of the linear system. On a smooth curve, however, every rational map to projective space extends uniquely to a morphism: this is [Rational Maps from Smooth Curves Are Morphisms](/theorems/2172). Concretely, at a putative base point $p$, one factors out the largest power of a uniformiser at $p$ from $(f_0, f_1)$ to obtain coordinates not both vanishing, so the map is defined.
**Why the degree is at most $\deg K_C = 2$.** The degree of $\phi_{K_C}$ is the number of preimages of a generic point of $\mathbb{P}^1_k$, counted with multiplicity. A preimage of $[1 : 0] \in \mathbb{P}^1_k$ is a point $p$ where $f_1/f_0 = 0$, i.e. a zero of the rational function $g = f_1/f_0 \in K(C)^\times$. The divisor of zeros $(g)_0$ has degree at most $\deg K_C = 2$ because the principal divisor $\operatorname{div}(g) = \operatorname{div}(f_1) - \operatorname{div}(f_0)$ has degree $0$, and the polar part $(g)_\infty$ — the divisor of poles — is bounded below by $-K_C - \operatorname{div}(f_0)$ in absolute value... but in fact a cleaner way is to note: for any basis $\{f_0, f_1\}$ of $\mathcal{L}(D)$ giving a base-point-free morphism $\phi: C \to \mathbb{P}^1_k$, the pullback $\phi^*[1:0]$ equals $\operatorname{div}_0(f_1/f_0)$, and this pullback divisor has degree $\deg \phi$. Bounding $\operatorname{div}_0(f_1/f_0) \leq \operatorname{div}(f_1) + K_C$ — an effective divisor of degree $\leq \deg K_C$ — gives $\deg \phi_{K_C} \leq \deg K_C = 2$.
**Why the degree is at least $2$.** If $\deg \phi_{K_C} = 1$, then $\phi_{K_C}: C \to \mathbb{P}^1_k$ would be an isomorphism between smooth projective curves (degree $1$ between smooth projective curves forces birationality, and birational smooth projective curves are isomorphic). But $\mathbb{P}^1_k$ has genus $0$ while $C$ has genus $2$ by hypothesis — a contradiction. Hence $\deg \phi_{K_C} \geq 2$, and combined with the upper bound this gives $\deg \phi_{K_C} = 2$ exactly.
**The deeper picture.** Every genus-$g$ curve $C$ has a canonical map $\phi_{K_C}: C \to \mathbb{P}^{g-1}_k$. For $g = 0$, the canonical divisor has negative degree, so the canonical map does not exist. For $g = 1$, the canonical divisor is trivial ($\deg K_C = 0$, $\ell(K_C) = 1$), so the canonical map collapses to a point. For $g = 2$, the canonical map lands in $\mathbb{P}^1_k$ and is necessarily a degree-$2$ cover — every genus-$2$ curve is hyperelliptic. For $g \geq 3$, the canonical map lands in $\mathbb{P}^{g-1}_k$ and is *generically an embedding* — failing to be an embedding precisely when the curve is hyperelliptic. This dichotomy is the content of the [Canonical Embedding Theorem](/theorems/2197). The present theorem establishes the basic phenomenon at $g = 2$: every genus-$2$ curve admits a $2$-to-$1$ cover of $\mathbb{P}^1_k$.
[/guided]
[/step]