$f(X)$ dense in $Spec A$ I have some problems solving the following exercise from Liu's book Algebraic Geometry and Arithmetic Curves, exercise 3.15 from chapter 2.
Let $X$ be a quasi-compact scheme, $A=O_X(X)$. Let us consider the morphism $f:X\rightarrow Spec(A)$ induced by the identity on $A$. Show that $f(X)$ is dense in $Spec(A)$.
So I want to prove that for every distinguished open $D(g)$ of $Spec(A)$, the intersection $f(X)\cap D(g)\neq\emptyset$.
Following my intuition, I would like to prove that the image of $X_g=\{x\in X\,|\,g_x\in O_{X,x}^*\}$ is in $D(g)$. (I have this idea, because $O_X(X_g)\simeq O_X(X)_g=A_g$, which is equal to $O_{Spec A}(D(g))$.)
I don't know how to really prove this, and I don't see where to use the quasi-compactness condition.
Thank you in advance!
 A: The map $\mathscr{O}_X(X)_g\rightarrow\mathscr{O}_X(X_g)$ is injective for quasi-compact $X$, but it might not be surjective if $X$ is not also quasi-separated.
Anyway, let $X=\bigcup_{i=1}^nU_i$, $U_i=\mathrm{Spec}(A_i)$, be a finite affine open covering of $X$. The map $f:X\rightarrow\mathrm{Spec}(A)$ takes a point $x$ and maps it to the ideal obtained as the inverse image of $\mathfrak{m}_x\subseteq\mathscr{O}_{X,x}$ along $A=\mathscr{O}_X(X)\rightarrow\mathscr{O}_{X,x}$. So you want to show that for each non-nilpotent $g\in A$, there exists $x\in X$ such that $g\notin f(x)$, i.e., such that $g_x\notin\mathfrak{m}_x$. Alternatively, if $g_x\in\mathfrak{m}_x$ for all $x$, you want to prove that $g$ is nilpotent. This is where quasi-compactness comes in.
The assumption $g_x\in\mathfrak{m}_x$ for all $x$ implies that, if $g_i$ is the restriction of $g$ to $U_i$, then $D(g_i)=\mathrm{Spec}(A_i)$. So $g_i$ lies in the nilradical of $A_i$, i.e., $g_i$ is nilpotent. Therefore $g_i^{k_i}=0$ for some $k_i\geq 1$.
Let $k=\max_{1\leq i\leq n}k_i$. Then $g^k\vert_{U_i}=g_i^k=0$ for all $i$, so $g^k=0$. This means that $g$ is nilpotent.
In fact, this is very similar to the argument used to prove that $\mathscr{O}_X(X)_g\rightarrow\mathscr{O}_X(X_g)$ is injective when $X$ is quasi-compact. It occurs to me now that what you want also follows from this injectivity, as you surmise. If $g\in\mathfrak{m}_x$ for all $x$, then $X_g=\emptyset$, so $\mathscr{O}_X(X_g)=0$, and injectivity of the aforementioned map forces $\mathscr{O}_X(X)_g=0$, i.e., $g$ is nilpotent.
