Proof involving Cyclic group, generator and GCD Theorem:
$$\left\langle a^k \right\rangle = \left\langle a^{\gcd(n,k)}\right\rangle$$
Let G be a group and $$ a \in G$$ such that $$|a|=n$$
Then:
$$\left\langle a^k \right\rangle = \left\langle a^{\gcd(n,k)}\right\rangle$$
The proof begins by letting d = gcd(n,k) such that d is a divisor of k so there exists an integer r such that k = dr. 
So, $$a^k=(a^d)^r$$.
$$\left\langle a^k \right\rangle \subseteq \left\langle a^{\gcd(n,k)}\right\rangle$$
I've spent a very long time on understanding this proof but found it to be obscure. I suspect there are some gaps in my understanding. If someone could show me the light I'll be really glad.
I do not understand why the exponent r on a 'vanishes'.
Secondly, how does $$a^k\in \left\langle a^d\right\rangle$$ follows?
Thirdly, where does closure plays a role?
 A: Given an element $a$ of a group $G$, $\langle a\rangle$ is by definition the smallest subgroup of $G$ which contains $a$. This means in particular that if $H$ is a subgroup of $G$ which contains $a$, then $\langle a\rangle \subseteq H$.
Here, you want to prove two statements of this form (for ease of notation, I let $d = \gcd(n,k)$):


*

*You want to prove that $\langle a^k\rangle \subseteq \langle a^d\rangle$. From the preceeding discussion, this is the same thing as proving that $a^k \in \langle a^d\rangle$, which in turn means that there is some $e$ such that $a^k = \left(a^d\right)^e$.

*Conversely, you want to prove that $\langle a^d\rangle \subseteq \langle a^k\rangle$, this is the same thing as $a^d \in \langle a^k\rangle$.


The first one is easy: $d$ is by definition a divisor of $k$, so there exists an integer $e$ such that $k = de$. But then $\left(a^d\right)^e = a^{de} = a^k$ so $a^k \in \langle a^d\rangle$.
For the second one, you have to know that if $\gcd(n,k) = d$, then there exists an integer $\ell$ such that $k\ell \equiv d\pmod n$, meaning that there exists an integer $m$ such that $k\ell = d + mn$. Then
$$\left(a^k\right)^\ell = a^{k\ell} = a^{d+mn} = a^da^{mn} = a^d\underbrace{\left(a^n\right)}_{=1}{}^m = a^d,$$
so $a^d \in \langle a^k\rangle$.
A: for the converse part
since $d=gcd(n,k)$ and therefore from $euclidian~ algorithem$ there exists 
integers $s~\&~t$ such that
$ns+kt=d$ 
This will imply that  $a^d=a^{ns+kt}$
$\implies a^d=(a^n)^s (a^k)^t$
$\implies a^d=(a^k)^t$ since $|a|=n$
$\implies a^d \in <a^k>$
So combining equalities you'll get required thing 
