Let $X$ and $Y$ be two varieties, and $f:X\rightarrow Y$ be a morphism. Suppose moreover there is a point $Q\in Y$ and $P=f^{-1}(Q)\in X$, such that the restriction $f:X\setminus P\rightarrow Y\setminus Q$ is an isomorphism. So in particular $f$ is a bijective birational morphism.
I was wondering under which conditions $f$ is an isomorphism. It is certainly not true in general. For example if $X$ is the affine line, $Y$ the cusp and $f:X\rightarrow Y: t\mapsto (t^3, t^2)$. Then $f: X\setminus 0\rightarrow Y\setminus (0,0)$ is an isomorphism, but of course $f:X\rightarrow Y$ is not an isomorphism.
Is it true if $X$ and $Y$ are smooth? Or if $X$ and $Y$ are projective?