# Canonical Divisors versus Principal Divisors

Perhaps this is so obvious a question that no one has asked it before, but can someone provide a simple example of a canonical divisor which is not a principal divisor or conversely on a Riemann Surface?

I know that if $$g(X)=1$$ then $$\operatorname{KDiv}(X)=\operatorname{PDiv}(X)$$, but I imagine that this does not always hold. Here is my presumably false proof that $$"\operatorname{KDiv}(X)=\operatorname{PDiv}(X)"$$ in general:

If $$\omega$$ is a meromorphic $$1-$$form on $$X$$, then $$\operatorname{div}(\omega)=\sum_{p\in X} \operatorname{ord}_p(\omega)\cdot p$$, and for $$f\in \mathcal{M}(X)$$, we have $$\operatorname{div}(f)=\sum_{p\in X} \operatorname{ord}_p(f)\cdot p$$. However, $$\operatorname{ord}_p(\omega)=\operatorname{ord}_0(g_p(z) dz)$$ where $$z$$ is a local parameter near $$p$$, centered at $$p$$. I believe one should be able to glue together the $$g_p$$ to form a global meromorphic function $$g\in \mathcal{M}(X)$$ with $$\operatorname{div}(g)=\operatorname{div}(\omega)$$. In this case, we would get that $$\operatorname{KDiv}(X)=\operatorname{PDiv}(X)$$.

I think my mistake is that the gluing procedure produces something undesirable because of the method by which differential forms transform under a change of variables.

A very simple example is to take $$X$$ to be the Riemann sphere $$\Bbb C_\infty$$. A differential is $$\omega=dz$$ which has a double pole at $$\infty$$. So its divisor is $$-2(\infty)$$ which is not principal, since its degree is nonzero.
In general, a canonical divisor has degree $$2g-2$$ where $$g$$ is the genus, so it can only be principal if $$g=1$$, that is on an elliptic curve.