Let $f: U \rightarrow W$ be a morphism of affine algebraic sets and $f': k[W] \rightarrow k[U]$ be the k-algebra morphism of coordinate rings. Prove if $f'$ is surjective then $f$ is a homeomorphism of $U$ onto the closed subset $W$. 
Well, it's the first time I've seen this word "homeomorphism" but I read online that a map is a homeomorphism if $f$ and its inverse is continuous and $f$ is bijective.
So here's my approach to this question:
Proof: I want to show that $f$ is a bijection. Well from the correspondence theorem, there's a bijective correspondence between the morphisms of $U \rightarrow W$ and the k-algebra morphisms $k[W] \rightarrow k[U]$ so it follows that $f$ is surjective since $f'$ is surjective. Now I want to show that $f$ is injective.
Suppose that $u \neq u' \in U$, then we have $\phi' \in k[U]$ where $\phi'(u) = 0$ and $\phi'(u') = 1$
Now let $\phi' = \phi \circ f$ for some $\phi \in K[W]$, then we have $\phi(f(u)) = \phi'(u) = 0$, where we have $\phi(f(u')) = \phi'(u') = 1$ which means that $\phi(f(u)) \neq \phi(f(u'))$ which implies that $f(u) \neq f(u')$ so this means $f$ is injective and hence $f$ is a bijection.
Now how would I show that $f$ is continuous and its inverse is continous? Is my approach the right approach?
Any help is greatly appreciated!
 A: First of all, the correspondence between $K$-algebra homomorphisms and morphisms of affine algebraic varieties is contravariant, so $f$ being surjective does not imply that $f'$ is surjective - it does imply that $f'$ is a monomorphism. The monomorphisms in the category of affine varieties are the injective morphisms. I mention this explicitly because the epimorphisms in the category of affine varieties are not the surjective morphisms, but the dominant ones. 
If you are not much of a category theorist, you can prove explicitly that $f'$ is an injective map exactly by the argument you already gave, which is correct as far as I can see. However, the map $f'$ will usually not be surjective.
On the other hand, you also have to show that $f'$ is a homeomorphism of $U$ onto some closed subset of $W$, not onto $W$ itself, so being injective is just fine here.
Since $f'$ and $f$ are related via the fact that $f(\phi)=\phi\circ f'$, we can see that the image $Z:=f'(U)$ is Zariski-closed: Indeed, I claim that $Z$ is the zero set of $\ker(f)$. Indeed, if $z\in f'(U)$ with $z=f'(u)$, say, then any $\phi\in\ker(f)$ satisfies $\phi(z)=\phi(f'(u))=f(\phi)(u)=0(u)=0$. On the other hand, if $\phi\in K[W]$ vanishes everywhere on $Z=f'(U)$, this means that $\phi\circ f'$ is identically zero on $U$ which means that $0=\phi\circ f'=f(\phi)$, i.e. $\phi\in\ker(f)$.
Now we have established that the image of $f'$ is closed and the map itself is injective. Furthermore, you seem to already know that the corresponding map $f':U\to Z$ is a morphism of $K$-Varieties. It should be one of the first things you learn that morphisms are continuous for the Zariski topology. This proves that $f'$ itself is continuous. On the other hand, let $g:Z\to U$ be its inverse (map). For any closed subset $Y\subseteq U$, we have $g^{-1}(Y)=f'(Y)$. Now let $Y$ be the zero set of some ideal $I\subseteq K[U]$. Since $f$ is surjective, $f(I)$ is an ideal of $K[W]$ and it should be an easy exercise to verify that $f'(Y)$ is the zero set of $f(I)$. This proves that the preimage of any closed set under $g$ is closed, hence both maps are continuous. 
