How to find a bijection between R-valued points of X and local ring homomorphisms? I am trying to prove the following fact for a homework assignment in algebraic geometry:
Let R be a local ring, and X a prescheme. Show that there is a one-one correspondence between R-valued points on X and pairs (x, g) of points x on X and local homomorphisms $g: O_{X, x} \to R$.
Now, given f: Spec R -> X, and writing x for f(M) where M is the maximal ideal of R, the induced map on stalks gives us a map $g: O_{X,x} \to R_M = R$. Then it remains to show that given a point x of X and a map $g: O_{X,x} \to R$, that there is a map f: Spec R -> X such that f(M) = x and such that the induced map is g.
I haven't had any luck yet with associating a map f with a given g. Here are my thoughts and some of the things I've tried:


*

*When R is a field, then Spec R has only a single point, and thus the map f is completely determined by where it sends the zero ideal. This induces a local homomorphism from $O_{X,x}$ to k, which is to say that it induces a map from $O_{X,x} / M_x \to k$ since the maximal ideal $M_x$ of $O_{X,x}$ is contained in the kernel of the local homomorphism. Anyway, as long as there is some local homomorphism from $O_{X,x}$ to k, then the map f sending (0) to x is a well-defined morphism. Now, when R is again just a local ring, it seems unlikely that f is completely determined by where it sends M, and I can't see how to work with this.

*I've tried extending the map g to a map of sheaves, thinking that maybe from there I'd be able to find my map of preschemes. But here I get a little lost, and I'm not sure how to make it work.

*We know a lot about the topology of Spec R, and this forces some properties of X. For example, the only open neighborhood of M in Spec R is the whole space. Therefore, f(Spec R) covers any open neighborhood of f(M). I haven't pursued this way very far yet, as it seems a little further afield.
I just need a little hint to get me going again -- I've been thinking about this one for a while and I can't seem to get unstuck.
 A: Let $s$ be the special point of $Spec(R)$, i.e. the one which corresponds to the unique maximal ideal of $R$. Then every point $p$ of $Spec(R)$ generalizes to $s$, i.e. $s \in \overline{\{p\}}$. If $f : Spec(R) \to X$ is a continuous map, we thus have $f(s) \in \overline{\{f(p)\}}$, i.e. every open neighborbood of $f(s)$ contains $f(p)$. In other words, if $U$ is an open neighborhood of $f(s)$, the map $f$ actually factors as $Spec(R) \to U \to X$. If $f$ is a morphism of schemes, this is also a factorization in the category of schemes.
Thus a morphism $f : Spec(R) \to X$ mapping $s \mapsto x$ corresponds to a equivalence class of morphisms $Spec(R) \to U$ mapping $s \mapsto x$, where $U$ is an affine open neighboord of $x$. Such a morphism corresponds to a homomorphism $\mathcal{O}_X(U) \to R$, and since we consider equivalence classes, we get a homomorphism $\mathcal{O}_{X,x} \to R$, whose locality corresponds to the condition $s \mapsto x$ above.
A: For any point $x \in X$, there is a canonical morphism $\mathrm{Spec} \mathcal{O}_{X, x} \to X$. To prove this, first take an affine neighborhood of $x$. You may also want to look at the definition of a morphism of locally ringed spaces / schemes, specifically, the requirement on stalks.
