This is a question from the exercise in my textbook on commutative ring theory but I do not know how to prove this. I would be very appreciated if anyone can give me some details.
Let $A_1,A_2$ be rings, denote by $A=A_1\times A_2$ their product and by $\pi_i:A\to A_i, (a_1,a_2)\to a_i, i=1,2$ the projection maps. Show that we have decomposition of $\operatorname{Spec}A :=\{\text{set of all prime ideals of }A\}$ into disjoints sets $$\operatorname{Spec}A= \pi_1^{-1}(\operatorname{Spec}A_1)\bigsqcup \pi_2^{-1}(\operatorname{Spec}A_2) \overset{\text{bij.}}{\leftarrow} \operatorname{Spec}A_1 \bigsqcup \operatorname{Spec}A_2.$$
Edit. I got the following hint but I don't know how to use it: $\pi_i^{-1}:\operatorname{Spec}A_i \to \operatorname{Spec}A$ maps bijectively onto $\pi_i^{-1}(\operatorname{Spec}A_i)$.
Thank you!
Let $\mathfrak{p}$ be a prime ideal of $A$. Then $0=(1,0) \cdot (0,1)\in \mathfrak{p}$ so either $(1,0)$ or $(0,1)$ belong to $\mathfrak{p}$. WLOG, assume $(1,0)\in \mathfrak{p}$. Thus, $A_1\times \{0\} \subset \mathfrak{p}$ and it follows that $\mathfrak{p}=A_1 \times \mathfrak{p}_2$ for some prime ideal $\mathfrak{p}_2$ of $A_2$. If we had $(0,1)\in \mathfrak{p}$, we would get that $\mathfrak{p}=\mathfrak{p}_1 \times A_2$ for some prime ideal $\mathfrak{p}_1$ of $A_1$. Thus we get a characterization of $Spec(A)$ in terms of $Spec(A_1)$ and $Spec(A_2)$.
Can you take it from here ?