# Product of schemes

I want to show that $\mathbb{A}_B^n=\mathbb{A}_\mathbb{Z}^n\times_{\mbox{Spec }\mathbb{Z}}B$ for every ring $B$, where $\mathbb{A}_B^n:=\mbox{Spec }B[x_1,\ldots,x_n]$. This is equivalent to showing that $\mathbb{A}_B^n$ possesses the universal property that the product has, and so if I have a scheme $X$ and morphisms $g:X\to\mbox{Spec }B$ and $h:X\to\mbox{Spec }\mathbb{Z}[x_1,\ldots,x_n]$ that commute with the morphisms from these affine schemes to $\mbox{Spec }\mathbb{Z}$, then I get a unique morphism from $X$ to $\mathbb{A}_B^n$.

Writing out everything properly, this basically comes down to the following problem: given $p\in\mbox{Spec }\mathbb{Z}[x_1,\ldots,x_n]$ and $q\in\mbox{Spec }B$ with the property that $p\cap\mathbb{Z}=\varphi^{-1}(q)$ (where $\varphi:\mathbb{Z}\to B$ is the natural homomorphism), then there exists an ideal $r\in\mbox{Spec }B[x_1,\ldots,x_n]$ such that $r\cap B=q$ and $\hat{\varphi}^{-1}(r)=p$ (where $\hat{\varphi}:\mathbb{Z}[x_1,\ldots,x_n]\to B[x_1,\ldots,x_n]$ is the morphism induced by $\varphi$).

Any ideas? Am I just missing something? Is there another easier way to tackle this exercise?

-
From the equivalence of categories between rings and affine schemes, it seems like you'd just have to show that $B[x_1, \ldots, x_n] \approx \mathbf Z[x_1, \ldots, x_n] \otimes_\mathbf Z B$, no? – Dylan Moreland Mar 16 '12 at 17:42
Of course! And then it's obvious.... Thanks! – rfauffar Mar 16 '12 at 17:43
If you want, write it as an answer... – rfauffar Mar 16 '12 at 17:44
@DylanMoreland: Yes, but you need to know that the inclusion $\textbf{Aff} \hookrightarrow \textbf{Sch}$ preserves limits, because, a priori, a subcategory may have limits that are not preserved. – Zhen Lin Mar 16 '12 at 20:56