Are morphisms from affine schemes to arbitrary schemes affine morphisms?

To put this question in precise language, let $X$ be an affine scheme, and $Y$ be an arbitrary scheme, and $f : X \rightarrow Y$ a morphism from $X$ to $Y$. Does it follow that $f$ is an affine morphism of schemes? While all cases are interesting, a counterexample that has both $X$ and $Y$ noetherian would be nice.

• I don't think this holds. You might want to read about Stein factorization. Sep 7 '11 at 23:17
• Dear Wanderer, I don't see that it is related to Stein factorization. E.g. this is true whenever the target scheme is separated (see e.g. Jacob's answer below), and so in particular in the world of projective schemes over a field, which is where one might typically apply the notions of Stein factorization. Am I missing something? Best wishes, Matthew Sep 8 '11 at 2:46
• Your right that it does not help to construct a counterexample, but on the other hand it is interesting from the perspective of this question, since it says that any quasicompact quasiseparated morphism of schemes factors through an affine morphism. Sep 8 '11 at 6:18

No, here is an example of a morphism $f:X\to Y$ which is not affine although $X$ is affine.
Take $X=\mathbb A^2_k$, the affine plane over the field $k$ and for $Y$ the notorious plane with origin doubled: $Y=Y_1\cup Y_2$ with $Y_i\simeq \mathbb A^2_k$ open in $Y$ and $Y\setminus Y_i= \lbrace O_i\rbrace$, a closed rational point of $Y$.
We take for $f:X\to Y$ the map sending $X$ isomorphically to $Y_1$ in the obvious way.
Then, although the scheme $X$ is affine, the morphism $f$ is not affine because the inverse image $f^{-1}(Y_2)$of the affine open subscheme $Y_2\subset Y$ is
$X \setminus \lbrace 0 \rbrace=\mathbb A^2_k \setminus \lbrace 0 \rbrace$, the affine plane with origin deleted, well known not to be affine.
Though it is not true in general, it is true whenever $Y$ is separated. The map $f$ from $X$ to $Y$ factors as a composition $$X \stackrel{f'}{\rightarrow} X \times Y \stackrel{f''}{\rightarrow} Y$$ The map $f''$ is a pullback of the projection map from $X$ to a point (or Spec $\mathbb{Z}$, or whatever base you are working over), and therefore affine. The map $f'$ is a pullback of the diagonal $Y \rightarrow Y \times Y$, and therefore a closed immersion if $Y$ is separated (and in particular affine).
• It seems to me worth weakening the hypothesis from the diagonal being closed ("separated") to the diagonal being affine ("semi-separated") because that condition is equivalent to the inclusion of affine opens being affine. Then the argument shows that if no inclusions of affine open in $Y$ is a counterexample, then no map from an affine to $Y$ is a counterexample. Sep 8 '11 at 0:20