Show there exists an injective ring homomorphism that makes the diagram commute. I am taking some practice exams to relearn algebra. I'm having trouble with questions regarding showing there exists or doesn't exist a ring homomorphism. Here's a particularly scary-looking one I can't seem to get:

Let $K$ be a field. Define the ring homomorphism $\phi:\mathbb{Z}\rightarrow K$ by $\phi(n)=n\cdot 1$. If $\phi$ is injective, and $i:\mathbb{Z}\rightarrow \mathbb{Q}$ is the standard inclusion, show there exists an injective ring homomorphism $\bar{\phi}:\mathbb{Q}\rightarrow K$ such that $\bar{\phi}(i(n))=\phi(n)$ $\forall n\in \mathbb{Z}$.

I am not even sure what concept this is trying to test. The only thing I can think of is that this would look a lot like the universal property for free modules if $K$ was a $\mathbb{Z}$-module, but I know $\mathbb{Q}$ isn't a free $\mathbb{Z}$-module. Does this question have anything to do with something being free?
If I try to just make up an explicit one, I'd try $\bar{\phi}:\frac{n}{m}\mapsto n\cdot 1_K$. Since $\frac{n}{m}\in \mathbb{Q}$, $\gcd(n,m)=1$. When $m=1$, $\frac{n}{m}\in \mathbb{Z}$, ,and clearly it agrees with $\phi$ when restricted to $\mathbb{Z}$.
But $\ker(\bar{\phi})=\{\frac{n}{m}|n\cdot 1_K=0_K\}$. When $\text{char}(K)=0$, I think I've constructed an injective homomorphism here. If $\text{char}(K)=p$, then $\phi:\mathbb{Z}\rightarrow \mathbb{Z}_p$ being injective means that $\{n|n\cdot 1\equiv 0\pmod p\}=\{0\}$, so I think my $\bar{\phi}$ is injective then, too.
So I guess technically I've shown there exists an injective homomorphism?
But, all I did was basically pick a random, easy homomorphism, so I don't think that's what the question is trying to test. Is there a more generally applicable approach to this kind of problem?
 A: The function you defined is not a homomorphism. For example, $\bar{\phi}(\frac{1}{2}+\frac{1}{3})$ will be $5$ by your definition, which is clearly not $1+1$. (doesn't matter what $K$ is)
Note that $\mathbb{Q}$ is the field of fractions of $\mathbb{Z}$. We have the inclusion $i:\mathbb{Z}\to\mathbb{Q}$, $i(n)=\frac{n}{1}$. So now given an injective ring homomorphism $\phi:\mathbb{Z}\to K$ it is very natural to define:
$\bar{\phi}(\frac{m}{n})=\phi(m)\cdot[\phi(n)]^{-1}$ where $m,n\in\mathbb{Z}, n\ne 0$
Note that since $\phi$ is injective we have $\phi(n)\ne 0$, and so $\phi(n)^{-1}$ is indeed defined. Now let's check that this $\bar{\phi}$ is well defined. Suppose $\frac{m}{n}=\frac{k}{l}$. Then $ml=kn$ and so $\phi(m)\phi(l)=\phi(k)\phi(n)$. Thus:
$\bar{\phi}(\frac{m}{n})=\phi(m)\cdot [\phi(n)]^{-1}=\phi(k)\cdot [\phi(l)]^{-1}=\bar{\phi}(\frac{k}{l})$
So $\bar{\phi}$ is indeed a well defined function. Now similarly you can check that it is indeed a homomorphism and it extends $\phi$. It is also trivially injective, because it is a homomorphism of fields.
We indeed get a universal property of the field of fractions here. Suppose $R$ is an integral domain, $F$ is its field of fractions. Let $i:R\to F$ be the inclusion $i(r)=\frac{r}{1}$. Given an injective homomorphism $\phi:R\to K$ where $K$ is a field, there is a unique homomorphism $\bar{\phi}:F\to K$ such that $\bar{\phi}\circ i=\phi$. This universal property is a special case of the universal property of ring localizations.
