[Math] Regular functions on a variety

affine-varietiesalgebraic-geometrymorphism

In Hartshorne's Algebraic Geometry, remark 3.1.1., it is said that:

if $f,g$ are regular functions on a variety $X$, and if $f=g$ on some nonempty open subset $U\subset X$, then $f=g$ everywhere. Indeed, the set of points $f-g=0$ is closed and dense, hence equal to $X$.

I wonder if the following statement is also true: if $X$ is a variety (projective or affine) and $U\subset X$ is open, then $\mathcal{O}(U)=\mathcal{O}(X)$. The mapping $\phi: f\mapsto f|_U$ is a $k$-algebra morphism from $\mathcal{O}(X)$ to $\mathcal{O}(U)$ and, by the remark above, $\phi$ is injective. Is it also surjective? How do I show that?

Best Answer

For $U=\mathbb A^1(\mathbb C)\subset X=\mathbb P^1(\mathbb C)$ we have $ \mathcal O(X)=\mathbb C\hookrightarrow \mathcal O(U)=\mathbb C[T]$, which is not surjective.

Related Question