gluing ideals together While pondering basic facts about closed subschemes the following claim occurred to me . I think it must be true but I have trouble proving it algebraically.
Let $ R$ be a commutative ring with 1.  Let $f_1,...,f_k\in R$ with $ (f_1,...,f_k)=R$  and let $I_1\subset R_{f_1}, ..., I_k\subset R_{f_k}$ be ideals. Suppose that for each $i,j$, the ideal generated by the image of $I_i$ in $ R_{f_if_j}$ is the same as the ideal generated by the image of $I_j$ in $ R_{f_if_j}$.  Then there exists a unique ideal $I\subset R$ whose image in each $R_{f_i}$ generates $I_i$.
 A: I suspect there is possibly a much more elegant solution than this, but here is a (slightly ugly) proof.
For each $i, j$, let $\iota_i:R\rightarrow R_{f_i}$ and $\tau_{ij}:R_{f_i}\rightarrow R_{f_if_j}$ be the canonical localization maps. (Recall in particular that $\text{ker}(\tau_{ij})=\{x\in R_{f_i}:\exists b\in\mathbb{N}\text{ such that }xf_j^b\big/1=0\big/1\in R_{f_i}\}$.) Now, define $I=\bigcap_{i=1}^k\iota_i^{-1}(I_i)$. Certainly $I$ is an ideal of $R$, and each $\iota_i(I)R_{f_i}\leqslant I_i$. I claim that this inclusion is an equality.
To see this, let $r\big/{f_i^m}\in I_i$, where $r\in R$. Now, to show $r\big/f_i^m\in\iota_i(I)R_{f_i}$ it certainly suffices to show $r\big/1\in\iota_i(I)R_{f_i}$, so really we just need to find $s\in I$ and $n\in\mathbb{N}$ such that $r\big/1=s\big/f_i^n\in R_{f_i}$.
To do this, fix some $j\neq i\in\{1,\dots,k\}$. Note that $r\big/1\in I_i$, so $r\big/1\in \tau_{ij}(I_i)R_{f_if_j}=\tau_{ji}(I_j)R_{f_if_j}$, so there are $f\in I_j$ and $a\in\mathbb{N}$ such that $r\big/1=f\big/f_i^a\in R_{f_if_j}$. Hence $(rf_i^a-f)\big/1\in\text{ker}(\tau_{ji})$, so there is $b\in\mathbb{N}$ such that $(rf_i^a-f)f_i^b\big/1=0\big/1\in R_{f_j}$, ie such that $rf_i^{a+b}\big/1=ff_i^b\big/1\in R_{f_j}$. But then, because $f\in I_j$, we have $rf_i^{a+b}\big/1\in I_j$. Denote therefore $n_j=a+b$, so that $rf_i^{n_j}\big/1\in I_j$.
Now, do this for all $j$, let $n=\text{max}_{j\neq i}n_j$, and define $s=rf_i^n\in R$. Clearly $s\in I$, since (for all $j$) $\iota_j(s)=s\big/1=(rf_i^{n_j})f_i^{n-n_j}\big/1\in I_j$ by construction of the $n_j$. Furthermore, we have $s\big/f_i^n=rf_i^n\big/f_i^n=r\big/1\in R_{f_i}$, so this $s\in I$ and $n\in\mathbb{N}$ give us exactly the witnesses of $r\big/1\in\iota_i(I)R_{f_i}$ that we desire.

Oops, forgot to show uniqueness. First note that $I$ is certainly maximal with the property you desire; if $r\in R\setminus I$, then by construction of $I$ there is some $i\in\{1,\dots,k\}$ with $\iota_i(r)\notin I_i$. But then clearly the image of any ideal containing $r$ in $R_{f_i}$ is strictly larger than $I_i$, so there can be no such ideal with the property we desire.
Conversely, suppose that $J\leqslant I$ has the property we desire. So $\iota_i(J)R_{f_i}=I_i$ for each $i$. Let $r\in I$, and fix some $i\in\{1,\dots,k\}$. By construction we have $r\big/1\in I_i=\iota_i(J)R_{f_i}$, so there must be $s_i\in J$ and $a\in\mathbb{N}$ such that $r\big/1=s_i\big/f_i^a\in R_{f_i}$. Thus $rf_i^a-s_i\in\text{ker}(\iota_i)$, so there is $b\in\mathbb{N}$ such that $(rf_i^a-s_i)f_i^b=0\in R$. But then, since $s_i\in J$, we have $rf_i^{a+b}\in J$, so let $m_i=a+b$.
Repeat this process for all $i$, and let $m=\sum_{i=1}^k m_i$. Now, this is where we need the hypothesis that $\langle f_1,\dots,f_k\rangle=R$. Indeed, in particular, there are $\lambda_i\in R$ such that $\lambda_1 f_1+\dots+\lambda_k f_k=1$. This gives $r=r1=r1^m=r(\lambda_1 f_1+\dots+\lambda_k f_k)^m$. Every monomial term after expanding the right hand side will have a factor of $rf_i^{m_i}$ for some $i$, and hence lie in $J$ by construction. Thus the entire right hand side is an element of $J$, so $r$ is too, and we have $I=J$ as desired.
