Invertible germs imply invertible section

Let $(X, \mathcal{O}_X)$ be a ringed space. I want to show that if $f \in \mathcal{O}_X(U)$ and $f_p$ (the germ of $f$ at $p$) is invertible for all $p\in U$, then $f$ is invertible.

By using sheaf axioms, it suffices for each $p\in U$ to give an open set $p\in V\subseteq U$ and a section $g \in \mathcal{O}_X(V)$ such that $f|_V \,g=1$. How can I construct $g$? The information about $f$'s germs seem disjointed to me and I can't make anything out of them.


Solution 1:

I don't know how you defined the stalk of a sheaf, but let me use the following definition: $\mathcal O_p$ is the set of pairs $(U, s)$ such that $U$ is an open neighbourhood of $p$ and $s \in \mathcal O_X(U)$ under the equivalence relation that $(U,s)$ and $(V,t)$ are equal iff there is some neighbourhood of $p$, $W$ such that $W \subset U \cap V$ and $s=t$ on $W$.

Now, with this definition, the fact that $f_p$ is invertible means that there exists a germ of a function $(V,g)$ such that $(V,g) \cdot (U,f)$ is equivalent to $(U,1)$. Unwrapping the definition of the equivalence relation this implies that there is a neighbourhood of $p$, $W$ contained in both $U$ and $V$ such that $fg=1$ on $W$.