Question about factorization of maps Consider two regular maps between affine algebraic sets over $\mathbb C$: $f:X\to Y$ and $g:X\to Z$. Suppose $Z$ is normal, $g$ is onto, and for every $x_1,x_2$, $g(x_1)=g(x_2)$ implies $f(x_1)=f(x_2)$. Does that imply that $f$ factors though $g,$ i.e. $f=hg$ for some $h:Z\to Y$?
We remark, that normality of $Z$ appears essential, since otherwise the identity map $f:X\to X$ together with a bijection $g:X\to Z$ which is not an isomorphism would produce a counterexample.
 A: No. Consider the case in which $X$ is the disjoint union of a closed subset of $Z$ and the open complement, and $g:X\to Z$ is the obvious bijection. Let $Y$ be $X$ and let $f$ be the identity map.
A: You need to assume that $X$ is irreducible, otherwise, as Tom points out, there are easy counterexamples.
On the other hand, when $X$ is irreducible the answer is positive. The following proof is somewhat involved, it is quite likely that there is a more direct one.
One reduces immediately to the case $Y = \mathbb A^1$, and then the problem is to show that a regular function $f$ on $X$ that is constant along the fibers of $g$ descends to a regular function on $Z$. 
Notice that it is enough to show that $f$ descends to a rational function $h$ on $Z$. In fact, if $X'$ is the normalization of $X$, we only need to show that $h$ has no poles along any closed irreducible subset $V$ of codimension $1$. If $W$ is an irreducible component of the inverse image of $V$ in $X'$, we obtain an extension $\mathcal O_{Z,V} \subseteq \mathcal O_{X,W}$ of DVRs; since the image of $h$ in $k(X')$ has no poles along $W$, it follows that $h$ is in $\mathcal O_{Z,V}$.
Consider the morphism $\phi \colon X \to Z \times \mathbb A^1$ induced by $f$ and $g$; its image $ \phi(X)$ contains a subset $U$ that is open in the closure $\overline{\phi(X)}$. The projection $U \to Z$ is dominant and injective; hence, by Zariski's main theorem it is an open embedding. The other projection $U \to \mathbb A^1$ gives the desired rational function on $Z$.
