Suppose that $f : X \rightarrow Y$ is a morphism of schemes.
Let $Z \hookrightarrow Y$ the scheme-thereotic image of $f$.
Under what conditions is the morphism $X \rightarrow Z$ an epimorphism?


If both $X = \mathrm{Spec} \, B$ and $Y = \mathrm{Spec} \, A$ are affine, then $Z = \mathrm{Spec}\, A/I$, where $I$ is the kernel of $A \rightarrow B$. Then $A/I \rightarrow B$ is injective, hence a monomorphism. Therefore $X \rightarrow Z$ is an epimorphism.


I would think that if $f$ is quasi-compact or $X$ is integral, the scheme theoretic image has nice properties ($f(X)$ is dense in $Z$) and hopefully the result is true.



Epi-mono factorisations in schemes via scheme-theoretic image
This already fails in the affine case. For example, if $Y = \mathbf A^1$ and $X = \mathbf A^1 \setminus \{0\}$, then $Y$ is the scheme-theoretic image of $X \hookrightarrow Y$. But if $Z$ is the line with two origins, then the two inclusions $Y \to Z$ agree on $X$ but are not identical.


There is a positive result when $f$ has closed image, for then $X \to \operatorname{im}(f)$ is surjective (see also the introduction to [this question](https://mathoverflow.net/q/56564/82179)). For schemes of finite type over a Jacobson ring (e.g. $\mathbf Z$ or a field $k$), this is the only way $X \to \operatorname{im}(f)$ can be an epimorphism:


**Lemma.** *Let $f \colon X \to Y$ be an epimorphism of schemes, and let $y \in Y$ be a closed point. Then there exists $x \in X$ with $f(x) = y$. In particular, if $Y$ is Jacobson and $f$ of finite type, then $f$ is surjective.*


*Proof.* For the first statement, consider the open $U = Y\setminus\{y\}$ and let $Z$ be two copies of $Y$ glued along $U$. The two natural inclusions $Y \to Z$ differ, so their restrictions to $X$ differ, showing that $y$ is in the (set-theoretic) image of $f$. The second statement follows from Chevalley's theorem. $\square$


However, there exist epimorphisms between non-Jacobson schemes that are not surjective:


**Example.** Let $A$ be a local domain of dimension $\geq 2$; for example $A = k[x,y]\_{(x,y)}$. Let $A \subseteq B$ be a local homomorphism to a discrete valuation ring $B$; for example by blowing up the closed point of $A$ and localising at a generic point of the exceptional fibre. Let $X = \operatorname{Spec} B$ and $Y = \operatorname{Spec} A$. Then $f \colon X \to Y$ is not surjective (it only hits the generic point $\eta$ and the closed point $s$), but it is an epimorphism. Indeed, if $g,h \colon Y \rightrightarrows Z$ agree on $X$, then $g(s) = h(s)$. If $U \subseteq Z$ is an affine open neighbourhood of $g(s)$, then $g$ and $h$ both land in $U$, since the only open subset of $Y$ containing $s$ is $Y$ itself. The result then follows since $A \subseteq B$ is a monomorphism of rings. $\square$


