Clopen subset of affine scheme is affine?

69 Views Asked by At

Let $X=\operatorname{Spec}A$ be an affine scheme and $U,V\subset X$ disjoint open subsets such that $X=U\cup V$. Question: Are $U,V$ affine?

I would say yes, but I can't make my argument precise:
Since $X=U\coprod V$ we get $O_X(X)\cong O_X(U)\times O_X(V)$ and then $X\cong \operatorname{Spec} O_X(X)\cong\operatorname{Spec}O_X(U)\coprod\operatorname{Spec} O_X(V)$ and it seems to only make sense that then $\operatorname{Spec}O_X(U)=U$ under these isomorphisms.
I can prove it for elements as follows: Let $e_U\in A$ be such that $e_U\rvert_U=1,e_U\rvert_V=0$ and let $e_V=1-e_U$. The restriction map $\varphi:A\to O_X(U)$ is surjective and its kernel is $e_VA$, i.e $\operatorname{Spec}A/e_VA\cong\operatorname{Spec}O_X(U)$. If $P\subset A$ is a prime ideal with $P\in U$, then $e_Vf$ vanishes at $P$ for all $f\in A$, hence $P\supseteq e_VA$. Conversely, suppose $P\supseteq e_VA$. If $P\notin U$ we would have $P\in V$ so that $e_U$ vanishes at $P$, but then $e_U\in P$, so $e_U+e_V=1\in P$, a contradiction, hence $P\in U$. This shows that we can identify the elements in $U$ with the elements in $\operatorname{Spec}O_X(U)$. But is this enough? $U$ affine means that $U\to\operatorname{Spec} O_U(U)$ is an isomorphism, we showed it is bijective and in all cases of non-affine schemes I know this map is not bijective, so maybe bijective in this case suffices.