Let $X,Y$ be quasi-projective varieties and $f:X\to Y$ a morphism. If $X',Y'$ are closed subvarieties of $X,Y$ respectively such that $f(X')\subset Y'$, prove that $f|_{X'}:X'\to Y'$ is a morphism.
I know how to prove this when $X',Y'$ are open subvarieties and I also when $X,Y$ are affine.
I also know the following result: if $\{\mathcal{U}_i\}_{i\in I}$ and $\{\mathcal{V}_i\}_{i\in I}$ are open covers of $X$ and $Y$ respectively with $f(\mathcal{U}_i)\subset \mathcal{V}_i$, then $f:X\to Y$ is a morphism if and only if $f:\mathcal{U}_i\to \mathcal{V}_i$ are morphisms $\forall i$.
Now this is what I'm trying to do: if I can take the above covers $\{\mathcal{U}_i\}_{i\in I}$ and $\{\mathcal{V}_i\}_{i\in I}$ to be affine, then $\mathcal{U}_i\cap X'$ is an affine subvariety of $\mathcal{U}_i$, so $f:\mathcal{U}_i\cap X'\to\mathcal{V}_i\cap Y'$ is a morphism $\forall i$ and consequently $f:X'\to Y'$ is a morphism.
My difficulty is proving that such covers exist, but I'm not even sure that they do.
If there is a better strategy for the whole thing, I'd also be happy to know about it. Thank you!
Step 1. Let $Y$ be affine. Consider the affine open cover of $X$.
Step 2. Consider the affine open cover of $Y$ and its preimage on $X$.