the affine scheme of an integral ring is integral Let $X=\operatorname{Spec}A$ be an affine scheme. In the book of Hartshone, he claimed that $X$ is integral if and only if $A$ is an integral domain. If $X$ is integral then we can deduce easily that $A$ is an integral domain.
How can I show that if $A$ is an integral domain then $X$ is integral ? Please give me some hint. Thanks.
 A: Suppose $A$ is integral and let $U$ be a non-empty open subset of $\operatorname{Spec} A$. Let $f, g \in \mathcal{O}_{\operatorname{Spec} A}(U)$. By definition of $\mathcal{O}_{\operatorname{Spec} A}(U)$ we have an open covering $U = \bigcup V_i$, such that $f|_{V_i} = f_i/s_i$ and $g|_{V_i} = g_i/t_i$. Now, $f|_{V_i}=0$ is equivalent to $f(Q) = 0$ for some $Q \in V_i$: if $f(Q) = 0$ for some $Q \in V_i$, then there exists $s \not\in Q$ such that $s f_i = 0$, and so $f_i=0 \Rightarrow f|_{V_i}=0$. Similarly for $g$.
Next, suppose that $f, g$ are non-zero but $fg=0$. Then there exist $P \in V_i$ and $Q \in V_j$, for some $i,j$, such that $f(P) \neq 0$ and $g(Q) \neq 0$. Suppose that $V_i \cap V_j \neq \emptyset$. Then for $P' \in V_i \cap V_j$ we must have $f(P')g(P') = 0$. Hence there exists some $s' \not\in P'$ such that $s' f_i g_j = 0$, which implies either $f|_{V_i \cap V_j} = 0$ or $g|_{V_i \cap V_j} = 0$. But this is a contradiction in view of the remark of the previous paragraph. 
Hence it must be the case that $V_i \cap V_j = \emptyset $ and so $\operatorname{Spec} A = V_i^c \cup V_j^c, \, \, \, (*)$. Since $A$ is an integral domain, $\operatorname{Spec} A$ is irreducible, which contradicts $(*)$, since both $V_i^c, V_j^c$ are proper subsets. Hence either $f=0$ or $g=0$.
