$U_1 \cap U_2$ can be covered by open sets which are basic in both $U_1$ and $U_2$ Let $(X, \mathcal O_X)$ be a scheme, and $U_i \cong \textrm{Spec } B_i, i = 1, 2$ affine open sets.  I'm trying to show that for any $x \in U_1 \cap U_2$, there exists an affine open set $U$ with $x \in U \subseteq U_1 \cap U_2$ such that $U$ is a basic open set in both $U_1$ and in $U_2$.
It was easy to solve the problem in the special case that $U_1 \subseteq U_2$.  Here, $U_1$ is covered by basic open sets of $U_2 = \textrm{Spec } B_2$, so there exists an $f \in B_2$ such that $x \in D_{B_2}(f) \subseteq U_2$.  Now let $\overline{f}$ be the image of $f$ under the homomorphism $B_2 = \mathcal O_X(U_2) \rightarrow \mathcal O_X(U_1) = B_1$.  If $\mathfrak p$ is a prime of $B_2$ which corresponds to a point $p$ in $U_2$, then $p \in D_{B_2}(f) \iff f$ is not a unit in $(B_2)_{\mathfrak p}, \iff $ the germ $(f,U_2)_p = (\overline{f},U_1)_p$ is not a unit in $\mathcal O_{X,p}, \iff p \in D_{B_1}(\overline{f})$.  So $D_{B_2}(f) = D_{B_1}(\overline{f})$ is basic open in both $U_1$ and $U_2$.
Now in the general case, there is an affine open set $U_0$ which satisfies $x \in U_0 \subseteq U_1 \cap U_2$.  Is there a way I can apply that special case to solve the problem in the general case?  Or should I be doing a different approach?  Please don't give me the full answer, I would very much appreciate a small hint.
 A: Here is a full solution to the problem.  We can break the proof into three steps.
(i): Assume that $U_1 \subseteq U_2$.  You can then apply the argument I mentioned above.
(ii): Assume that $U_1 \subseteq U_2$, but $U_1$ is actually a basic open subset of $U_2$.  Write $U = U_2, B = B_2,$ and $D_B(f) = U_1$ for some $f \in B$.  Now $U$ is an open affine with $\mathcal O_X(D_B(f)) = B_f$.  \emph{In this case, we claim that a subset of $D_B(f)$ is basic open in $D_B(f) = \textrm{Spec } B_f$ if and only if it is basic open in $U = \textrm{Spec } B$.}  To see this, note that the basic open subsets of $D_B(f) = \textrm{Spec } B_f$ are all of the form $D_{B_f}(\frac{g}{f^n}) = \{ \mathfrak p B_f : \frac{g}{f^n} \not\in \mathfrak p B_f \}$ for some $\frac{g}{f^n}$.  But $\frac{g}{f^n} \in \mathfrak p B_f$ (for some prime $\mathfrak p$ of $B$ corresponding to a point in $D_B(f)$) if and only if $g \in \mathfrak p$, and so $D_{B_f}(\frac{g}{f^n}) = D_B(g)$.  This establishes the claim.
(iii): Now for the general case, $(U_1 \cap U_2, \mathcal O_{X|U_1 \cap U_2})$ is a scheme, and so we may find an affine open neighborhood $W \subseteq U_1 \cap U_2$ which contains $x$.  Now within $W$, by (i) we may produce a basic open subset $W_0$ of $W$ which contains $x$ and which is also basic open in $B_2$.   Now we apply (i) again to produce an open set $W_{-1} \subseteq W_0$ containing $x$ which is basic open in both $W_0$ and in $U_1$.  But now by (ii), $W_{-1}$ is also basic open in $U_2$, because $W_0$ is basic open in $U_2$. 
