Problem I.4.7 in Hartshorne Let $X,Y$ be varieties and suppose we have points $P \in X, Q \in Y$ such that the corresponding local rings are isomorphic, i.e. $\mathcal{O}_{Q,Y} \cong \mathcal{O}_{P,X}$. Then the problem is to show that there exist open sets $P \in U \subset X, Q \in V \subset Y$ and an isomorphism $U \cong V$ that takes $P$ to $Q$. 
The solution given in http://math.berkeley.edu/~reb/courses/256A/1.4.pdf proceeds as follows: Let $f:\mathcal{O}_{Q,Y} \rightarrow \mathcal{O}_{P,X}$ be the isomorphism of local rings. We can consider $X,Y$ to be affine varieties of the same affine space $\mathbb{A}^n$. Moreover, we can take $P=Q=0$. Let $y_1,\dots,y_n$ be the coordinate functions on $\mathbb{A}^n$. Since $y_i$ is a regular function on $Y$, then it can be viewed as an element of the local ring $\mathcal{O}_{Q,Y}$, say $\langle V_i, y_i \rangle$. Under $f$ it is taken to a germ $\langle U_i, f(y_i) \rangle$. Define the open set $U$ of $X$ by $U = \cap_i U_i$. Then we can define a morphism $f^*: U \rightarrow Y$ by sending $(a_1,\dots,a_n) \in X$ to $(f(y_1)(a_1,\dots,a_n),\dots,f(y_n)(a_1,\dots,a_n))$. The solution then says that likewise we can define a morphism $g^*:V \rightarrow X$ on an open set $V$ of $Y$ and the composition of the two morphisms is the identity wherever it is defined. 
Question 1: How exactly is $g^*$ defined? If i define it in the same manner as $f^*$ then i don't see why i get the identity.
Question 2: Why can we even compose $g^*$ and $f^*$? It seems that we have no guarantee that these morphisms are dominant.
Edit
Any alternative solution to this problem will be accepted as answer as well.
Edit
 A: Question 1: Let us represent a point of $\mathbb{A}^n$ as the action of an $n$-tuple of regular functions on the point itself. These regular functions are just the coordinate functions on $\mathbb{A}^n$. So we have that $a=(a_1,\dots,a_n) = (y_1,\dots,y_n)(a_1,\dots,a_n)$. Alternatively, the point $a$ is the image of itself under the identity morphism $(y_1,\dots,y_n)$ of $\mathbb{A}^n$. Now we can define a morphism $f^*: U \rightarrow Y$ by having $f$ act on the $n$-tuple of regular functions $(y_1,\dots,y_n)$ as $(a_1,\dots,a_n) \mapsto (f(y_1),\dots,f(y_n))(a_1,\dots,a_n)$, where $U=\cap_i U_i$ and $U_i$ is the open set where $f(y_i)$ is defined. For $g=f^{-1}$ let $V_i$ be the open set where $g(y_i)$ is defined and let $V=\cap_i V_i$. This gives a morphism $g^*: V \rightarrow X$. To see what is the effect of $g^*$ on the point $(f(y_1)(a),\dots,f(y_n)(a))$, observe that $(f(y_1),\dots,f(y_n))(a)$ and so by definition $f^*$ is induced by the action of $g$ on the $n$-tuple of regular functions $(f(y_1),\dots,f(y_n))$ giving $g^*((f(y_1),\dots,f(y_n))(a)) = (g(f(y_1)),\dots,g(f(y_n)))(a) = (y_1,\dots,y_n)(a)=(a)$.
Question 2: In general $f^*(U) \cap V$ will not be an open set. To remedy this, replace $U$ by $U^* := (f^*)^{-1}(V) \cap U$ and $V$ by $V^* :=(g^*)^{-1}(U^*) \cap V$. Then $f^*, g^*$ induce an isomorphism of $U^*,V^*$.
A: Define $g^*$ in parallel to the way you define $f^*$, where you take $g = f^{-1}$ (which exists since $f$ is an isomorphism). Thus their composition is the identity since $f \circ g = g \circ f = id$. 
As for dominance, we define the open sets $U$ and $V$ so that this is the case - i.e. define $U$ as above, then define $V$ as $f^*(U)\cap \cap_i V_i$ (where the $V_i$ are defined analogously to the $U_i$ above).   
