To compute $5^{15} \pmod 7$ how should I apply Corollary of the Lagrange theorem? What is the simple way of calculating $5^{15} \pmod 7$ and how to use Corollary ($a^{|G|}=e$) to solve it?
 A: Lagrange's theorem tells us if f $G$ is a finite group and $H$ is a subgroup of $G$, then $\vert H \vert$ divides $\vert G \vert$.
As a corollary we get that given $a \in G$, $\vert a \vert$ divides $\vert G \vert$ which means that $\vert G \vert = r \vert a \vert$ for some $r \in \mathbb Z$.
As a corollary to that we get that $a^{\vert G \vert} = e$ since $\vert G \vert = r \vert a \vert$ for some $r \in \mathbb Z$ and hence $a^{ \vert G \vert} = a^{r \vert a \vert} = (a^{\vert a \vert})^r = e^r = e$.

Now, for your explicit problem, we want to calculate $5^{15} \pmod 7$. In this case $G = (\mathbb Z_7)^*$, that is, the group of invertible elements, which in this case is $\{\overline 1, \ldots, \overline 6\}$ since $7$ is prime, which means $\vert G \vert = 6$. In general, the order of $(\mathbb Z_d)^* = \phi(d)$ where $\phi$ is Euler's Phi function.
Now observe that $5 \in G$ which means we can use the last corollary and get $\overline 5^6 = \overline 1$. Observe that $\overline 5^{15} = \overline 5^{12} \cdot \overline 5^3 = \overline 5^3$. But $5^3 = 125 = 7 * 17 + 6 \equiv 6 \pmod 7$ as we desired.

Notice that this wouldn't work for calculating, say $3^{15} \pmod 6$ since $\overline 3 \notin (\mathbb Z _6)^* = \{\overline 1, \overline 5\}$.
