[proofplan]
We prove the divisor identities coefficient by coefficient along each irreducible hypersurface $Y \subset X$. The coefficient of $Y$ in a principal divisor is the order of the [meromorphic function](/page/Meromorphic%20Function) along $Y$, so we compute this order in a neighbourhood of a smooth point of $Y$ where a local defining function exists. Local factorizations of the form $f=s^a u$ and $g=s^b v$, with $u$ and $v$ nonvanishing along $Y$, show that multiplication adds orders and inversion changes their signs. Since equality of divisors is coefficientwise, these local computations assemble to the global identities, and the identities imply that principal divisors form a subgroup.
[/proofplan]
[step:Compute the coefficient along a fixed irreducible hypersurface]
Fix an irreducible analytic hypersurface $Y \subset X$. Let $p \in Y$ be a smooth point of $Y$ at which the orders of $f$ and $g$ along $Y$ are computed. Choose an open neighbourhood $U \subset X$ of $p$ and a [holomorphic function](/page/Holomorphic%20Function)
\begin{align*}
s: U \to \mathbb{C}
\end{align*}
such that $Y \cap U = \{x \in U : s(x)=0\}$ and $s$ vanishes to first order along $Y \cap U$.
By the definition of order along $Y$, there exist integers $a,b \in \mathbb{Z}$ and meromorphic functions
\begin{align*}
u: U \to \mathbb{P}^1
\end{align*}
and
\begin{align*}
v: U \to \mathbb{P}^1
\end{align*}
such that
\begin{align*}
f|_U = s^a u
\end{align*}
and
\begin{align*}
g|_U = s^b v,
\end{align*}
where $u$ and $v$ have order $0$ along $Y$. Thus
\begin{align*}
a = \operatorname{ord}_Y(f)
\end{align*}
and
\begin{align*}
b = \operatorname{ord}_Y(g).
\end{align*}
Multiplying the two local expressions gives
\begin{align*}
(fg)|_U = s^{a+b}uv.
\end{align*}
Since $u$ and $v$ both have order $0$ along $Y$, their product $uv$ also has order $0$ along $Y$. Therefore
\begin{align*}
\operatorname{ord}_Y(fg)=a+b=\operatorname{ord}_Y(f)+\operatorname{ord}_Y(g).
\end{align*}
[guided]
We isolate one hypersurface $Y$ because a divisor is determined by its integer coefficient along each irreducible hypersurface. Fix such a $Y \subset X$, and choose a smooth point $p \in Y$ where the generic order along $Y$ is read. Since $Y$ is a hypersurface, there is an open neighbourhood $U \subset X$ of $p$ and a holomorphic function
\begin{align*}
s: U \to \mathbb{C}
\end{align*}
such that $Y \cap U = \{x \in U : s(x)=0\}$ and $s$ is a local defining equation for $Y$.
The order $\operatorname{ord}_Y(f)$ is precisely the exponent of this local defining equation in the factorization of $f$ near the generic point of $Y$. Thus there is an integer $a \in \mathbb{Z}$ and a meromorphic function
\begin{align*}
u: U \to \mathbb{P}^1
\end{align*}
with order $0$ along $Y$ such that
\begin{align*}
f|_U = s^a u.
\end{align*}
Likewise, there is an integer $b \in \mathbb{Z}$ and a meromorphic function
\begin{align*}
v: U \to \mathbb{P}^1
\end{align*}
with order $0$ along $Y$ such that
\begin{align*}
g|_U = s^b v.
\end{align*}
By construction,
\begin{align*}
a=\operatorname{ord}_Y(f)
\end{align*}
and
\begin{align*}
b=\operatorname{ord}_Y(g).
\end{align*}
Now multiply the two factorizations on $U$. The product is
\begin{align*}
(fg)|_U = (s^a u)(s^b v)=s^{a+b}uv.
\end{align*}
The factor $uv$ has order $0$ along $Y$ because neither $u$ nor $v$ contributes a zero or pole along the generic point of $Y$. Hence the only contribution to the order of $fg$ along $Y$ is the exponent $a+b$ of the defining equation $s$. Therefore
\begin{align*}
\operatorname{ord}_Y(fg)=a+b=\operatorname{ord}_Y(f)+\operatorname{ord}_Y(g).
\end{align*}
This is the coefficientwise additivity that will become the divisor identity.
[/guided]
[/step]
[step:Compute the coefficient of the inverse along the same hypersurface]
Using the same local expression $f|_U=s^a u$, the inverse is
\begin{align*}
f^{-1}|_U=s^{-a}u^{-1}.
\end{align*}
Since $u$ has order $0$ along $Y$, so does $u^{-1}$. Hence
\begin{align*}
\operatorname{ord}_Y(f^{-1})=-a=-\operatorname{ord}_Y(f).
\end{align*}
[/step]
[step:Assemble the coefficient identities into divisor identities]
The coefficient of $Y$ in $(fg)$ is $\operatorname{ord}_Y(fg)$, while the coefficient of $Y$ in $(f)+(g)$ is $\operatorname{ord}_Y(f)+\operatorname{ord}_Y(g)$. The first computation gives equality of these coefficients for every irreducible analytic hypersurface $Y \subset X$. Therefore
\begin{align*}
(fg)=(f)+(g).
\end{align*}
Similarly, the coefficient of $Y$ in $(f^{-1})$ is $\operatorname{ord}_Y(f^{-1})$, while the coefficient of $Y$ in $-(f)$ is $-\operatorname{ord}_Y(f)$. The second computation gives equality of these coefficients for every irreducible analytic hypersurface $Y \subset X$. Therefore
\begin{align*}
(f^{-1})=-(f).
\end{align*}
[/step]
[step:Conclude that principal divisors form a subgroup]
Let
\begin{align*}
\operatorname{Prin}(X)=\{(h):h\in \mathcal{M}(X)^*\}\subset \operatorname{Div}(X).
\end{align*}
The constant meromorphic function
\begin{align*}
1:X\to \mathbb{C}
\end{align*}
has order $0$ along every irreducible hypersurface, so $(1)=0$ and $0 \in \operatorname{Prin}(X)$.
If $(f),(g)\in \operatorname{Prin}(X)$, then $fg\in \mathcal{M}(X)^*$ and the product identity gives
\begin{align*}
(f)+(g)=(fg)\in \operatorname{Prin}(X).
\end{align*}
If $(f)\in \operatorname{Prin}(X)$, then $f^{-1}\in \mathcal{M}(X)^*$ and the inverse identity gives
\begin{align*}
-(f)=(f^{-1})\in \operatorname{Prin}(X).
\end{align*}
Thus $\operatorname{Prin}(X)$ contains the identity element of $\operatorname{Div}(X)$ and is closed under addition and additive inverses. Hence $\operatorname{Prin}(X)$ is a subgroup of $\operatorname{Div}(X)$.
[/step]