Let $(X,O_X)$ scheme and $f\in{O_X(X)}$ then $X_f$ is an open subset of $X$ where $X_f=\left\{{x\in{X}| f_x\in{u(O_{X,x})}}\right\}$ and $ u(O_{X,x})$is the set of invertible elements.
Proof:
As $x\in{X_f}$ then $f_x\in{u(O_{X,x})}$ then there is a $g_x\in{O_{X,x}}$ such that
$f_xg_x=1$ implies that exists $x\in U$ and $x\in V$ such that $f\vert_U g\vert_V=1$, so "shrinking" $U$ is take $U\cap V$ and then we can talk about $(fg)\vert_{U\cap V}=1$?
$f_xg_x=1$ is equivlent to saying that there exists an open subset $x\in U$ such that $(fg)_{\mid U}=f_{\mid U}g_{\mid U}=1$ by definition of the stalk. This implies that for every $y\in U, f_yg_y=1$, thus $U\subset X_f$ and henceforth $X_f$ is open.