What is the best way to find an actual divisor of an affine curve? I.E. if I am interested in finding a canonical divisor of a curve in two variables, is there a general way to go about it? Do I need to consider a projection on the x-axis? 


I should clarify. I'm assuming the field is characteristic 0, and the curve is affine of the form f(x,y)=0. I computed the closure in P2, it was smooth, and am now trying to compute a canonical divisor on this curve. Thanks for the comments am reading up on it now.



Finding divisors on a curve
As others have pointed out, there are several different ways to explicitly write down a divisor. So it would be helpful to know what kind of answer you're looking for.


Anyhow, here's one answer. For a curve, the canonical divisor is the same as the sheaf of differential 1-forms. Let's assume that your curve $C$ in the affine plane is cut out by the equation $f(x,y)=0$. Theorem II 8.17 in Hartshorne's Algebraic Geometry book yields an exact sequence for computing $\Omega^1\_{C/k}$. Namely, we have an exact sequence:


$
I/I^2 \to \Omega^1\_{\mathbb A^2\_k}\otimes \mathcal O\_C\to \Omega^1\_{C/k}\to 0
$


where $I$ is the defining ideal of the curve $C$. Since $I$ is generated by $f$, and since $\Omega^1\_{\mathbb A^2\_k}\otimes \mathcal O\_C$ is the free $\mathcal O\_C$ module with generators $dx, dy$, it follows that $\Omega^1\_{C/k}$ is generated by $dx$ and $dy$ modulo the relation $df$. This provides an explicit presentation for the canonical divisor as a module. When $C$ is smooth, this will be a locally free rank 1 $\mathcal O\_C$-module.


