# Alternative way of calculating the intersection number on a surface

Let $X$ be an algebraic surface over a field $k$ and let $D,E$ two smooth prime divisors on $X$. Assume that $e_x,f_x\in\mathcal O_{X,x}$ are the local equations at $x$ of $D$ and $E$ respectively. Let $v_{D,x}$ be the valuation at $x\in D$ (w.r.t the curve $D$). For any $x\in D$ there is a natural projection $\pi:\mathcal O_{X,x}\to k(D)$ (where $k(D)$ is the function field of the curve $D$ or equivalently the residue field at the generic point of $D$).

I'd like to understand why the following equality is true for any $x\in D\cap E$:

$$v_{D,x}(\pi(f_x))=\operatorname{length}_{\mathcal O_{X,x}}\left(\mathcal O_{X,x}/(e_x,f_x)\right)=:i_x(D,E)$$

In other words I'd like to understand why it is possible to calculate the local intersection number by means of the one dimensional valuation.

This is a local computation, so assume that $X = \operatorname{Spec} A$, and say $x\in D\cap E$ is given by the maximal ideal $\mathfrak{m}$. Then the natural projection is given by the projection $\pi: A_{\mathfrak{m}} \rightarrow A_{\mathfrak{m}}/e_x A_{\mathfrak{m}}$.
We claim that $v(\pi(f_x)) = length(A_{\mathfrak{m}}/(e_x,f_x))$. This reduces to the commutative algebra claim that if $(R,\mathfrak{m})$ is a discrete valuation ring with residue field $k$ where $R$ is a $k-$algebra containing $k$ mapping isomorphically to its residue field, and $f\in R$, then $\dim_k R/(f) = val(f)$. Note that the condition allows me to view $R/(f)$ as a $k-$vector space.
To see this, note that $val(f) = n \iff f = u \nu^n$ where $\nu$ is a local parameter for $R$, and $u\in R^{\times}$. So we see that $R/(f) = R/(\nu^n)$, and from the exactness of the following short exact sequence
$$0\rightarrow \mathfrak{m}/\mathfrak{m}^2 \rightarrow R/\mathfrak{m}^2 \rightarrow R/\mathfrak{m} \rightarrow 0$$
of $k-$vector spaces (and induction), we see that $\dim_k R/(\nu^n) = n$.
You get your original claim by letting $R=\mathcal{O}_{X,x}/(e_x)$ and $f=f_x$. To see the equality between length and dimension as a $k$-vector space, see Modules of Finite Length over Local Artinian Rings.