Canonical divisor of the projective line I want to calculate a cannonical divisor of $\mathbb{P}^1_k$. 
We have the regular function $f=id:\mathbb{P}^1\rightarrow\mathbb{P}^1$. Thus we get a regular differential form $df=f-f(x)\text{ mod }m_p^2.$
But how can we compute $div f?$ What is $v_{(0,0)}(f)?$ Since $f$ vanishes at $0$, $v_{(0,0)}(f)\ge 1$. Since $f$ has no poles and no other zeros, we have $div f=v_{(0,0)}(f)(0,0)-v_{(0,0)}(f)\infty$, because principal divisors have degree zero.
But what is $v_{(0,0)}(f)$? The solution should be 2, but why?
 A: Let $[x:y]$ be the homogeneous coordinates on $\mathbb P^1$. Pick affine charts, $U_0 = \{ [1:z ] : z \in \mathbb A^1\}$ and $U_0 = \{ [w:1] : w \in \mathbb A^1$}. So $z = 1/w$ on the overlap.
Let's pick any meromorphic differential and find its corresponding divisor. If you're only interested in finding the divisor class up to linear equivalence, it doesn't matter which meromorphic differential you pick.
So how about $\omega = dz$? That seems like the most obvious choice. 
Well, the expression $\omega = dz$ is valid in the $U_0$ patch. It has no zeroes or poles in $U_0$.
However, in the $U_1$ patch, $\omega = d(1/w) = - dw / w^2$. This has an order $2$ pole at $w = 0$.
Thus $v_{w=0}(\omega) = -2$.
[Let me spell out in more detail how to find the valuation of a differential at a point $p$. Let $t$ be any local parameter at $p$. Try to write your differential as $\omega = \alpha(t) dt$, where $\alpha(t)$ is a function in the local ring at $p$. Then find the valuation of $\alpha(t)$. In the example above, $w$ is a local parameter at $w = 0$. Writing $\omega = (-1/w^2)dw$, the $t$ in this example is $w$ and the $\alpha$ is $-1/w^2$. And $-1/w^2$ has valuation $-2$.
To give you a slightly more non-trivial example, suppose the curve is the parabola $V(y-x^2) \subset \mathbb A^2$ and you want to find the valuation of $\omega = ydy$ at $(0,0)$. Here, $x$ is a local parameter but $y$ is not. So you write $\omega = (x^2) d(x^2) = (x^2 ) (2xdx) = 2x^3 dx$. Then you take the valuation of $2x^3$, which is 3.]
Anyway, back to differentials on $\mathbb P^1$. Perhaps you're now wondering what happens if we pick a different $\omega$. Let's try it. How about $\omega = z dz = - dw/ w^3$? This has a single zero at $z  = 0$ and a triple pole at $w = 0$. Notice that the degree of the divisor associated to my new $\omega$ is $1 - 3 = -2$, agreeing with the degree for our previous choice, $\omega = dz$. This is how it should be. You expect divisors associated to any two choices of meromorphic differential to be linearly equivalent. Indeed, two divisors on $\mathbb P^1$ are linearly equivalent if and only if they have the same degree.
If you're wondering what a differential actually is, the most practical advice I can give is not to worry. I just think of a differential as a formal expression of the form $f_1 dg_1 + \dots + f_n dg_n$ where $f_i$ and $g_i$ are functions on the curve. You manipulate these formal expressions using the rules that (i) $dc = 0$ for any constant $c$, (ii) $d(f+g) = df+ dg$ and (iii) $d(fg) = fdg + gdf$. These formal expressions are called Kahler differentials, and Hartshorne uses them.
