I am trying to understand when a morphism defined in an open dense subset of a variety can be extended to the whole variety.


For curves, it is known that if $f:C \to C’$ is a rational morphism from the curve $C$ to the curve $C’$ then f can be uniquely extended to the whole curve $C$.


On the other hand, for higher dimensional varieties the situation is more complicated, for instance,one can not extend a morphism from $\mathbb{A}^2\setminus(0,0) \to \mathbb{P}^2$.


I would like to know if is there any “nice” condition on a morphism $f:U \subset X \to Y$ where $U$ is a open dense subset of a (smooth, if necessary) projective variety $X$, and $Y$ is a projective variety, that make possible to extend $f$ to the whole $X$.


Thank you in advance. 



Extension of morphism of quasiprojective varieties
Since $Y$ is projective, the question reduces to the case $Y = \mathbb{P}^n$.
In this case, a morphism to $Y$ is given by an epimorpism $\mathcal{O}^{\oplus n+1} \to L$ for a line bundle $L$. So, if you want to extend a morphism, you need to extend the line bundle and the epimorphism.


A line bundle $L$ always extends to scheme points of codimension 1, so we may assume that $\mathrm{codim}(X \setminus U) \ge 2$. In this case there is a unique extension of $L$ as a reflexive sheaf, this sheaf is just the pushforward of $L$ from the open subset. In particular, an extension as a line bundle exists if and only if this reflexive sheaf is locally free (if $X$ is smooth this is always true). Note, however, that in general an extension is only defined modulo codimension 1 components of $X \setminus U$.


For a discussion of extension of the epimorphism, let me assume that $\mathrm{codim}(X \setminus U) \ge 2$, so that $L$ extends uniquely. Then the morphism $\mathcal{O}^{\oplus n+1} \to L$ also extends uniquely (just by taking the pushforward), and the only question is whether the extension is surjective. Again, the image of the extension is an ideal on $X$ (twisted by $L$), and this ideal is the obstruction for the extension of the morphism.


