If $G$ is free on $A$ and on $B$, then $|A|=|B|$. I found a theorem in a note book of abstract algebra that states that if a group $G$ is free on $A$ and also on $B$ then the two sets $A$ and $B$ must have the same cardinality. I don’t know if I get this right but aren’t the sets $A$ and $B$ generating sets of the group, so they can be of different cardinalities? For example, we can take $A =\{(12),(13),(23)\}$ and $B= \{(123),(12)\}$ for the symmetric group $S_3$.
 A: A group can have generating sets of different cardinalities, but it can't have free generating sets of different cardinalities. Here is an argument which shows that a group $F$ can't have finite free generating sets $A,B$ of different cardinalities. (The same argument works if $A$ is finite and $B$ infinite or vice versa; if both are infinite, simply note that $|A|=|F|=|B|.$) It works not only for groups but for any variety of algebraic structures which contains a finite structure with more than one element. I believe the argument is due to Jónsson and Tarski; at any rate, they gave examples of varieties in which some free algebras have free generating sets of different cardinalities.
Let $F$ be a free group which is freely generated by two finite sets, an $m$-element set $A=\{a_1,\dots,a_m\}$ and an $n$-element set $B=\{b_1,\dots,b_n\}.$ I claim that $m=n.$
Let $G$ be some group of order $k,$ where $1\lt k\lt\infty.$
Define a map $\varphi:G^m\to G^n$ as follows. Given any $m$-tuple $\langle x_1,\dots,x_m\rangle\in G^m,$ consider the unique homomorphism $h:F\to G$ such that $h(a_i)=x_i$ for $i=1,\dots,m;$ let $y_j=h(b_j)$ for $j=1,\dots,n,$ and define $\varphi(\langle x_1,\dots,x_m\rangle)=\langle y_1,\dots,y_n\rangle.$
Define a map $\psi:G^n\to G^m$ as follows. Given any $n$-tuple $\langle y_1,\dots,y_n\rangle\in G^n,$ consider the unique homomorphism $h:F\to G$ such that $h(b_j)=y_j$ for $j=1,\dots,n;$ let $x_i=h(a_i)$ for $i=1,\dots,m,$ and define $\psi(\langle y_1,\dots,n\rangle)=\langle x_1,\dots,x_m\rangle.$
Observe that the maps $\varphi:G^m\to G^n$ and $\psi:G^n\to G^m$ are inverses of each other, so they are bijections. It follows that
$$k^m=|G|^m=|G^m|=|G^n|=|G|^n=k^n.$$
Since $1\lt k\lt\infty,$ it follows that $m=n.$
