TITLE: Spectrum of a product of rings isomorphic to the product of the spectra
QUESTION [9 upvotes]: I've found in an exercise this statement:
If $A$ is a commutative ring with unit and $A = A_{1} \times \dots \times A_{n}$ then $$\def\Spec{\operatorname{Spec}} \Spec(A) \cong  \Spec(A_{1})\times \dotsb \times \Spec(A_{n})$$ Why is this true ?

REPLY [24 votes]: This is not true. Direct products of rings correspond to disjoint unions of affine schemes. Tensor products, on the other hand, correspond to fibre products (in particular, products) of affine schemes.
Explicitly,
$$\operatorname{Spec}(A_1\times\cdots\times A_n) \cong \operatorname{Spec}(A_1)\sqcup\cdots\sqcup \operatorname{Spec}(A_n)$$ and
$$\operatorname{Spec}(A_1\otimes_R A_2) \cong \operatorname{Spec}(A_1)\times_{\operatorname{Spec} R}\operatorname{Spec}(A_2).$$
The reason for this is that the functor $\operatorname{Spec}$ is a contravariant equivalence from the category $\operatorname{Ring}$ of commutative unital rings to the category $\operatorname{Aff}$ of affine schemes. In particular, it sends (fibre) products to (fibre) coproducts, and vice versa. The product in $\operatorname{Ring}$ is the cartesian product $\times$ and the coproduct in $\operatorname{Aff}$ is disjoint union $\sqcup$, giving the first statement above. The fibre coproduct in $\operatorname{Ring}$ is given by the tensor product, giving the second statement above.
Without resorting to abstract nonsense, we can see the bijection between $\operatorname{Spec}(A_1\times A_2)$ and $\operatorname{Spec}(A_1)\sqcup\operatorname{Spec}(A_2)$ as follows: the prime ideals of $A_1\times A_2$ are of the form $\mathfrak{p}\times A_2$ where $\mathfrak p$ is a prime ideal of $A_1$, or $A_1\times\mathfrak q$ where $\mathfrak q$ is a prime ideal of $A_2$.