Does having a finite number of generators, each having finite order, imply that the group is finite?

Consider the free group $G$ on $a$ and $b$, mod the relation that $a^2 = b^2 = e$. Then $G$ admits sequences of arbitrary length, namely $a$, $ab$, $aba$, $abab$, $ababa$, $\ldots$.


Define $f:\mathbb{Z}\to\mathbb{Z}$ by $$f(n)=\begin{cases} n+1&\text{ if $n$ is even} \\ n-1&\text{ if $n$ is odd}\end{cases}$$ and $g:\mathbb{Z}\to\mathbb{Z}$ by $$g(n)=\begin{cases} n-1&\text{ if $n$ is even} \\ n+1&\text{ if $n$ is odd.}\end{cases}$$

Then $f$ and $g$ are both permutations of $\mathbb{Z}$, and have order $2$ in as elements of the group of all permutations of $\mathbb{Z}$. But notice that $$(g\circ f)(n)=\begin{cases} n+2&\text{ if $n$ is even} \\ n-2&\text{ if $n$ is odd}\end{cases}$$ so $g\circ f$ is a permutation of infinite order (as you iterate it on even and odd integers, you just keep adding or subtracting $2$, respectively). It follows that the group of permutations generated by $f$ and $g$ is infinite, even though $f$ and $g$ both have finite order.

(In fact, it turns out that this is the same as silvascientist's example. The explicit representation as permutations makes it clear that all the words you can form by alternating $g$ and $f$ really are distinct elements, since you can just compute what they are as functions.)


In plane Euclidean geometry, the group generated two reflections in two parallel lines provides an easy example. The product of the two reflections is a nonzero translation, which has infinite order.