I'm proving some properties about the free groups using the categorical definition, which is the following:
Let $X$ be a set, $L$ a group and $i:X\to L$ a map. The pair $(L,i)$ is free on $X$ if for every group $H$ and every map $f:X\to H$ there exists a unique group homomorphism $\varphi:G\to H$ such that $\varphi\circ i=f$.
I've already proved that
(1) $i$ must be injective and that
(2) if $(L_1,i_2)$ and $(L_2,i_2)$ are free on $X$ then there exists $\varphi:L_1\to L_2$ such that $\varphi\circ i_1=i_2$.
Now I'm stuck with the following:
If $|X|=|Y|$ and $(L_1,i_1)$ and $(L_2,i_2)$ are free on $X$ and $Y$ respectively, then $L_1\cong L_2$.
I tried using a biyection $g:X\to Y$ and (2) to find $\varphi:L_1\to L_2$ which I can prove that is surjective. However, I cannot show that it is inyective outside $i_1(X)$, what can I do?