$X_f$ of locally ringed space $(X, O_X)$.

Let $$(X, O_X)$$ be a locally ringed space. $$f \in \Gamma(X,O_X)$$ be a global section. $$X_f:= \{ x \in X \, ; \, f_x \text{ is invertible in } O_{X,x} \}$$

It is claimed that

1. $$X_f$$ is an open subset
2. The image of $$f$$ in $$\Gamma(X_f, O_X)$$ is invertible.

How does one see this?

If $$f_x$$ is invertible in $$\mathcal{O}_{X, x}$$, then by definition of the stalk, there is an open neighborhood of $$U$$ of $$x$$ and a section $$g \in \Gamma(U, \mathcal{O}_X)$$ with $$fg = 1$$ on $$U$$.
It follows that if $$y \in U$$ is any other point in $$U$$, then $$f_y$$ is invertible in $$\mathcal{O}_{X, y}$$, which shows that the set of all such points is open.
The fact that the image of $$f$$ is invertible follows from the sheaf axioms: you can cover $$X_f$$ with opens $$U$$ on which you have local inverses $$g$$ for $$f$$, and these local inverses agree on the overlaps because inverses are unique (when they exist) in any ring.