Closed subscheme from Ideals on affine open subsets Let X be a scheme and for each open affine $U\subset X$ let $I(U)$ be an ideal in $\mathscr O_X(U)$ such that for any identification $U = spec ~R$ we have $I(U)_f \simeq I(D(f))$ for any $f$ in R under the natural map.  I am supposed to show that these data determine a closed subscheme Y of X. 
It is easy to see that it determines a closed subset Y of X,  and one clearly wants to define $\mathscr O_Y|_ { U\cap Y}:= spec (\mathscr O_X  (U)/I(U))$  whenever U is an affine open subset of X.   But I find it difficult to glue these together.   what's the simplest (Low-tech) way  to construct the sheaf on Y? 
 A: We take $$Y=\bigcup_{U\cong spec(\mathcal{O}_X(U))}\{[{\frak{p}}]\in U: I(U)\subset \frak{p}\}  $$
where the union ranges over all affine  open subsets of $X$.  For each such $U$, we endow the topological space $Y\cap U$ with the structure of the affine scheme $$spec~(~\mathcal{O}_X(U)/I(U)~).$$  Call this scheme $Y_U$. In particular, if $D(f)\subset U~$ (for $f\in \mathcal{O}_X(U)$)  is a distingushed open affine of $U$, then $$\mathcal{O}_{Y_U}|_{D(f)\cap Y}\cong spec~(~\mathcal{O}_X(U)/I(U)~)_{\overline{f}}\cong~spec~ \mathcal{O}_X(U)_f/I(U)_f\cong~spec~ \mathcal{O}_X(D(f))/I(D(f))\cong \mathcal{O}_{Y_{D(f)}}$$ with canonical isomorphisms. Label $W=D(f)$ and label this composition 
$$\psi_{U,W}:\mathcal{O}_{Y_U}|_{W\cap Y}\xrightarrow{\sim} \mathcal{O}_{Y_{W}}$$ (why doesn't it depend on $f$? does it matter?).  It is easy [*] to see that if $V\subset W$ is a distinguished affine open of $W$, then we have $$\psi_{U,V}=\psi_{W,V}\circ (\psi_{U,W}|_{V\cap Y}).~~~~~~~~~~(1)$$ 
If $Y\cap U_1\cap U_2 \neq \emptyset$, we construct a gluing morphism $$\varphi=\varphi_{U_1, U_2}:\mathcal{O}_{Y_{U_1}}|_{Y\cap U_1\cap U_2}\rightarrow  \mathcal{O}_{Y_{U_2}}|_{Y\cap U_1\cap U_2}$$ as follows.
First we may cover $Y\cap U_1\cap U_2$ with open sets of the form $W\cap Y$ where $W$ is a distinguished open subset of both $U_1$ and $U_2$ as in the comment above.  Then we define
$$  \varphi|_{W\cap Y}:=\psi_{U_2,W}^{-1}\circ \psi_{U_1, W}.$$
We must check that these local isomorphisms agree on their overlaps. That is, for $W_1, W_2\subset U_1\cap U_2$ and $V\subset W_1\cap W_2 $ such that $V$ is distinguished open affine with respect to $W_1$ and $W_2$, we must check that
$$(\psi_{U_2,W_1}^{-1}\circ \psi_{U_1, W_1})|_{V\cap Y}=(\psi_{U_2,W_2}^{-1}\circ \psi_{U_1, W_2})|_{V\cap Y}.~~~~~~~~~~~~~(2)$$ But by equation $(1)$ we have
$$(\psi_{U_2,W_1}^{-1}\circ \psi_{U_1, W_1})|_{V\cap Y}= (\psi_{U_2,W_1}|_{V\cap Y})^{-1}\circ \psi_{U_1, W_1}|_{V\cap Y}=((\psi_{W_1, V})^{-1}\circ \psi_{U_2,V})^{-1}\circ(\psi_{W_1, V})^{-1}\circ \psi_{U_1,V}=$$ $$ (\psi_{U_2,V})^{-1}\circ \psi_{U_1,V}$$
and the same computation with $W_1$ replaced with $W_2$ yields the same result, so that  $(2)$ is proved.  Thus $\varphi_{U_1, U_2}$ is well defined.  The cocycle condition $$(\varphi_{U_2, U_3}|_{U_1\cap U_2 \cap U_3\cap Y})\circ (\varphi_{U_1, U_2}|_{U_1\cap U_2 \cap U_3\cap Y})=\varphi_{U_1, U_3}|_{U_1\cap U_2 \cap U_3\cap Y} $$ is easily checked on any $W\subset U_1\cap U_2 \cap U_3 $ which is simultaneously a distinguished open of all three $U_i$, since then $$(\varphi_{U_2, U_3}|_{W\cap Y})\circ (\varphi_{U_1, U_2}|_{W\cap Y})=\psi_{U_3,W}^{-1}\circ \psi_{U_2, W} \circ \psi_{U_2,W}^{-1}\circ \psi_{U_1, W} = \psi_{U_3,W}^{-1}\circ \psi_{U_1, W} = \varphi_{U_1, U_3}|_{W\cap Y}.$$  This completes the proof. $\square$

[*] It clarifies things to notice the triviality that the ring isomorphism $$(\mathcal{O}_X(U)/I(U))_{\overline{f}} \xrightarrow{\sim} \mathcal{O}_X(W)/I(W)$$ which induces $\psi_{U,W}$ is just $$\frac{s+I(U)}{(f+I(U))^k}\mapsto (\rho_{U,W}^X(s)\cdot  \rho_{U,W}^X(f)^{-k})+I(W)$$ where $\rho_{U,W}^X$ is the morphism $\mathcal{O}_X(U)\rightarrow \mathcal{O}_X(W)$ in the structure sheaf of $X$.
