Let $X$ be a scheme over $S=Spec A$ and let $U, V$ be affine opens in $X$. Let $X$ be separated over $A$ and let $\delta$ be the diagonal morphism $X \rightarrow X \times_S X$. Then the $U \cap V$ is also affine. The proof I've seen goes like this:
- $\delta$ restricts to a map $U \cap V \rightarrow U \times_S V$.
- The restriction of $\delta$ is still a closed immersion (it is a homeomorphism onto a closed set with surjective stalk maps, since they are the same stalk maps as $\delta$).
- Therefore, $Z = (U \times_S V) \cap \delta(X)$ is a closed set.
- At this point, the proof I saw says that $Z$ is affine (since closed sets in affine schemes are affine) and that $\delta: U \cap V \rightarrow Z$ is an isomorphism, so $U \cap V$ is also affine.
I know that $Z$ is homeomorphic to $U \cap V$. The problem I have is that we haven't defined a scheme structure on $Z$. But since $Z$ is a closed subset of an affine scheme, it has the natural structure from Spec of the quotient ring. So let's define this for $Z$. At this point, how do we restrict the morphism $\delta$, which currently maps to $U \times V$, to $Z$ (I know the topological map of points restricts to $Z$, but how about as a morphism of schemes)? And if we do this, how do we show it is an isomorphism of schemes?
Another approach would be the following:
Let $U=Spec B$, $V=Spec C$. So $U \times V = Spec B \otimes_A C$, and $Spec R$ an affine open in $U \cap V$. Then we have a ring homomorphism $\phi: B \otimes_A C \rightarrow R$ coming from the map $\delta$ to $U\times V$. Define $J$ to be the kernel of this map. Then define $I'$ to be the intersection of all such $J$'s where we range over all $R$'s. So we can map $(B \otimes_A C)/I' \rightarrow (B \otimes_A C)/J \rightarrow R$ and hence we have a morphism $U \cap V \rightarrow Spec (B \otimes_A C)/I'$. Is this an isomorphism? Does $I'=I$, where $Z=Spec (B \otimes_A C)/I$?
A reference to your first proof is https://stacks.math.columbia.edu/tag/01KP (Its a bit more general, but the difference is really just going to affines). There it references https://stacks.math.columbia.edu/tag/01IN which is basically the answer to your question as $U\cap V =\Delta^{-1}(Z) = \Delta^{-1}(U\times_SV)$ and $Z=Spec(B\otimes_A C)$, is affine.
To formulate it in my own words: You got $\Delta:X\to X\times_SX$, the diagonal and $U = Spec(B),V=Spec(C) \subset X$ affine opens of $X$. Because $X$ is separated $\Delta$ is a closed immersion. Now $U\times_S V = Spec(B\otimes_A C)\subset\Delta X$ is affine. So we get a closed immersion from $U\cap V = \Delta^{-1}(U\times_SV)$ to $U\times_S V$ and any closed subscheme of an affine scheme is affine. Therefor we get $U\cap V = Spec((B\otimes_A C)/J)$, where $J$ is the ideal such that $J^{\sim}$ is the kernel of this closed immersion.
So to conclude we don't get an isomorphism of $U\cap V$ and $U\times_S V$ but we only need that $\Delta(U\cap V)$ is closed in $U\times_S V$ for our claim.
For your second approach I don't think we can do it that way because in general open affines of an affine scheme are not quotients of that scheme, but I am not completely sure about that.