Infinite coproduct of affine schemes
Let $(X_i)_{i\in I}$ be a family of affine schemes, where $I$ is an infinite set and $X_i = Spec(A_i)$ for each $i \in I$. Let $X$ be a coproduct of $(X_i)_{i\in I}$ in the category of schemes. Let $\Gamma(X, \mathcal{O}_X)$ be the ring of global sections.
(1) Is $X$ affine?
(2) Can we deterimine the struture of $\Gamma(X, \mathcal{O}_X)$ by $(A_i)_{i\in I}$?
Solution 1:
(1)No, the scheme $X=\bigsqcup X_i$ is not affine (unless almost all $X_i$ are empty!) because its underlying topological space $\mid X\mid=\bigsqcup \mid X_i\mid$ is not quasi-compact.
(2) Yes, $\Gamma (X,\mathcal O_X)$ is determined by the formula $$\Gamma (X,\mathcal O_X)=\prod \Gamma (X_i,\mathcal O_{X_i})=\prod A_i$$
Remarks
a) The scheme $X$ has as underlying topological space $\mid X\mid=\bigsqcup \mid X_i\mid$ , as already mentioned, and its structure sheaf is the unique sheaf of rings $\mathcal O_X$ satisfying $\mathcal O_X\mid X_i=\mathcal O_{X_i}$.
[O my dear nitpicking brothers , notice that "unique" here really means unique, and not unique up to isomorphism!]
b) In order to prevent any misunderstanding, let me emphasize that the scheme $X$ is the coproduct of the schemes $X_i$ in the category of all schemes (not in the category of affine schemes!).
In other words, the open immersions $u_i :X_i\hookrightarrow X$ produce bijections $Hom_{schemes}(X,Y)=\prod Hom_{schemes}(X_i,Y): f\mapsto f\circ u_i$ which are functorial in the scheme $Y$.
Edit
c) Beware the subtle fact that the family of affine schemes $X_i=Spec(A_i)$ also has a coproduct in the category $Affsch$ of affine schemes, namely $X'=Spec(\prod A_i)$.
There is a canonical morphism of schemes $$\alpha: X=\bigsqcup_{Sch} X_i \to X'=\bigsqcup_{Affsch} X_i=Spec(\prod A_i)$$ of the coproduct of the $X_i$'s in the category of all schemes to the coproduct of the $X_i$'s in the category of affine schemes.
This morphism $\alpha$ is determined by its restrictions $\alpha|X_j:X_j=Spec(A_j)\to Spec(\prod A_i)$, which are dual to the ring projections $\prod A_i\to A_j$.
And finally, let me insist: this canonical morphism $\alpha$ is an isomorphism of schemes if and only the family of schemes$(X_i)$ is a finite family.
[This edit is the consequence of a pleasant discussion with my friend and very competent colleague Dehon: thanks François-Xavier!]
Solution 2:
No, $X$ is not affine if $I$ is infinite because an infinite disjoint union of schemes is not quasi-compact. The natural map $\mathscr{O}_X(X)\rightarrow\prod_i\mathscr{O}_X(X_i)=\prod_iA_i$ is an isomorphism by the definition of a sheaf together with the fact that $X_i\cap X_j=\emptyset$ inside $X$ for all $i\neq j$.