This question is concerned with Example I.5.6.3 in Hartshorne. Let $g, h$ be elements of $k[[x,y]]$ of the form $g = y+x+g_2+g_3+\cdots, h = y-x + h_2+h_3+\cdots$ where $g_i,h_i$ are homogeneous polynomials of degree $i$. Hartshorne writes
"Since $g$ and $h$ begin with linearly independent linear terms, there is an automorphism of $k[[x,y]]$ that sends $g,h$ to $x,y$ respectively. This shows that $k[[x,y]]/(gh) \cong k[[x,y]]/(xy)$." (From the context of the example, this last isomorphism is supposed to be a $k$-algebra isomorphism.)
Question: Is seems to me that the automorphism described above is an automorphism of $k$-vector spaces. Why does it induce an automorphism of $k$-algebras?
It is an automorphism of the tangent spaces (at the origin). Then it extends to an automorphism of the algebras of formal power series.