About the $div(f)$ given a curve $C$ In the Arithmetic of Elliptic Curves we define the divisor associated to a function $f\in K(C)^*$ for a given a curve $C$ as follows:
$$div(f)=\sum_{P\in C}ord_P(f)(P)$$
where $ord_P(f)$ is the max $d$ for which $f\in M_p^d$.
I don't get to understand the following example. Given the curve $$C:y^2=(x-e_1)(x-e_2)(x-e_3)$$
in some $K$ with $char(K)\neq 2$, we want to find $div(x-e_i)$ for each $i$. The book states that if we denote $P_i=(e_i,0)\in C$, then $$div(x-e_i)=2(P_i)-2(P_{\infty})$$
but I don't really see why. Taking the definition we have $$div(x-e_i)=\sum_{P\in C}ord_{P}(x-e_i)(P)$$
I understand that for each $P_i$ we have $ord_{P_i}(x-e_i)=1$ (and not $2$), because if it were $2$ then $(x-e_i)\in M_{P_i}^2$ and that would mean we could write $(x-e_i)=f_1f_2$ with $f_i\in M_{P_i}$, if I'm not mistaken, but then that is not possible because $(x-e_i)$ is already degree 1. So I don't see how it could be 2, and that's what I'm trying to understand, why do we have $ord_{P_i}(x-e_i)=2?$ And finally, why is it that $ord_{P_\infty}(x-e_i)=2?$
 A: At $P_1$, the function $y$ is a uniformizer, since $\frac{dx}{dy}$ is finite at $P_1$. Note that $(x-e_1) \in (y)^2$ since $(x-e_1) = y^2 \cdot \frac{1}{(x-e_2)(x-e_3)}$ (here $(x-e_2)(x-e_3)$ is invertible in the local ring at $P_1$); however, $(x-e_1) \notin (y)^3$ since no multiple of $y^3$ equals $x-e_1$ (proof left as an exercise for you). Hence $\operatorname{ord}_{P_1} (x-e_1) = 2.$
To get the order at $\infty$, you need to change (projective) coordinates. Assume for now the elliptic curve has short Weierstrass form $y^2 = x^3 + ax + b$ (the more general case is left as an exercise for you). Set as usual $y = Y/Z$ and $x = X/Z$. Then the point at infinity has coordinates $(X:Y:Z) = (0:1:0)$, so we need to normalize at $Y$. Set $x' = X/Y$ and $z' = Z/Y$. Then the new curve equation under this change of coordinates is $z' = x'^3 + a x' z'^2 + b z'^3$. The point at $\infty$ has coordinates $(x',z') = (0,0)$. Note that $x'$ is a uniformizer at $(0,0)$ since
$$
\left.\frac{dz'}{dx'}\right|_{(0,0)} = \left.\frac{3x'^2 + a z'^2}{1-2ax'z'-3bz'^2}\right|_{(0,0)} = \frac{0}{1} = 0.
$$
which shows that $\frac{dz'}{dx'}$ is finite at $(0,0)$. We also have
$$
\operatorname{ord}_{\infty} (x-e_1) = \operatorname{ord}_{(0,0)} \left(\frac{x'}{z'} - e_1\right).
$$
We can ignore the $-e_1$ term, since $x'/z' \to \infty$ as $(x',z') \to (0,0)$. So we need to calculate
$$
\operatorname{ord}_{(0,0)} x' - \operatorname{ord}_{(0,0)} z'.
$$
Obviously $\operatorname{ord}_{(0,0)} x' = 1$ since $x'$ is a uniformizer. As for $\operatorname{ord}_{(0,0)} z'$, observe that $x'^3 \cdot \frac{1}{1 - ax'z' - bz'^2} = z'$, and no larger power of $x'$ divides $z'$ in the local ring at $(0,0)$ (proof left as an exercise for you), so that $\operatorname{ord}_{(0,0)} z' = 3$. The difference of these two terms is $-2$, as desired.
