TITLE: Is local isomorphism totally determined by local rings?
QUESTION [8 upvotes]: If $X$ and $Y$ are two varieties and the germs of regular functions $\mathcal O_{x,X}$ and $\mathcal O_{y,Y}$ of two points $x \in X$ and $y \in  Y$ are isomorphic as $k$-algebras, then can we find two neighborhoods $x\in  U$ and $y \in V$ and an isomorphism $U\simeq  V$ sending $x$ to $y$?

REPLY [21 votes]: The result follows from two general facts on morphism of varieties ($k$ can be any commutative noetherian ring and $X, Y$ are scheme of finite type over $k$; one can even remove the noetherian hypothesis if $X, Y$ are finitely presented over $k$): 

(Extension from local rings to open neighborhoods) Let $\phi: O_{Y,y}\to O_{X,x}$ be a homomorphism of local $k$-algebras. Then there exist open neighborhoods $U\ni x$, $V\ni y$ and a morphism $f : U\to V$ which induces $\phi$ (i.e. $f(x)=y$ and  $f_x: O_{Y,y}\to O_{X,x}$ is equal to $\phi$). 
(Uniqueness) Let $h_1, h_2 : X\to Y$ be two morphisms such that $h_1(x)=h_2(x)=y$ and $(h_{1})_x=(h_2)_x$. Then there exists an open neighborhood $U$ of $x$ such that $h_1|_{U}=h_2|_{U}$. 

Proof of (1): Let $V$ be an affine open neighborhood of $y$ in $Y$. Then $O_Y(V)$ is finitely generated over $k$. Let 
$$ k[T_1, \dots, T_n]\twoheadrightarrow O_Y(V) $$ 
be a surjective morphism of $k$-algebras with kernel $I$. Let $b_i\in O_Y(V)$ be the image of $T_i$. As $k[T_1, \dots, T_n]$ is noetherian, $I$ is generated by finitely many polynomials $P_1(\underline{T}), \dots, P_m(\underline{T})$ (here $\underline{T}=(T_1, \dots, T_n)$).  There exists an affine open neighborhood $U$ of $x$ and $a_1, \dots, a_n\in O_X(U)$ such that $\phi((b_i)_y)=(a_i)_x$ for all $i\le n$. As $(P_j(\underline{b}))_y=0_y=0$, we have $P_j(\underline{a})_x=0$. So shrinking $U$ if necessary, we can suppose $P_j(\underline{a})=0$. Therefore the $k$-algebra map 
$$ k[T_1, \dots, T_n]\to O_X(U), \quad T_i\mapsto a_i$$ 
factorizes throught $\psi: O_Y(V)\to O_X(U)$. By construction we have the following commutative diagram where the vertical arrows are canonical maps to the stalks
$$\begin{matrix}
O_Y(V) & \stackrel{\psi}{\longrightarrow} & O_X(U)\\ 
\downarrow&&\downarrow\\
O_{Y,y}&\stackrel{\phi}{\rightarrow}&O_{X,x} 
\end{matrix}
$$
Hence $\psi$ maps the preimage of $m_yO_{Y,y}$ in $O_Y(V)$ to the preimage of $m_xO_{X,x}$ in $O_X(U)$. So the morphism $f: U\to V$ induced by $\psi$ satisfies $f(x)=y$ and $f_x=\phi$.
Proof of (2). This is easier. Shrinking $X$ and $Y$, we can suppose $X$ and $Y$ are affine. Let $\psi_1, \psi_2: O_Y(Y)\to O_X(X)$ be the morphisms of $k$-algebras corresponding to $h_1, h_2$. Let $c_1, \dots, c_m$ be generators of $O_Y(Y)$ as $k$-algebra. Then 
$$(\psi_1(c_i))_x=(h_1)_x((c_i)_y)=(h_2)_x((c_i)_y)=(\psi_2(c_i))_x.$$
So for some affine open neighborhood $U$ of $x$, we have $\psi_1(c_i)|_U=\psi_2(c_i)|_U$ for all $i\le m$. Thus $\psi_1|_U=\psi_2|_U$ and $h_1|_U=h_2|_U$. 
I let you find out how to extend an isomorphism of local rings to an isomorphism of open neighborhoods using (1) and (2). If you need more hints, please tell.