Proving the universal mapping property for polynomial rings I am studying from Patrick Morandi's Field and Galois Theory, and I am stuck on Problem 6 from Section 1 (on page 13).

Verify the following universal mapping property for polynomial rings:
  
  
*
  
*Let $A$ be a ring containing a field $F$. If $a_1,\dotsc,a_n \in A$, show that there is a unique ring homomorphism $\varphi \colon F[x_1,\dotsc,x_n] \to A$ with $\varphi(x_i) = a_i$ for each $i$.    
  
*Moreover, suppose that $B$ is a ring containing $F$, together with a function $f \colon \{ x_1,\dotsc,x_n \} \to B$, satisfying the following property: For any ring $A$ containing $F$ and elements $a_1,\dotsc,a_n \in A$, there is a unique ring homomorphism $\varphi \colon B \to A$ with $\varphi(f(x_i)) = a_i$. Show that $B$ is isomorphic to $F[x_1,\dotsc,x_n]$.
  

The list of errata for the book says that we must assume that all the rings are commutative and the ring homomorphisms are $F$-homomorphisms (that is, they are ring homomorphisms that fix $F$).

I have proved the first part as follows: let $\mathbf{a} = (a_1,\dotsc,a_n)$. The evaluation map $\operatorname{ev}_\mathbf{a} \colon F[x_1,\dotsc,x_n] \to A$ given by $\operatorname{ev}_\mathbf{a}(f) = f(a_1,\dots,a_n)$ is an $F$-homomorphism with $\operatorname{ev}_\mathbf{a}(x_i) = a_i$ for each $i$. Moreover, if $\varphi$ is any $F$-homomorphism from $F[x_1,\dotsc,x_n]$ to $A$ with $\varphi(x_i) = a_i$, then we must necessarily have that
$$
\begin{align}
\varphi\left( \sum_{k_1,\dotsc,k_n} c_{k_1,\dotsc,k_n} x_1^{k_1} \dotsm x_n^{k_n} \right) &= \sum_{k_1,\dotsc,k_n} c_{k_1,\dotsc,k_n} \varphi(x_1)^{k_1} \dotsm \varphi(x_n)^{k_n}\\
&= \sum_{k_1,\dotsc,k_n} c_{k_1,\dotsc,k_n} a_1^{k_1} \dotsm a_n^{k_n}\\
&= \operatorname{ev}_\mathbf{a}\left( \sum_{k_1,\dotsc,k_n} c_{k_1,\dotsc,k_n} x_1^{k_1} \dotsm x_n^{k_n} \right).
\end{align}
$$
Thus, the existence and uniqueness of $\varphi$ has been established.

I am stuck in proving the second part. From the previous result, we have a unique $F$-homomorphism $\Phi \colon F[x_1,\dotsc,x_n] \to B$ given by
evaluation at $(f(x_1),\dotsc,f(x_n))$, and my intuition is that this is the required isomorphism. But I am not able to make much progress.
To show that $\Phi$ is injective, the idea I have in mind is as follows: given $0 \neq g \in \ker(\Phi)$, choose the ring $A$ and elements $a_1,\dotsc,a_n$ in such a way that $g(a_1,\dotsc,a_n) \neq 0$, thereby arriving at a contradiction. To show that $\Phi$ is surjective, my intuition is that the uniqueness of the map $\varphi$ should play a role, since we will have used only the existence in showing injectivity.
Am I on the right track? I haven't been able to convert these thoughts into a proof yet, and I would really appreciate some hints. Thanks in advance!
 A: Let $A = B$ and $a_i = f(x_i)$. The first part says that there exists a unique $F$-homomorphism $\varphi \colon F[x_1,\dotsc,x_n] \to B$ such that $\varphi(x_i) = f(x_i)$ for each $i$.
Let $A = F[x_1,\dotsc,x_n]$ and $a_i = x_i$. The hypothesis in the second part says that there exists a unique $F$-homomorphism $\psi \colon B \to F[x_1,\dotsc,x_n]$ such that $\psi(f(x_i)) = x_i$ for each $i$.
Consider $\psi \circ \varphi \colon F[x_1,\dotsc,x_n] \to F[x_1,\dotsc,x_n]$. It is an $F$-homomorphism satisfying $\psi \circ \varphi (x_i) = x_i$. But, $\operatorname{id}_{F[x_1,\dotsc,x_n]}\colon F[x_1,\dotsc,x_n] \to F[x_1,\dotsc,x_n]$ is also an $F$-homomorphism satisfying $\operatorname{id}_{F[x_1,\dotsc,x_n]}(x_i) = x_i$. Taking $A = F[x_1,\dotsc,x_n]$ and $a_i = x_i$, the uniqueness condition in the first part says that $\operatorname{id}_{F[x_1,\dotsc,x_n]} = \psi \circ \varphi$.
Consider $\varphi \circ \psi \colon B \to B$. It is an $F$-homomorphism satisfying $\varphi \circ \psi (f(x_i)) = f(x_i)$. But, $\operatorname{id}_B \colon B \to B$ is also an $F$-homomorphism satisfying $\operatorname{id}_B(f(x_i)) = f(x_i)$. Taking $A = B$ and $a_i = f(x_i)$, the uniqueness condition in the hypotheses of the second part says that $\operatorname{id}_B = \varphi \circ \psi$.
Hence, $F[x_1,\dotsc,x_n] \cong B$.
