I'm working through Ravi Vakil's notes on algebraic geometry, and I'm at exercise 2.3.R, which states that, if there are maps of objects $X\_1\rightarrow Y,X\_2\rightarrow Y,Y\rightarrow Z$, then


$$
\require{AMScd}
\begin{CD}
X\_1\times\_YX\_2@>>> X\_1\times\_ZX\_2\\
@VVV@VVV\\
Y@>>> Y\times\_ZY
\end{CD}
$$


is a fibered/Cartesian square, assuming all relevant fibered products exist. I believe I have written a full proof, but a thing or two bothered me. In writing down the fibered square for $Y\times\_ZY$, I guess I assumed that the maps to both $Y$ terms were the same. But I'm sure there are other ways of building this fibered product. Also, a similar situation in seeing what the map along the bottom of the magic square is; I wrote it down assuming that $Y$ mapped to itself via the identity and then applying the universal property, but again, I'm sure that's not the only way.


The map on the right side of the square... Is there some sort of natural map there? I mean, I guess you could look at the maps $X\_1\times\_ZX\_2\rightarrow X\_1\rightarrow Y$ (and similarly for the other factor) and again appealing to the universal property... But there are, again, other ways to do this (I think..).


Am I wrong? Or could this really be a lot more precise?



Magic square of fibered products: vague/unclear?
This cartesian square is important for establishing some basic results about base change in algebraic geometry (although, of course, it holds in every category). The maps are constructed as follows: $X\_1 \times\_Y X\_2 \to X\_1 \times\_Z X\_2$ corresponds to a pair of maps $X\_1 \times\_Y X\_2 \to X\_i$ whose composition to $Z$ is the same; well just take the projections from the fiber product and remark that since their composition to $Y$ is the same, the same is true for $Z$. The map $X\_1 \times\_Z X\_2 \to Y \times\_Z Y$ is induced by the two maps $X\_i \to Z$. The map $Y \to Y \times\_Z Y$ is the diagonal map, which is defined to correspond to the identity of $Y$ in both factors. Finally, the morphism $X\_1 \times\_Y X\_2 \to Y$ is just the natural map. So to sum up: Every morphism in the diagram is defined canonically. Of course there are other choices possible, but no other choice does make sense.


I would like to make a digression which makes this cartesian square even more clear and deduces it from a more general result, namely that limits commute with limits. Besides, the general result will also yield other canonical isomorphisms which occur often in algebraic geometry. Typically, these isomorphisms are proven separatedly, but as you will see, they are all just corollaries of the following:



> 
> *Lemma*. In an arbitrary category, consider the following commutative diagram:
> $$
> \require{AMScd}
> \begin{CD}
> X\_1 @>>> X\_0 @<<< X\_2\\
> @VVV @VVV @VVV\\
> S\_1 @>>> S\_0 @<<< S\_2\\
> @AAA @AAA @AAA\\
> Y\_1 @>>> Y\_0 @<<< Y\_2
> \end{CD}
> $$
> Assuming that all the fiber products exist, then we have
> $$(X\_1 \times\_{S\_1} Y\_1) \times\_{X\_0 \times\_{S\_0} Y\_0} (X\_2 \times\_{S\_2} Y\_2) = (X\_1 \times\_{X\_0} X\_2) \times\_{S\_1 \times\_{S\_0} S\_2} (Y\_1 \times\_{Y\_0} Y\_2).$$
> 
> 
> 


In order to make sense of the fiber products, we use, of course, the only possible maps. For example, the two squares on the left yield the map $X\_1 \times\_{S\_1} Y\_1 \to X\_0 \times\_{S\_0} Y\_0$. The Lemma may be memorized as follows: The horizontal fiber product of the vertical fiber products equals the vertical fiber product of the horizontal fiber products.


Now as for the proof of the Lemma, just use the Yoneda Lemma to reduce it to the case of the category of sets, where you can really *see* this equation immediately. It isn't necessary to draw any arrows and verify the universal property by hand; or rather you encode these arrows as elements.


The first corollary of the lemma is the "cancelling law":



> 
> For morphisms $X \to T \to S$ and $Y \to S$, we have $X \times\_T (T \times\_S Y) \cong X \times\_S Y$.
> 
> 
> 


Proof: Apply the lemma to:


$$
\require{AMScd}
\begin{CD}
X @>>> T @<<< T\\
@VVV @VVV @VVV\\
S @>>> S @<<< S\\
@AAA @AAA @AAA\\
S @>>> S @<<< Y
\end{CD}
$$


The second one is the "Magic square" of the initial question:



> 
> For morphisms $X \to S$, $Y \to S$, $S \to T$, there is a cartesian square
> $$
> \require{AMScd}
> \begin{CD}
> X \times\_S Y @>>> X \times\_T Y \\
> @VVV @VVV\\
> S @>>> S \times\_T S
> \end{CD}
> $$
> 
> 
> 


Proof: Apply the lemma to:


$$
\require{AMScd}
\begin{CD}
S @>>> S @<<< X\\
@VVV @VVV @VVV\\
S @>>> T @<<< T\\
@AAA @AAA @AAA\\
S @>>> S @<<< Y
\end{CD}
$$


