I'm having trouble understanding what should be a straight forward example.
Suppose $X\subseteq\mathbb{A}^2_k$ is cut out by the equation $x_1(x_2^2-x_1)=0$. Define a function $f:X\to k$ (here $k=\bar{k}$ is a field) by $f(x_1,x_2)=0$ if $x_1=0$, and $f(x_1,x_2)=x_2$ if $x_1\neq 0$. Then $f$ is not regular, but $f^2$ is.
Can anybody explain how to see this?
I was thinking if $x_1\neq 0$, then $x_2=\pm\sqrt{x_1}$ in $X$, so $f(x_1,x_2)=0$ if $x_1=0$, and $f(x_1,x_2)=\pm\sqrt{x_1}$ otherwise? I'm not sure about the sign, but this doesn't seem like it could be written as a polynomial, so $f$ is not regular? On the other hand, $f^2$ is defined by $f(x_1,x_2)^2=0$ when $x_1=0$, and $f(x_1,x_2)^2=x^2_2=x_1$ when $x_1\neq 0$? So does this just mean $f(x_1,x_2)^2=x_1$, which is a polynomial function, so $f^2$ is regular?
I just started reading some basics on my own recently, so I'm not too comfortable with the machinery yet.