Q:

Let $G$ be a group and $a\in G$. If $a$ has order $n$, why $a^2, a^3, .. a^{n-1}\in G$?

When I was reading a proof, I saw this sentence:
Let $(G,\cdot)$ be a group. Let $a\in G$ has order $n$. It is clear that $a^2, a^3, \dots, a^{n-1}\in G$.
I understand why $a^{n-1}\in G$, but I don't understand why $a^2, a^3, \dots, a^{n-2}\in G$. I think that the definition of a group doesn't guarantee this.
For example, I have a group $G=\{e,(0123),(0321)\}$, where $e$ is the identity. Clearly, $a=(0123)$ has order 4, and $a^3=(0321)\in G$, but $a^2=(02)(13)\notin G$.
Where am I wrong?
Appreciate anyone who is willing to offer help!

A:

Your example isn't a group. A group needs to have the property that if $a \in G$ and $b \in G$ then $a \cdot b \in G$. This includes if $a$ and $b$ are equal, so in particular, if $a \in G$, then $a \cdot a= a^2 \in G$. Likewise $a^2 \cdot a= a^3 \in G$, and so on.

