Hom Functor Preserves Coproducts

I'll be referencing and using the first diagram from this wiki page. I want to convince myself that the $\operatorname{Hom}(\_,Y)$ functor preserves coproducts. So, I'll start by applying $\operatorname{Hom}(\_,Y)$ to the objects of the diagram. We get maps $\operatorname{Hom}(X_1,Y)$, $\operatorname{Hom}(X_2,Y)$ and $\operatorname{Hom}(X_1\amalg X_2,Y)$. The category sets is cartesian closed hence we can take $\operatorname{Hom}(X_1,Y)\times \operatorname{Hom}(X_2,Y)$ to be an element of the category we land in. Finally, by the universal mapping property (UMP) of the coproduct we have that $$\operatorname{Hom}(X_1,Y)\times\operatorname{Hom}(X_2,Y) \cong\operatorname{Hom}(X_1\amalg X_2,Y)$$

I'm a little worried by my use of the UMP. I know the isomorphism $\operatorname{Hom}(X_1,Y)\times\operatorname{Hom}(X_2,Y) \cong\operatorname{Hom}(X_1\amalg X_2,Y)$ is true and that I'm supposed to use the UMP somehow (basically it's the only property at my disposal) but I was hoping someone could elaborate for me. Should I be trying to use that fact that the contravariant $\operatorname{Hom}$ functor takes morphisms, say $f:X\to Y$, to precomposition with $Hom(X,Y)$?

• $\text{Hom}(\_,Y)$ preserves products (and limits more generally), not coproducts. Since $\text{Hom}(\_,Y) : \mathcal{C}^{op}\to\mathbf{Set}$, the products (limits) are in $\mathcal{C}^{op}$ and so they correspond to coproducts (colimits) in $\mathcal{C}$, so often we say it "takes colimits to limits", but technically it's just continuity, i.e. preservation of limits. ($\text{Hom}(X,\_)$ is also continuous, though in this case there's no $op$ to confuse things.) – Derek Elkins Mar 6 '17 at 4:45

Given any two maps $f_1:X_1\to Y$ and $f_2:X_2\to Y$, there exists a map $$f_1\amalg f_2:X_1\amalg X_2\to Y,$$ such that $(f_1\amalg f_2)\circ i_1= f_1$ and $(f_1\amalg f_2)\circ i_2 = f_2$, where $i_1:X_1\to X_1\amalg X_2$ and $i_2:X_2\to X_1\amalg X_2$ are the structure maps that come with the coproduct. Furthermore, the map $f_1\amalg f_2$ is unique with respect to this property. That is, if $f:X_1\amalg X_2\to Y$ is any other map such that $f\circ i_1=f_1$, and $f\circ i_2=f_2$, then $f=f_1\amalg f_2$.
The first portion of the UMP says that we have a well defined map $$\operatorname{Hom}(X_1,Y)\times\operatorname{Hom}( X_2,Y)\to\operatorname{Hom}(X_1\amalg X_2,Y).$$ sending every $(f,g)\in\operatorname{Hom}(X_1,Y)\times \operatorname{Hom}(X_2,Y)$ to $f\amalg g$. Now, given any map $\phi:X_1\amalg X_2\to Y$, we can define maps $$\phi_1:=\phi\circ i_1:X_1\to Y\quad\text{and}\quad \phi_2:=\phi\circ i_2:X_2\to Y.$$ By the uniqueness portion of the UMP, we must have $\phi=\phi_1\amalg \phi_2$. Thus the map is surjective. I'll leave injectivity as an exercise.