TITLE: Bijective function in a commutative diagram
QUESTION [5 upvotes]: Let $X,Y, Z$ be sets and $p_x:Z\rightarrow X$ and $p_y:Z \rightarrow Y$ so that for every Triple $(M, f_x, f_y)$ exactly one function $g:M\rightarrow Z$ exists, which makes following diagram commutative (Commutative $\Leftrightarrow f_x=g\circ p_x$ and $f_y=g\circ p_y$).

Show that for $(M, f_x, f_y)=(X\times Y, \pi_x, \pi_y)$, the received function $g:X\times Y \rightarrow Z$ is a Bijection.
$\pi_x(x,y) = x$ and $\pi_y(x,y) = y$

My attempt: Since the diagram is commutative, it follows...
$$x = \pi_x(x,y) = (p_x \circ g)(x,y) \Rightarrow x = (p_x \circ g)(x,y)$$
$$y = \pi_y(x,y) = (p_y \circ g)(x,y) \Rightarrow y = (p_y \circ g)(x,y)$$
So I think in order to get the desired values, $g$ must be...
$$g(x,y) = (p_x^{-1} \circ \pi_x)(x) \cap (p_y^{-1}\circ \pi_y)(y)$$
I'm unsure what to do next. I could also say...
$$ g^{-1}(x,y) = (\pi_x^{-1}\circ p_x)(x) \cap (\pi_y^{-1}\circ p_y)(y)$$
But since I don't know if the functions $\pi, p$ themselves are bijective, I cannot conclude that $g^{-1}$ exists
I'd like to have some tips on how to proceed.

REPLY [3 votes]: More specifically, we must have that the sets $p_X^{-1}(\pi_X(x,y))\cap p_Y^{-1}(\pi_Y(x,y))=p_X^{-1}(x)\cap p_Y^{-1}(y)$ contain exactly one element for each $x\in X,\ y\in Y$.
You just showed that $g(x,y)$ is such an element, and if it contained another one, we could modify $g$ for $x,y$ and the diagram would still commute, contradicting the uniqueness of $g$.
Explicitly, for a $z\in Z$, we will have $g^{-1}(z)=(p_X(z),\,p_Y(z))$.